/* Site-wide polish layer: visual-only overrides, no behavior changes. */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  line-height: 1.55;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, .55) transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, .42);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: padding-box;
}

::selection {
  background: rgba(20, 184, 166, .35);
  color: #fff;
}

img, svg, video, canvas {
  max-width: 100%;
}

img {
  height: auto;
}

:where(.container, .nv-container) {
  width: min(100% - 24px, 1200px);
  margin-inline: auto;
}

:where(.card, .tile, .item, .list, .table-wrap, .notice, .late-modal,
  .nv-card, .nv-product, .product-card, .count-box, .flap) {
  border-radius: 8px !important;
}

:where(.card, .tile, .item, .nv-card, .nv-product, .product-card) {
  border-color: rgba(148, 163, 184, .18) !important;
}

:where(.card, .tile, .nv-card, .nv-product, .product-card):hover {
  border-color: rgba(20, 184, 166, .32) !important;
}

:where(button, .button, .btn, input, select, textarea) {
  font: inherit;
}

:where(button, .button, .btn) {
  min-height: 44px;
  border-radius: 8px !important;
  transition:
    transform .16s ease,
    box-shadow .16s ease,
    border-color .16s ease,
    background-color .16s ease,
    filter .16s ease;
  -webkit-tap-highlight-color: transparent;
}

:where(button, .button, .btn):hover {
  transform: translateY(-1px);
}

:where(button, .button, .btn):active {
  transform: translateY(0) scale(.99);
}

:where(button, .button, .btn):disabled,
:where(button, .button, .btn)[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: .58;
  transform: none;
  filter: grayscale(.15);
}

:where(a, button, .button, .btn, input, select, textarea):focus-visible {
  outline: 3px solid #facc15;
  outline-offset: 3px;
}

:where(input, select, textarea) {
  border-radius: 8px !important;
  min-height: 44px;
}

:where(input, select, textarea):focus {
  border-color: rgba(20, 184, 166, .65) !important;
  box-shadow: 0 0 0 4px rgba(20, 184, 166, .12);
}

:where(.row, .controls, .mini-controls, .nv-row) {
  align-items: center;
  gap: 12px;
}

:where(.table, table) {
  width: 100%;
  font-variant-numeric: tabular-nums;
}

:where(th, td) {
  vertical-align: middle;
}

:where(th) {
  position: sticky;
  top: 0;
  z-index: 1;
}

:where(.badge, .chip, .status, .tag) {
  border-radius: 999px !important;
  white-space: nowrap;
}

body:not(:has(.nv-appbar)) {
  background:
    linear-gradient(135deg, rgba(20, 184, 166, .12), transparent 36%),
    linear-gradient(180deg, #111315 0%, #151a1f 45%, #101214 100%) !important;
  color: #f4f7fb;
}

body:not(:has(.nv-appbar)) .card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .035)) !important;
  box-shadow: 0 18px 45px rgba(0, 0, 0, .28) !important;
}

body:not(:has(.nv-appbar)) .button,
body:not(:has(.nv-appbar)) .btn {
  border-color: rgba(226, 232, 240, .13) !important;
  background: rgba(255, 255, 255, .065) !important;
  color: #f4f7fb !important;
}

body:not(:has(.nv-appbar)) .button.primary,
body:not(:has(.nv-appbar)) .btn.primary {
  border-color: transparent !important;
  background: linear-gradient(180deg, #14b8a6, #0f8f83) !important;
  color: #041311 !important;
}

body:not(:has(.nv-appbar)) .button.good,
body:not(:has(.nv-appbar)) .btn.good {
  border-color: transparent !important;
  background: linear-gradient(180deg, #16a34a, #0f7f3a) !important;
  color: #fff !important;
}

body:not(:has(.nv-appbar)) .button.warn,
body:not(:has(.nv-appbar)) .btn.warn {
  border-color: transparent !important;
  background: linear-gradient(180deg, #f59e0b, #d97706) !important;
  color: #1f1300 !important;
}

body:not(:has(.nv-appbar)) .button.bad,
body:not(:has(.nv-appbar)) .btn.bad {
  border-color: transparent !important;
  background: linear-gradient(180deg, #ef4444, #dc2626) !important;
  color: #fff !important;
}

.rowline {
  border-radius: 8px;
  margin-bottom: 10px;
  background: rgba(255, 255, 255, .045);
  border: 1px solid rgba(148, 163, 184, .16);
}

.rowline.late {
  background: rgba(239, 68, 68, .12) !important;
  border-color: rgba(248, 113, 113, .42) !important;
  color: inherit !important;
}

.screen-actions {
  width: min(100% - 24px, 1200px);
  margin: 0 auto 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.screen-actions > div {
  margin-bottom: 0 !important;
}

.screen-actions .btn {
  min-width: 220px;
}

.late-modal-backdrop {
  padding: 16px;
  backdrop-filter: blur(7px);
}

.late-modal {
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.nv-thumb,
.product-thumb {
  aspect-ratio: 4 / 3;
  height: auto !important;
  object-fit: contain;
}

.ticker-track,
.ticker {
  border-radius: 8px !important;
}

@media (max-width: 760px) {
  :where(body) {
    overflow-x: hidden;
  }

  :where(.container, .nv-container) {
    width: min(100% - 16px, 1200px);
    padding-inline: 8px !important;
  }

  :where(.topbar) {
    gap: 12px;
  }

  :where(.brand) {
    min-width: 0;
  }

  :where(.brand-text h1, h1) {
    overflow-wrap: anywhere;
  }

  :where(.rowline) {
    flex-direction: column;
    align-items: stretch !important;
  }

  .screen-actions {
    width: min(100% - 16px, 1200px);
  }

  :where(.rowline .btn, .rowline button) {
    width: 100%;
  }

  :where(.controls, .mini-controls, .row) > :where(.button, .btn, button, input, select) {
    flex: 1 1 100%;
  }

  :where(.card, .nv-card) {
    padding: 14px !important;
  }

  :where(.table) {
    min-width: 680px;
  }

  :where(.card:has(.table), .table-wrap, .nv-table) {
    overflow-x: auto;
  }
}

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