/*
 * Small custom layer on top of Tailwind. Anything that's awkward to do
 * with utility classes lives here.
 */

/* Make tables that scroll horizontally feel less abrupt at the right edge */
.table-fade-right {
  -webkit-mask-image: linear-gradient(to right, black 95%, transparent);
          mask-image: linear-gradient(to right, black 95%, transparent);
}

/* HTMX request indicator: dim the body while a swap is in flight */
.htmx-request .htmx-indicator { opacity: 1; }
.htmx-indicator { opacity: 0; transition: opacity 200ms ease-in; }

/* Sticky first column for the pivot table */
.pivot-table th.sticky-col,
.pivot-table td.sticky-col {
  position: sticky;
  left: 0;
  background-color: var(--bg, white);
  z-index: 1;
}
.dark .pivot-table th.sticky-col,
.dark .pivot-table td.sticky-col {
  background-color: rgb(15 23 42); /* slate-900 */
}

/* Tabular nums make price columns line up like an account ledger */
.tnum { font-variant-numeric: tabular-nums; }

/* Modal backdrop for drill-down */
.modal-backdrop {
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
}

/* ----------------------------------------------------------------------
 * Anti-copy + forensic watermark, used on pages that expose raw prices
 * to non-admin users. The whole tree inside <body class="locked"> becomes
 * non-selectable, and a full-page SVG watermark is laid over it via a
 * ::before pseudo so printouts and screen-shots still carry the viewer's
 * email + login fingerprint + request nonce. It's not DRM — determined
 * leakers will screenshot — but every leak is traceable to a user/session.
 * ---------------------------------------------------------------------- */

body.locked,
body.locked * {
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
}
body.locked input,
body.locked select,
body.locked textarea {
  -webkit-user-select: text !important;
  user-select: text !important;
}

body.locked::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
  background-image: var(--wm-image, none);
  background-repeat: repeat;
  opacity: 0.14;
  mix-blend-mode: multiply;
}
.dark body.locked::before { mix-blend-mode: screen; opacity: 0.18; }

@media print {
  body.locked::before { opacity: 0.35 !important; }
}
