:root {
  --bg: #f3f8fc;
  --surface: #ffffff;
  --line: #d8e7f0;
  --text: #20242c;
  --muted: #667085;
  --primary: #2589c8;
  --primary-dark: #166fa7;
  --aqua: #66c7d8;
  --purple: #5b37b7;
  --success-bg: #e9f7ef;
  --success-text: #1f7a4d;
}

html {
  font-size: 15px;
  scroll-behavior: auto !important;
}

body {
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(102, 199, 216, .16), transparent 260px),
    var(--bg);
  color: var(--text);
}

a,
button,
.btn,
.form-control,
.form-select {
  transition: border-color .18s ease, box-shadow .18s ease, color .18s ease, background-color .18s ease, transform .18s ease;
}

.btn:hover:not(:disabled),
.btn:focus-visible:not(:disabled) {
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.page-heading,
.home-hero,
.module-card,
.metric,
.table-shell,
.stepper,
.step-panel,
.validation-card,
.action-panel,
.catalog-current,
.form-grid {
  animation: fade-up .34s ease both;
}

.module-card:nth-child(2),
.metric:nth-child(2),
.validation-card:nth-child(2) {
  animation-delay: .04s;
}

.module-card:nth-child(3),
.metric:nth-child(3),
.validation-card:nth-child(3) {
  animation-delay: .08s;
}

.form-control:focus,
.form-select:focus {
  border-color: rgba(37, 137, 200, .62);
  box-shadow: 0 0 0 .2rem rgba(37, 137, 200, .13);
}

.app-header {
  background: rgba(255, 255, 255, .94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.navbar-brand {
  font-weight: 700;
  color: var(--primary);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
}

.brand-lockup img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.environment-badge {
  display: inline-flex;
  align-items: center;
  margin-left: .75rem;
  padding: .2rem .55rem;
  border-radius: 999px;
  border: 1px solid #f59e0b;
  background: #fff7ed;
  color: #9a3412;
  font-size: .76rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.nav-link {
  color: var(--text);
  font-weight: 600;
}

.user-menu {
  display: flex;
  gap: .75rem;
  align-items: center;
  color: var(--muted);
}

.user-admin-button {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.user-admin-button svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.app-main {
  width: min(1440px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 3rem;
}

.login-shell {
  min-height: calc(100vh - 90px);
  display: grid;
  place-items: center;
}

.login-panel {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2rem;
  box-shadow: 0 22px 60px rgba(37, 137, 200, .16);
}

.login-logo {
  width: 150px;
  height: auto;
  display: block;
  margin-bottom: 1.25rem;
}

.stack {
  display: grid;
  gap: .75rem;
}

.mini-stack {
  min-width: 220px;
  gap: .35rem;
}

.eyebrow {
  margin: 0 0 .25rem;
  color: var(--purple);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 750;
}

.muted,
small {
  color: var(--muted);
}

.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1rem;
}

.home-hero {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  padding: 2.5rem 0 1.5rem;
}

.home-hero h1 {
  font-size: 2.35rem;
}

.home-logo {
  width: 190px;
  height: auto;
  display: block;
  margin-bottom: 1rem;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.module-alert {
  max-width: 960px;
  margin: 0 0 1rem 0;
}

.module-card {
  min-height: 132px;
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 12px 30px rgba(32, 36, 44, .06);
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}

.module-card strong,
.module-card small {
  display: block;
}

.module-card strong {
  margin-bottom: .25rem;
  font-size: 1.05rem;
}

.module-card-active:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 18px 38px rgba(37, 137, 200, .16);
}

.module-card-disabled {
  opacity: .58;
}

.inline-timeout-form {
  max-width: 120px;
}

.module-icon {
  width: 48px;
  height: 48px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(102, 199, 216, .22), rgba(91, 55, 183, .14));
  color: var(--primary);
  font-weight: 800;
}

.search-form,
.filter-bar {
  display: flex;
  gap: .5rem;
  align-items: center;
}

.search-form {
  width: min(520px, 100%);
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem;
  margin-bottom: 1rem;
}

.metric-row.product-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem;
}

.movement-detail {
  margin-top: .75rem;
}

.detail-wide {
  grid-column: span 2;
}

.device-detail-summary {
  display: grid;
  grid-template-columns: 1.35fr repeat(3, minmax(0, 1fr));
  gap: .75rem;
  margin-bottom: 1rem;
}

.detail-card,
.detail-panel,
.timeline-content {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.detail-card {
  min-width: 0;
  padding: 1rem;
}

.detail-card span,
.detail-panel-title span,
.timeline-header span,
.detail-pairs dt,
.timeline-grid dt,
.observation-item span {
  display: block;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-card strong {
  display: block;
  margin-top: .35rem;
  color: #111827;
  font-size: 1.05rem;
  overflow-wrap: anywhere;
}

.detail-card-main strong {
  font-size: 1.25rem;
}

.detail-card-current-value {
  border-color: #93c5fd;
  background: #eff6ff;
}

.detail-card small {
  display: block;
  margin-top: .35rem;
  color: var(--muted);
}

.device-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
  margin-bottom: 1.25rem;
}

.audit-detail-values {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.detail-panel {
  padding: 1rem;
}

.detail-panel-title,
.timeline-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .9rem;
}

.detail-panel-title strong,
.timeline-header strong {
  color: #111827;
}

.detail-pairs,
.timeline-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .85rem 1rem;
  margin: 0;
}

.detail-pairs div,
.timeline-grid div {
  min-width: 0;
}

.detail-pairs dd,
.timeline-grid dd {
  margin: .18rem 0 0;
  color: #1f2937;
  overflow-wrap: anywhere;
}

.detail-section {
  margin-top: 1.25rem;
}

.detail-count {
  color: var(--muted);
  font-size: .9rem;
  font-weight: 700;
}

.timeline-list {
  display: grid;
  gap: .8rem;
}

.timeline-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: .75rem;
}

.timeline-marker {
  position: relative;
  min-height: 100%;
}

.timeline-marker::before {
  content: "";
  position: absolute;
  top: .7rem;
  left: 50%;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--primary);
  transform: translateX(-50%);
}

.timeline-marker::after {
  content: "";
  position: absolute;
  top: 1.35rem;
  bottom: -.8rem;
  left: 50%;
  width: 1px;
  background: var(--line);
  transform: translateX(-50%);
}

.timeline-item:last-child .timeline-marker::after {
  display: none;
}

.timeline-content {
  padding: 1rem;
}

.timeline-header h3 {
  margin: .2rem 0 0;
  color: #111827;
  font-size: 1rem;
}

.observation-list {
  display: grid;
  gap: .55rem;
  margin-top: .9rem;
  padding-top: .85rem;
  border-top: 1px solid var(--line);
}

.audit-observation-cards {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.observation-item {
  padding: .75rem;
  border: 1px solid rgba(37, 137, 200, .16);
  border-radius: 8px;
  background: #f8fbff;
}

.observation-item p {
  margin: .25rem 0 0;
  color: #1f2937;
}

.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.metric:hover {
  border-color: rgba(37, 137, 200, .35);
  box-shadow: 0 14px 30px rgba(32, 36, 44, .08);
  transform: translateY(-1px);
}

.metric span {
  display: block;
  color: var(--muted);
}

.metric strong {
  display: block;
  font-size: 1.7rem;
}

details.metric summary {
  cursor: pointer;
  list-style: none;
}

details.metric summary::-webkit-details-marker {
  display: none;
}

details.metric summary strong {
  font-size: 1.1rem;
}

.metric-breakdown {
  display: grid;
  gap: .45rem;
  margin-top: .8rem;
  padding-top: .75rem;
  border-top: 1px solid var(--line);
}

.metric-breakdown div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}

.metric-breakdown span,
.metric-breakdown strong {
  display: inline;
  font-size: .9rem;
}

.metric-breakdown strong {
  font-weight: 800;
}

.table-shell {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-x: auto;
}

.table-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
}

.table-title-row strong,
.table-title-row small {
  display: block;
}

.table-title-row small {
  color: var(--muted);
}

.panel-section {
  margin-top: 1rem;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .65rem;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 750;
}

.table {
  margin-bottom: 0;
  min-width: 1000px;
}

.table thead th {
  color: var(--muted);
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
}

.mono {
  font-family: Consolas, "Liberation Mono", monospace;
  font-size: .92rem;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 1.6rem;
  padding: .2rem .55rem;
  border-radius: 999px;
  background: var(--success-bg);
  color: var(--success-text);
  font-weight: 700;
}

.status-muted {
  background: #f0f2f5;
  color: #667085;
}

.status-warning {
  background: #fff5db;
  color: #946200;
}

.status-assigned {
  background: #e7f0ff;
  color: #175cd3;
}

.status-danger {
  background: #fde8e8;
  color: #b42318;
}

.loan-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 5.8rem;
  min-height: 1.25rem;
  padding: .1rem .55rem;
  border-radius: .25rem;
  font-size: .78rem;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  white-space: nowrap;
}

.loan-status-pending {
  background: #b7efd0;
  color: #106b38;
}

.loan-status-paid {
  background: #16a34a;
}

.loan-status-overdue {
  background: #dc3545;
}

.loan-status-cancelled,
.loan-status-default {
  background: #667085;
}

.audit-table {
  min-width: 1120px;
}

.audit-table th,
.audit-table td {
  vertical-align: middle;
}

.audit-table tbody tr {
  border-top: 1px solid var(--line);
}

.audit-subline {
  display: block;
  margin-top: .18rem;
  color: var(--muted);
  font-size: .88rem;
}

.audit-row-overdue {
  background: #fff7f7;
}

.audit-row-overdue td:first-child {
  box-shadow: inset 4px 0 0 #d92d20;
}

.audit-form-shell {
  display: grid;
  gap: 1rem;
}

.audit-current-panel,
.audit-condition-panel,
.audit-compare-panel,
.audit-photo-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 1rem;
  padding: 1rem;
}

.audit-entry-panel {
  margin-bottom: 0;
}

.audit-current-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem;
}

.audit-condition-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem;
}

.audit-current-grid > div,
.audit-condition-grid > div {
  min-width: 0;
  background: #f8fafc;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  padding: .85rem;
}

.audit-current-grid span,
.audit-condition-grid span,
.audit-evidence > span,
.audit-photo-input span {
  display: block;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.audit-current-grid strong,
.audit-condition-grid strong {
  display: block;
  margin-top: .35rem;
  color: #111827;
  overflow-wrap: anywhere;
}

.audit-current-grid small,
.audit-condition-grid small {
  display: block;
  margin-top: .35rem;
  color: var(--muted);
}

.audit-condition-notes {
  grid-column: 1 / -1;
}

.audit-condition-notes dl {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: .7rem;
  margin: .55rem 0 0;
}

.audit-condition-notes dt {
  color: var(--muted);
  font-size: .76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.audit-condition-notes dd {
  margin: .2rem 0 0;
  color: #111827;
  overflow-wrap: anywhere;
}

.audit-compare-total {
  align-self: center;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
  font-size: .82rem;
  font-weight: 800;
  padding: .35rem .7rem;
  white-space: nowrap;
}

.audit-compare-total.has-discrepancy {
  background: #fee2e2;
  color: #991b1b;
}

.audit-compare-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem;
}

.audit-compare-row {
  min-width: 0;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #f8fafc;
  padding: .8rem;
}

.audit-compare-row-wide {
  grid-column: span 3;
}

.audit-compare-row.has-discrepancy {
  border-color: #fca5a5;
  background: #fff7f7;
  box-shadow: inset 4px 0 0 #dc2626;
}

.audit-compare-row span,
.audit-compare-row small,
.audit-compare-row strong,
.audit-compare-row em {
  display: block;
}

.audit-compare-row span {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.audit-compare-row strong {
  margin-top: .3rem;
  color: #111827;
  overflow-wrap: anywhere;
}

.audit-compare-row small {
  margin-top: .35rem;
  color: var(--muted);
}

.audit-compare-row em {
  width: max-content;
  max-width: 100%;
  margin-top: .55rem;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: .76rem;
  font-style: normal;
  font-weight: 800;
  padding: .22rem .55rem;
}

.audit-photo-grid,
.audit-evidence-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem;
}

.audit-photo-input,
.audit-evidence-photo {
  min-width: 0;
  background: #f8fafc;
  border: 1px dashed #93c5fd;
  border-radius: 8px;
  padding: .75rem;
  text-decoration: none;
}

.audit-photo-input input {
  width: 100%;
  margin-top: .55rem;
}

.audit-photo-input img,
.audit-evidence-photo img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  margin-top: .65rem;
  border: 1px solid var(--line);
  background: #fff;
}

.audit-evidence {
  margin-top: .9rem;
  border-top: 1px solid var(--line);
  padding-top: .85rem;
}

.audit-evidence-grid {
  margin-top: .55rem;
}

.audit-evidence-photo strong,
.audit-evidence-photo small {
  display: block;
  margin-top: .4rem;
  color: #1f2937;
  overflow-wrap: anywhere;
}

.audit-evidence-photo small {
  color: var(--muted);
  font-size: .78rem;
}

.valuation-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem;
  background: #f8fafc;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: .85rem;
}

.valuation-summary > div {
  min-width: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .85rem;
}

.valuation-summary span {
  display: block;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.valuation-summary strong {
  display: block;
  margin-top: .3rem;
  color: #111827;
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1.15;
}

.valuation-current {
  border-color: #60a5fa !important;
  background: #eff6ff !important;
}

.valuation-current strong {
  color: #075985;
  font-size: 1.7rem;
}

.validation-summary-valid {
  display: none;
}

.stepper {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem;
}

.stepper-item {
  display: flex;
  align-items: center;
  gap: .65rem;
  min-height: 3.25rem;
  padding: .75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .72);
  color: var(--muted);
}

.stepper-item span {
  width: 2rem;
  height: 2rem;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #edf2f7;
  color: var(--muted);
  font-weight: 800;
}

.stepper-item.active {
  border-color: rgba(37, 137, 200, .45);
  background: var(--surface);
  color: var(--primary-dark);
}

.stepper-item.active span {
  background: rgba(37, 137, 200, .14);
  color: var(--primary-dark);
}

.step-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.25rem;
  transition: border-color .18s ease, box-shadow .18s ease;
}

.step-panel:focus-within {
  border-color: rgba(37, 137, 200, .38);
  box-shadow: 0 16px 36px rgba(37, 137, 200, .09);
}

.step-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.step-panel h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 750;
}

.scan-control {
  min-height: 2.75rem;
}

.validation-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem;
}

.validation-card {
  min-height: 8.5rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.validation-card:hover {
  border-color: rgba(37, 137, 200, .32);
  box-shadow: 0 12px 24px rgba(32, 36, 44, .07);
  transform: translateY(-1px);
}

.validation-card.confirmed {
  border-color: rgba(37, 137, 200, .45);
  background: rgba(37, 137, 200, .06);
}

.validation-card span,
.validation-card strong,
.validation-card small {
  display: block;
}

.validation-card span {
  color: var(--muted);
}

.validation-card strong {
  margin: .35rem 0;
  font-size: 1.25rem;
}

.quick-actions {
  display: grid;
  gap: .75rem;
}

.action-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .85rem;
  background: #fbfdff;
  transition: border-color .18s ease, box-shadow .18s ease;
}

.action-panel[open] {
  border-color: rgba(37, 137, 200, .36);
  box-shadow: 0 12px 28px rgba(37, 137, 200, .09);
}

.action-panel summary {
  cursor: pointer;
  font-weight: 750;
  color: var(--primary-dark);
  list-style: none;
}

.action-panel summary::-webkit-details-marker {
  display: none;
}

.sku-confirm {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid rgba(37, 137, 200, .35);
  border-radius: 8px;
  background: rgba(37, 137, 200, .06);
}

.sku-confirm span,
.sku-confirm strong,
.sku-confirm small {
  display: block;
}

.sku-confirm span {
  color: var(--muted);
}

.sku-confirm strong {
  font-size: 1.3rem;
}

.confirmed-sku-row {
  display: block;
}

.confirmed-sku-summary {
  min-height: 5.5rem;
}

.compact-form {
  border: 0;
  padding: 0;
}

.radio-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .5rem;
}

.radio-option {
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .6rem .75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-weight: 700;
}

.radio-option:has(input:checked) {
  border-color: var(--primary);
  background: rgba(37, 137, 200, .08);
  color: var(--primary-dark);
}

.check-option {
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  width: 100%;
  padding: .6rem .75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-weight: 700;
}

.check-option:has(input:checked) {
  border-color: var(--primary);
  background: rgba(37, 137, 200, .08);
  color: var(--primary-dark);
}

.forced-flow-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 4vh, 3rem);
  background: rgba(32, 36, 44, .58);
  backdrop-filter: blur(8px);
  animation: overlay-in .18s ease both;
}

.forced-flow-modal {
  width: min(760px, calc(100vw - 2rem));
  max-height: min(760px, calc(100vh - 2rem));
  overflow: auto;
  padding: clamp(1rem, 2.4vw, 1.75rem);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 28px 80px rgba(32, 36, 44, .22);
  animation: modal-pop .22s cubic-bezier(.2, .8, .2, 1) both;
}

.forced-flow-modal h2 {
  margin: 0 0 .75rem;
  font-size: 1.45rem;
  font-weight: 800;
}

.forced-flow-modal p {
  color: var(--muted);
}

.forced-flow-modal .validation-card {
  min-height: auto;
}

.physical-validation-modal {
  width: min(560px, calc(100vw - 2rem));
}

.physical-validation-error {
  min-height: 1.5rem;
  margin-top: .5rem;
}

.movement-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
}

.movement-choice {
  min-height: 5.75rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: .25rem;
  padding: .9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  color: var(--text);
  text-decoration: none;
  transition: border-color .18s ease, background-color .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.movement-choice:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: rgba(37, 137, 200, .07);
  box-shadow: 0 12px 24px rgba(32, 36, 44, .07);
  transform: translateY(-1px);
}

.movement-choice.selected-choice {
  border-color: var(--primary);
  background: #edf8fd;
  box-shadow: inset 0 0 0 1px rgba(37, 137, 200, .22);
}

.movement-choice strong,
.movement-choice small {
  display: block;
}

.catalog-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1rem;
}

.catalog-tab {
  display: inline-flex;
  min-height: 2.25rem;
  align-items: center;
  padding: .45rem .85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.catalog-tab.active {
  border-color: var(--primary);
  background: rgba(37, 137, 200, .1);
  color: var(--primary-dark);
}

.catalog-table {
  min-width: 860px;
}

.catalog-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem;
  margin-bottom: 1rem;
}

.catalog-summary a {
  min-height: 5rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.catalog-summary strong,
.catalog-summary small,
.catalog-current strong,
.catalog-current small {
  display: block;
}

.catalog-summary a:hover {
  border-color: var(--primary);
}

.catalog-select {
  width: min(320px, 100%);
}

.catalog-current {
  padding: 1rem;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: #fbfdff;
}

.sku-table {
  min-width: 1120px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.25rem;
}

.form-grid.catalog-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.association-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid var(--line);
}

.association-header strong,
.association-header small {
  display: block;
}

.association-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem;
  padding: 1rem;
}

.association-option {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-height: 4rem;
  padding: .85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.association-option:hover {
  border-color: rgba(37, 137, 200, .32);
  box-shadow: 0 10px 22px rgba(32, 36, 44, .06);
  transform: translateY(-1px);
}

.association-option span,
.association-option strong,
.association-option small {
  display: block;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.full-row,
.form-actions {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  gap: .75rem;
  justify-content: flex-end;
}

.product-create {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
}

.product-validation:empty {
  display: none;
}

.product-create-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(520px, 2fr);
  gap: 1rem;
}

.product-image-panel {
  display: grid;
  align-content: start;
  gap: .75rem;
}

.product-image-drop {
  position: relative;
  display: grid;
  min-height: 365px;
  align-content: start;
  justify-items: center;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid #1f2937;
  border-radius: 8px;
  background: #eef2f3;
  cursor: pointer;
  overflow: hidden;
}

.product-image-title {
  justify-self: start;
  color: #111827;
  font-size: .78rem;
  font-weight: 800;
}

.product-image-empty {
  align-self: center;
  color: rgba(17, 24, 39, .42);
  font-size: 1.05rem;
  font-weight: 800;
}

.product-image-drop img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 1rem;
  background: #f8fafc;
}

.product-create-main {
  min-width: 0;
}

.product-fields-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .85rem 1rem;
}

.product-preview-panel,
.product-description-field {
  grid-column: 1 / -1;
}

.field-label-row {
  display: flex;
  align-items: baseline;
  gap: .55rem;
}

.field-label-row .form-label {
  margin-bottom: .5rem;
}

.field-label-action {
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  font-size: .78rem;
  font-weight: 700;
  line-height: 1;
  color: var(--primary);
  text-decoration: none;
  cursor: pointer;
}

.field-label-action:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.product-catalog-warning {
  grid-column: 1 / -1;
  margin: 0;
}

.product-preview-panel {
  display: grid;
  align-content: center;
  min-height: 104px;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  text-align: center;
}

.product-preview-panel strong,
.product-preview-panel span {
  display: block;
}

.product-preview-panel strong {
  color: #15215b;
}

.product-preview-panel span {
  margin-top: .4rem;
  color: var(--muted);
  font-size: .92rem;
}

.product-create-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.product-create-actions .btn {
  min-width: 7rem;
}

.action-cell {
  align-items: center;
  justify-content: flex-end;
  gap: .4rem;
  white-space: nowrap;
}

.action-cell:not(td) {
  display: flex;
}

td.action-cell {
  display: table-cell;
  text-align: right;
  vertical-align: middle;
}

.action-cell .btn {
  flex: 0 0 auto;
}

td.action-cell .btn + .btn,
td.action-cell form + .btn,
td.action-cell .btn + form {
  margin-left: .4rem;
}

.action-cell form {
  display: inline-flex;
}

.registro-col,
.registro-cell {
  min-width: 7.5rem;
  white-space: nowrap;
}

.actions-col,
.action-cell {
  min-width: 9.5rem;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes overlay-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes modal-pop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01s !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01s !important;
  }
}

@media (max-width: 900px) {
  .page-heading,
  .search-form,
  .filter-bar,
  .sku-confirm,
  .user-menu {
    align-items: stretch;
    flex-direction: column;
  }

  .metric-row,
  .metric-row.product-metrics,
  .detail-grid,
  .device-detail-summary,
  .device-detail-grid,
  .detail-pairs,
  .timeline-grid,
  .stepper,
  .validation-grid,
  .movement-choice-grid,
  .module-grid,
  .catalog-summary,
  .audit-current-grid,
  .audit-condition-grid,
  .audit-condition-notes dl,
  .audit-compare-grid,
  .audit-photo-grid,
  .audit-evidence-grid,
  .valuation-summary,
  .form-grid,
  .product-create-grid,
  .product-fields-grid,
  .field-grid,
  .association-grid {
    grid-template-columns: 1fr;
  }

  .audit-compare-row-wide {
    grid-column: auto;
  }

  .product-image-drop {
    min-height: 260px;
  }

  .product-create-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .association-header {
    align-items: stretch;
    flex-direction: column;
  }
}
