/* STOCK MANAGEMENT SYSTEM — shell layout (tokens in foxpro-ui.css :root) */

.toykar-body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--tk-font, 'Plus Jakarta Sans', system-ui, sans-serif);
  background: var(--tk-bg-page, var(--tk-bg));
  background-color: var(--tk-bg);
  color: var(--tk-text);
  display: flex;
  flex-direction: column;
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Centered content column on very wide screens */
.toykar-shell {
  width: 100%;
  max-width: var(--tk-content-max, 1480px);
  margin-left: auto;
  margin-right: auto;
  padding-left: 28px;
  padding-right: 28px;
  box-sizing: border-box;
}

/* ═══════════════════════════════════════════
   TOP BAR
   ═══════════════════════════════════════════ */
.toykar-topbar {
  padding: 0;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 42%, #172554 100%);
  color: #fff;
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.35);
  border-bottom: 1px solid rgba(99, 102, 241, 0.35);
  position: relative;
  z-index: 300;
}
.toykar-topbar::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.9) 20%, rgba(129, 140, 248, 0.85) 50%, rgba(99, 102, 241, 0.9) 80%, transparent);
  pointer-events: none;
  opacity: 0.9;
}
.toykar-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}
.toykar-topbar-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  text-align: right;
}
.toykar-system-title {
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}
.toykar-system-title:hover {
  color: #c7d2fe;
  text-decoration: none;
}
.toykar-hello {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 500;
}
.toykar-date {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.58);
  font-weight: 400;
  letter-spacing: 0.02em;
}

/* ═══════════════════════════════════════════
   NAVIGATION MENU
   ═══════════════════════════════════════════ */
.toykar-menu {
  padding: 0;
  /* Solid second tone under header (not translucent — avoids see-through submenus) */
  background: var(--tk-menu-strip-bg, #dfe7f2);
  border-bottom: 1px solid var(--tk-border-strong, #cbd5e1);
  display: block;
  font-size: 13px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.07);
  position: relative;
  z-index: 250;
}
.toykar-menu-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding-top: 8px;
  padding-bottom: 8px;
  width: 100%;
}
.toykar-menu-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  row-gap: 6px;
  column-gap: 6px;
  flex: 1;
  min-width: 0;
}
.toykar-mobile-nav-wrap {
  display: contents;
}
.toykar-menu-close {
  display: none;
}
.toykar-menu a {
  color: var(--tk-text-secondary);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: var(--tk-radius-sm, 8px);
  font-weight: 600;
  font-size: 13px;
  transition: color var(--tk-transition), background var(--tk-transition), box-shadow var(--tk-transition);
  position: relative;
}
.toykar-menu a:hover {
  background: var(--tk-primary-lighter);
  color: var(--tk-primary-hover);
  box-shadow: var(--tk-shadow-sm);
}
.toykar-menu a::after {
  display: none;
}
.menu-dot {
  color: var(--tk-border-strong);
  opacity: 0.45;
  padding: 0 1px;
  font-size: 5px;
  user-select: none;
  display: inline-flex;
  align-items: center;
  margin: 0 2px;
}

/* ── Dropdown sub-menu ──
   Hit area extends below the link (padding-bottom) so at any browser scale
   there is no gap between trigger and submenu — hover stays active. */
.menu-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding-bottom: 10px;
  margin-bottom: -10px;
}
/* Open dropdown stacks above sibling nav items */
.toykar-menu-inner .menu-dropdown:hover,
.toykar-menu-inner .menu-dropdown.menu-open {
  z-index: 400;
}
.menu-dropdown > a {
  display: inline-flex;
  align-items: center;
}
.menu-dropdown > a::after {
  content: '▾';
  font-size: 9px;
  margin-left: 4px;
  opacity: 0.5;
}
.menu-dropdown .menu-submenu {
  display: none;
  position: absolute;
  left: 0;
  top: 100%;
  min-width: 280px;
  max-width: min(520px, calc(100vw - 24px));
  /* Fully opaque panel (all themes) — never rely on translucent --tk-surface here */
  background-color: var(--tk-submenu-bg-solid, #ffffff) !important;
  background-image: none;
  border: 1px solid var(--tk-border-strong, #cbd5e1);
  border-radius: var(--tk-radius-lg, 14px);
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(15, 23, 42, 0.06);
  padding: 8px 0;
  z-index: 5000;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  /* Overlap the dropdown’s padding so trigger and submenu share one continuous hit area */
  margin-top: -10px;
  padding-top: 14px;
  animation: menuFadeIn 0.15s ease;
}
.menu-dropdown.menu-align-right .menu-submenu {
  left: auto;
  right: 0;
}
@keyframes menuFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.menu-dropdown:hover .menu-submenu {
  display: block;
}
/* Keep submenu open briefly during desktop hover transitions. */
.menu-dropdown.menu-open .menu-submenu {
  display: block;
}
@media (min-width: 993px) {
  .menu-dropdown.reports-dropdown .menu-submenu,
  .menu-dropdown.maintenance-dropdown .menu-submenu {
    min-width: 520px;
    grid-template-columns: 1fr 1fr;
    column-gap: 0;
    row-gap: 0;
  }
  .menu-dropdown.reports-dropdown:hover .menu-submenu,
  .menu-dropdown.reports-dropdown.menu-open .menu-submenu,
  .menu-dropdown.maintenance-dropdown:hover .menu-submenu,
  .menu-dropdown.maintenance-dropdown.menu-open .menu-submenu {
    display: grid;
  }
  .menu-dropdown.reports-dropdown .menu-submenu a,
  .menu-dropdown.maintenance-dropdown .menu-submenu a {
    white-space: normal;
    line-height: 1.35;
  }
  /* Dividers span the full row in a 2-column grid. */
  .menu-dropdown.maintenance-dropdown .menu-submenu-divider {
    grid-column: 1 / -1;
  }
}
.menu-dropdown .menu-submenu a {
  display: block;
  padding: 9px 20px;
  color: var(--tk-text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 400;
  white-space: nowrap;
  transition: background var(--tk-transition), color var(--tk-transition);
  border-radius: 0;
}
.menu-dropdown .menu-submenu a::after {
  display: none;
}
.menu-dropdown .menu-submenu a:hover {
  background: var(--tk-primary-lighter);
  color: var(--tk-primary);
}
.menu-dropdown .menu-submenu-divider {
  display: block;
  height: 0;
  border-top: 1px solid var(--tk-border);
  margin: 6px 16px;
  padding: 0;
}

/* ═══════════════════════════════════════════
   CONTENT AREA
   ═══════════════════════════════════════════ */
.toykar-content {
  flex: 1;
  padding: 28px 24px 32px;
  overflow: auto;
  background: transparent;
  position: relative;
  z-index: 1;
  min-width: 0;
}
.toykar-content .fox-window {
  max-width: min(1100px, 100%);
  width: 100%;
  margin: 0 auto;
}
.toykar-content.tk-page-wide .fox-window {
  max-width: min(var(--tk-content-max, 1480px), 100%);
}

/* Sticky grid headers use z-index; keep bottom action bars above stray compositing when main scrolls */
.fox-window .window-body > .form-actions,
.fox-body > .form-actions {
  position: relative;
  z-index: 4;
  background: var(--tk-surface);
}

/* ═══════════════════════════════════════════
   HOME / WELCOME
   ═══════════════════════════════════════════ */
.toykar-welcome {
  max-width: 700px;
  margin: 0 auto;
  text-align: center;
  padding: 60px 24px;
}
.toykar-logo {
  font-size: 78px;
  font-weight: 700;
  color: var(--tk-primary);
  letter-spacing: 5px;
  margin-bottom: 18px;
  text-shadow: 0 2px 4px rgba(67,56,202,0.15);
  line-height: 1.05;
}
.toykar-office {
  display: inline-block;
  font-size: 13px;
  color: var(--tk-text-secondary);
  border: 1px solid var(--tk-border);
  border-radius: var(--tk-radius);
  padding: 8px 18px;
  margin: 0 auto;
  background: var(--tk-surface);
  font-weight: 500;
  box-shadow: var(--tk-shadow-sm);
}
.toykar-tagline {
  font-size: 14px;
  color: var(--tk-muted);
  letter-spacing: 2px;
  margin: 18px 0 28px;
  text-transform: uppercase;
  font-weight: 500;
}
.toykar-today {
  font-size: 17px;
  color: var(--tk-primary);
  margin-top: 28px;
  font-weight: 600;
}

/* ═══════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════ */
.toykar-footer {
  padding: 14px 28px 18px;
  text-align: center;
  font-size: 11px;
  color: var(--tk-muted);
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--tk-border);
  font-weight: 500;
  letter-spacing: 0.02em;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

/* Main app: one compact row — copyright left, theme + optional RC anchor right */
.toykar-footer--split {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 6px 20px;
  padding: 10px 28px 12px;
  text-align: left;
}
.toykar-footer__copyright {
  margin: 0;
  flex: 1 1 auto;
  min-width: min(100%, 12rem);
  text-align: left;
}
.toykar-footer__sep {
  margin: 0 0.35em;
  color: var(--tk-muted);
  opacity: 0.65;
}
.toykar-footer__link-muted {
  color: var(--tk-muted);
  font-weight: 500;
  text-decoration: none;
  font-size: 11px;
}
.toykar-footer__link-muted:hover {
  color: var(--tk-text-secondary);
  text-decoration: underline;
}
.toykar-footer__subtle {
  font-size: 11px;
  margin: 8px 0 0;
  text-align: center;
  color: var(--tk-muted);
}
.toykar-footer--split .toykar-footer__theme-slot {
  position: relative;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}
.toykar-footer--split .tk-theme-bar {
  margin-top: 0;
  justify-content: flex-end;
}

/* Footer: slightly smaller than global .tk-theme-* (themes.css) */
.toykar-footer .tk-theme-label {
  font-size: 10px;
}
.toykar-footer a.tk-theme-pill {
  font-size: 10px;
  padding: 4px 11px;
}

/* Wrapper: inner holds hit+footer (column-reverse: footer above, hit at bottom of inner).
   On fine-pointer+hover, collapsed dock is a very short bar — overflow clips so only the bottom edge shows (not translate, which was leaving a “peek”). */
.toykar-footer-dock {
  width: 100%;
  box-sizing: border-box;
}
.toykar-footer-dock__inner {
  width: 100%;
  box-sizing: border-box;
}
.toykar-footer-dock__hit {
  display: none;
}

@media (hover: hover) and (pointer: fine) {
  .toykar-footer-dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 240;
    /* Short bar at the bottom: inner is bottom-anchored; overflow keeps the footer fully outside this band. */
    height: calc(8px + env(safe-area-inset-bottom, 0px));
    min-height: calc(8px + env(safe-area-inset-bottom, 0px));
    max-height: calc(8px + env(safe-area-inset-bottom, 0px));
    overflow: hidden;
    padding: 0;
    box-sizing: border-box;
    pointer-events: none;
    transition: max-height 0.32s ease, min-height 0.32s ease;
  }

  .toykar-footer-dock__inner {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column-reverse;
    align-items: stretch;
    width: 100%;
    box-sizing: border-box;
    pointer-events: auto;
  }

  .toykar-footer-dock__hit {
    display: block;
    flex: 0 0 auto;
    min-height: 32px;
    height: 32px;
    padding-bottom: max(0px, calc(env(safe-area-inset-bottom, 0px) - 8px));
    box-sizing: border-box;
    pointer-events: auto;
    cursor: default;
    position: relative;
    background: linear-gradient(
      180deg,
      transparent 0%,
      color-mix(in srgb, var(--tk-surface, #fff) 50%, transparent) 100%
    );
    box-shadow: inset 0 1px 0 color-mix(in srgb, var(--tk-border, #e2e8f0) 50%, transparent);
  }

  /* Up-chevron: sits in the bottom peek sliver so the dock reads as “more above”. */
  .toykar-footer-dock__hit::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: max(2px, calc(env(safe-area-inset-bottom, 0px) * 0.35));
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border: 0 solid transparent;
    border-left-width: 5px;
    border-right-width: 5px;
    border-bottom-width: 5px;
    border-bottom-color: color-mix(
      in srgb,
      var(--tk-primary, #0f172a) 50%,
      var(--tk-muted, #64748b)
    );
    opacity: 0.88;
    filter: drop-shadow(0 0 1px color-mix(in srgb, var(--tk-surface, #fff) 70%, var(--tk-primary, #0f172a)));
    pointer-events: none;
    z-index: 1;
  }

  .toykar-footer-dock .toykar-footer {
    margin-top: 0;
    flex-shrink: 0;
  }

  .toykar-footer-dock:hover,
  .toykar-footer-dock:focus-within {
    height: auto;
    min-height: 0;
    max-height: min(92vh, calc(100vh - 2rem - env(safe-area-inset-top, 0px)));
    max-height: min(92dvh, calc(100dvh - 2rem - env(safe-area-inset-top, 0px)));
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .toykar-footer-dock:hover .toykar-footer-dock__inner,
  .toykar-footer-dock:focus-within .toykar-footer-dock__inner {
    position: static;
    max-height: none;
    min-height: 0;
  }

  .toykar-footer-dock:hover .toykar-footer-dock__hit::after,
  .toykar-footer-dock:focus-within .toykar-footer-dock__hit::after {
    animation: none;
    opacity: 0.42;
  }
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  @keyframes toykar-footer-dock-peek {
    0%,
    100% {
      transform: translateX(-50%) translateY(0);
    }
    50% {
      transform: translateX(-50%) translateY(-1.5px);
    }
  }

  .toykar-footer-dock__hit::after {
    animation: toykar-footer-dock-peek 2.4s ease-in-out infinite;
  }
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: reduce) {
  .toykar-footer-dock {
    transition-duration: 0.01ms;
  }
}

/* Touch / no hover: normal in-flow footer; no bottom hit strip. */
@media not all and (hover: hover) and (pointer: fine) {
  .toykar-footer-dock {
    position: static;
    max-height: none !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }
  .toykar-footer-dock__inner {
    position: static !important;
  }
  .toykar-footer-dock__hit {
    display: none !important;
  }
}

/* RC anchors to footer left (not the theme column on the right). */
.toykar-footer--home-rc {
  position: relative;
  z-index: 1;
}

/* Home: footer RC corner — transparent PNG required; drop-shadow follows alpha outline. */
.toykar-footer__theme-slot {
  position: relative;
  display: flex;
  justify-content: center;
}
.toykar-home-rc-corner {
  position: absolute;
  left: 0;
  bottom: 100%;
  margin-bottom: 6px;
  pointer-events: none;
  z-index: 2;
  line-height: 0;
}
.toykar-home-rc-corner__img:not(.toykar-home-rc-corner__img--2d) {
  display: block;
  width: min(303px, 58vw);
  height: auto;
  max-width: 100%;
  object-fit: contain;
  vertical-align: bottom;
  border: none;
  outline: none;
  box-shadow: none;
  transform: scaleX(-1);
  transform-origin: center center;
  animation: toykar-home-rc-edge-run 2.4s linear infinite;
  /* Tight rim + small halo only — large blurs read as a solid rectangle. */
  filter: drop-shadow(5px 0 2px rgba(255, 45, 100, 0.92))
    drop-shadow(5px 0 5px rgba(255, 45, 100, 0.22))
    drop-shadow(0 1px 2px color-mix(in srgb, var(--tk-text, #0f172a) 18%, transparent));
}
.toykar-home-rc-corner__img--2d {
  display: block;
  width: min(200px, 44vw);
  height: auto;
  max-width: 100%;
  object-fit: contain;
  vertical-align: bottom;
  border: none;
  outline: none;
  box-shadow: none;
}
/* Directional RGB runner: offset moves around; keep secondary blur ≤5px to avoid “blue box”. */
@keyframes toykar-home-rc-edge-run {
  0% {
    filter: drop-shadow(5px 0 2px rgba(255, 45, 100, 0.92)) drop-shadow(5px 0 5px rgba(255, 45, 100, 0.22))
      drop-shadow(0 1px 2px color-mix(in srgb, var(--tk-text, #0f172a) 18%, transparent));
  }
  12.5% {
    filter: drop-shadow(4px 4px 2px rgba(255, 140, 0, 0.92)) drop-shadow(4px 4px 5px rgba(255, 140, 0, 0.22))
      drop-shadow(0 1px 2px color-mix(in srgb, var(--tk-text, #0f172a) 18%, transparent));
  }
  25% {
    filter: drop-shadow(0 5px 2px rgba(250, 230, 0, 0.92)) drop-shadow(0 5px 5px rgba(250, 230, 0, 0.22))
      drop-shadow(0 1px 2px color-mix(in srgb, var(--tk-text, #0f172a) 18%, transparent));
  }
  37.5% {
    filter: drop-shadow(-4px 4px 2px rgba(0, 245, 160, 0.92)) drop-shadow(-4px 4px 5px rgba(0, 245, 160, 0.22))
      drop-shadow(0 1px 2px color-mix(in srgb, var(--tk-text, #0f172a) 18%, transparent));
  }
  50% {
    filter: drop-shadow(-5px 0 2px rgba(0, 210, 255, 0.92)) drop-shadow(-5px 0 5px rgba(0, 210, 255, 0.22))
      drop-shadow(0 1px 2px color-mix(in srgb, var(--tk-text, #0f172a) 18%, transparent));
  }
  62.5% {
    filter: drop-shadow(-4px -4px 2px rgba(80, 140, 255, 0.92)) drop-shadow(-4px -4px 5px rgba(80, 140, 255, 0.22))
      drop-shadow(0 1px 2px color-mix(in srgb, var(--tk-text, #0f172a) 18%, transparent));
  }
  75% {
    filter: drop-shadow(0 -5px 2px rgba(180, 90, 255, 0.92)) drop-shadow(0 -5px 5px rgba(180, 90, 255, 0.22))
      drop-shadow(0 1px 2px color-mix(in srgb, var(--tk-text, #0f172a) 18%, transparent));
  }
  87.5% {
    filter: drop-shadow(4px -4px 2px rgba(255, 60, 200, 0.92)) drop-shadow(4px -4px 5px rgba(255, 60, 200, 0.22))
      drop-shadow(0 1px 2px color-mix(in srgb, var(--tk-text, #0f172a) 18%, transparent));
  }
  100% {
    filter: drop-shadow(5px 0 2px rgba(255, 45, 100, 0.92)) drop-shadow(5px 0 5px rgba(255, 45, 100, 0.22))
      drop-shadow(0 1px 2px color-mix(in srgb, var(--tk-text, #0f172a) 18%, transparent));
  }
}
@media (max-width: 480px) {
  .toykar-home-rc-corner__img:not(.toykar-home-rc-corner__img--2d),
  .toykar-home-rc-corner__img--2d {
    width: min(216px, 58vw);
  }
  .toykar-home-rc-corner--2d .toykar-home-rc-corner__img--2d {
    width: min(160px, 46vw);
  }
}
@media (prefers-reduced-motion: reduce) {
  /* Slower RGB cycle (themes.css * { animation-duration: 0.01ms } is overridden by class specificity). */
  .toykar-home-rc-corner__img:not(.toykar-home-rc-corner__img--2d) {
    animation: toykar-home-rc-edge-run 4.8s linear infinite;
    filter: drop-shadow(0 0 5px rgba(0, 200, 255, 0.3))
      drop-shadow(0 1px 2px color-mix(in srgb, var(--tk-text, #0f172a) 18%, transparent));
  }
  html[data-theme="midnight"] .toykar-home-rc-corner__img:not(.toykar-home-rc-corner__img--2d) {
    animation: toykar-home-rc-edge-run-midnight 4.8s linear infinite;
    filter: drop-shadow(0 0 5px rgba(0, 200, 255, 0.3)) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
  }
}
html[data-theme="midnight"] .toykar-home-rc-corner__img:not(.toykar-home-rc-corner__img--2d) {
  animation: toykar-home-rc-edge-run-midnight 2.4s linear infinite;
}
@keyframes toykar-home-rc-edge-run-midnight {
  0% {
    filter: drop-shadow(5px 0 2px rgba(255, 45, 100, 0.92)) drop-shadow(5px 0 5px rgba(255, 45, 100, 0.22))
      drop-shadow(0 1px 2px rgba(0, 0, 0, 0.48));
  }
  12.5% {
    filter: drop-shadow(4px 4px 2px rgba(255, 140, 0, 0.92)) drop-shadow(4px 4px 5px rgba(255, 140, 0, 0.22))
      drop-shadow(0 1px 2px rgba(0, 0, 0, 0.48));
  }
  25% {
    filter: drop-shadow(0 5px 2px rgba(250, 230, 0, 0.92)) drop-shadow(0 5px 5px rgba(250, 230, 0, 0.22))
      drop-shadow(0 1px 2px rgba(0, 0, 0, 0.48));
  }
  37.5% {
    filter: drop-shadow(-4px 4px 2px rgba(0, 245, 160, 0.92)) drop-shadow(-4px 4px 5px rgba(0, 245, 160, 0.22))
      drop-shadow(0 1px 2px rgba(0, 0, 0, 0.48));
  }
  50% {
    filter: drop-shadow(-5px 0 2px rgba(0, 210, 255, 0.92)) drop-shadow(-5px 0 5px rgba(0, 210, 255, 0.22))
      drop-shadow(0 1px 2px rgba(0, 0, 0, 0.48));
  }
  62.5% {
    filter: drop-shadow(-4px -4px 2px rgba(80, 140, 255, 0.92)) drop-shadow(-4px -4px 5px rgba(80, 140, 255, 0.22))
      drop-shadow(0 1px 2px rgba(0, 0, 0, 0.48));
  }
  75% {
    filter: drop-shadow(0 -5px 2px rgba(180, 90, 255, 0.92)) drop-shadow(0 -5px 5px rgba(180, 90, 255, 0.22))
      drop-shadow(0 1px 2px rgba(0, 0, 0, 0.48));
  }
  87.5% {
    filter: drop-shadow(4px -4px 2px rgba(255, 60, 200, 0.92)) drop-shadow(4px -4px 5px rgba(255, 60, 200, 0.22))
      drop-shadow(0 1px 2px rgba(0, 0, 0, 0.48));
  }
  100% {
    filter: drop-shadow(5px 0 2px rgba(255, 45, 100, 0.92)) drop-shadow(5px 0 5px rgba(255, 45, 100, 0.22))
      drop-shadow(0 1px 2px rgba(0, 0, 0, 0.48));
  }
}

/* Home footer — 2D vector (SVG): sticker carries white rim + neon in-file; plate stays minimal. */
.toykar-home-rc-corner--2d .toykar-home-rc-corner__plate {
  padding: 4px 6px;
  border-radius: var(--tk-radius, 12px);
  background: transparent;
  border: none;
  box-shadow: none;
  line-height: 0;
}
.toykar-home-rc-corner--2d .toykar-home-rc-corner__img--2d {
  transform: none;
  animation: toykar-home-rc-2d-float 5s ease-in-out infinite;
  /* Glow is defined inside the SVG (alpha-based filter); avoid extra CSS blur. */
  filter: none;
}
@keyframes toykar-home-rc-2d-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}
html[data-theme="midnight"] .toykar-home-rc-corner--2d .toykar-home-rc-corner__plate {
  background: transparent;
  border: none;
  box-shadow: none;
}
html[data-theme="midnight"] .toykar-home-rc-corner--2d .toykar-home-rc-corner__img--2d {
  filter: none;
}
@media (prefers-reduced-motion: reduce) {
  .toykar-home-rc-corner--2d .toykar-home-rc-corner__img--2d {
    animation: none;
  }
}

/* ═══════════════════════════════════════════
   Listing filter panels — theme tokens (do not hardcode #f5f5f5 in pages; breaks Midnight)
   ═══════════════════════════════════════════ */
.invoice-list-filters,
.cs-list-filters {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--tk-border);
  border-radius: var(--tk-radius-sm);
  background: var(--tk-surface-alt);
  box-sizing: border-box;
}
.invoice-list-filters .filter-row,
.cs-list-filters .filter-row {
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* Invoices: single horizontal filter line on wide viewports */
.invoice-list-filters--invoice-one-line .filter-row-invoice-one-line {
  margin-bottom: 0;
  align-items: center;
  flex-wrap: nowrap;
  gap: 10px 16px;
}
.invoice-list-filters--invoice-one-line .filter-cluster {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
}
.invoice-list-filters--invoice-one-line .filter-cluster-customer {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
}
.invoice-list-filters--invoice-one-line .filter-cluster-customer .customer-search-wrap {
  flex: 1 1 160px;
  min-width: 0;
  max-width: 420px;
}
.invoice-list-filters--invoice-one-line .filter-cluster-customer .filter-input {
  width: 100%;
  max-width: 420px;
}
.invoice-list-filters--invoice-one-line .filter-label-tight {
  margin-left: 4px;
}
.invoice-list-filters--invoice-one-line .filter-cluster-status select {
  min-width: 8em;
}
@media (max-width: 1024px) {
  .invoice-list-filters--invoice-one-line .filter-row-invoice-one-line {
    flex-wrap: wrap;
    align-items: flex-end;
  }
  .invoice-list-filters--invoice-one-line .filter-cluster-customer {
    flex: 1 1 100%;
  }
  .invoice-list-filters--invoice-one-line .filter-cluster-customer .customer-search-wrap {
    max-width: none;
  }
}
.invoice-list-filters label,
.cs-list-filters label {
  min-width: 90px;
  font-weight: 700;
  font-size: 11px;
  color: var(--tk-text);
  letter-spacing: 0.02em;
}
.cs-list-filters label {
  min-width: 50px;
}
.invoice-list-filters .filter-input,
.cs-list-filters .filter-input {
  width: 260px;
  max-width: 100%;
  padding: 6px 8px;
  border-radius: var(--tk-radius-sm);
  border: 1px solid var(--tk-border-strong);
  background: var(--tk-surface);
  color: var(--tk-text);
  font-size: 13px;
}
.invoice-list-filters .filter-date,
.cs-list-filters .filter-date {
  width: 100px;
  padding: 6px 8px;
  border-radius: var(--tk-radius-sm);
  border: 1px solid var(--tk-border-strong);
  background: var(--tk-surface);
  color: var(--tk-text);
  font-size: 13px;
}
.invoice-list-filters select,
.cs-list-filters select {
  padding: 6px 8px;
  border-radius: var(--tk-radius-sm);
  border: 1px solid var(--tk-border-strong);
  background: var(--tk-surface);
  color: var(--tk-text);
  font-size: 13px;
}
.invoice-list-autocomplete {
  position: absolute;
  left: 0;
  top: 100%;
  min-width: 280px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 9000 !important;
  background: var(--tk-surface);
  border: 1px solid var(--tk-border-strong);
  box-shadow: var(--tk-shadow);
  border-radius: var(--tk-radius-sm);
}
.invoice-list-autocomplete div {
  padding: 6px 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--tk-border);
  color: var(--tk-text);
}
.invoice-list-autocomplete div:hover {
  background: var(--tk-grid-row-hover);
}
.invoice-list-autocomplete div:last-child {
  border-bottom: none;
}
.customer-search-wrap {
  position: relative;
  display: inline-block;
  z-index: 31;
}
/* Keep filter autocomplete above sticky listing grid headers (sibling paint order). */
details.tk-filter-sheet:has(.invoice-list-filters),
details.tk-filter-sheet:has(.cs-list-filters) {
  position: relative;
  z-index: 30;
  overflow: visible;
}
.invoice-list-filters,
.cs-list-filters {
  position: relative;
  z-index: 30;
}
.invoice-list-grid {
  max-height: min(48vh, calc(100dvh - 340px), 480px);
  overflow: auto;
  position: relative;
  z-index: 0;
  isolation: isolate;
}
.invoice-list-grid .fox-grid thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--tk-grid-header);
  color: var(--tk-on-grid-header);
  border-bottom: 2px solid var(--tk-grid-accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.invoice-list-status-bar {
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--tk-text-secondary);
}
.invoice-list-quick-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}
.invoice-row,
.quotation-row,
.cn-row,
.consign-row,
.transfer-row,
.cs-row {
  cursor: pointer;
}
.consign-list-grid,
.transfer-list-grid {
  max-height: min(48vh, calc(100dvh - 340px), 480px);
  overflow: auto;
}
.consign-list-grid .fox-grid thead th,
.transfer-list-grid .fox-grid thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--tk-grid-header);
  color: var(--tk-on-grid-header);
  border-bottom: 2px solid var(--tk-grid-accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.form-actions.invoice-list-actions,
.form-actions.cs-list-actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cs-list-grid {
  max-height: min(52vh, calc(100dvh - 340px), 480px);
  overflow: auto;
}
.cs-list-grid .fox-grid thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--tk-grid-header);
  color: var(--tk-on-grid-header);
  border-bottom: 2px solid var(--tk-grid-accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

/* ═══════════════════════════════════════════
   THEME OVERRIDES — buttons, rows, autocomplete
   ═══════════════════════════════════════════ */
.form-actions .btn-cmd,
.form-actions a.btn-cmd,
.po-footer a.btn-cmd,
.receive-footer a.btn-cmd,
a.btn-cmd,
.btn-cmd {
  color: #374151 !important;
  text-decoration: none !important;
  border: 1px solid var(--tk-border) !important;
  border-radius: var(--tk-radius) !important;
  background: var(--tk-surface) !important;
  padding: 8px 20px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all var(--tk-transition) !important;
}
.form-actions .btn-cmd:hover,
.form-actions a.btn-cmd:hover,
.po-footer a.btn-cmd:hover,
.receive-footer a.btn-cmd:hover,
a.btn-cmd:hover,
.btn-cmd:hover {
  background: var(--tk-primary-lighter) !important;
  border-color: var(--tk-primary-light) !important;
  color: var(--tk-primary) !important;
  box-shadow: 0 1px 3px rgba(99,102,241,0.12) !important;
}

.fox-grid tbody tr.invoice-row:hover td,
.fox-grid tbody tr.quotation-row:hover td,
.fox-grid tbody tr.cn-row:hover td,
.fox-grid tbody tr.consign-row:hover td,
.fox-grid tbody tr.transfer-row:hover td,
.fox-grid tbody tr.cs-row:hover td,
.fox-grid tbody tr.po-row:hover td,
.fox-grid tbody tr.stock-row:hover td,
.fox-grid tbody tr.receive-row:hover td,
.fox-grid tbody tr.customer-row:hover td,
.fox-grid tbody tr.supplier-row:hover td,
.fox-grid tbody tr.country-row:hover td,
.fox-grid tbody tr.currency-row:hover td,
.fox-grid tbody tr.category-row:hover td {
  background: var(--tk-grid-row-hover) !important;
}
.fox-grid tbody tr.invoice-row.selected td,
.fox-grid tbody tr.quotation-row.selected td,
.fox-grid tbody tr.cn-row.selected td,
.fox-grid tbody tr.consign-row.selected td,
.fox-grid tbody tr.transfer-row.selected td,
.fox-grid tbody tr.cs-row.selected td,
.fox-grid tbody tr.po-row.selected td,
.fox-grid tbody tr.stock-row.selected td,
.fox-grid tbody tr.receive-row.selected td {
  background: color-mix(in srgb, var(--tk-primary) 22%, var(--tk-surface-alt)) !important;
}

.autocomplete-results div:hover,
.invoice-list-autocomplete div:hover,
.autocomplete-dropdown .ac-item:hover,
.autocomplete-dropdown .ac-item.active {
  background: var(--tk-primary-lighter) !important;
}

/* ═══════════════════════════════════════════
   SCROLLBAR (subtle)
   ═══════════════════════════════════════════ */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: rgba(15, 23, 42, 0.04); border-radius: 5px; }
::-webkit-scrollbar-thumb { background: rgba(100, 116, 139, 0.45); border-radius: 5px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(79, 70, 229, 0.45); border: 2px solid transparent; background-clip: padding-box; }

.toykar-body ::selection {
  background: rgba(99, 102, 241, 0.22);
  color: var(--tk-text);
}

/* ═══════════════════════════════════════════
   MOBILE MENU TOGGLE
   ═══════════════════════════════════════════ */
.toykar-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  margin: 0;
  font-size: 20px;
  background: var(--tk-surface);
  border: 1px solid var(--tk-border);
  border-radius: var(--tk-radius);
  cursor: pointer;
  flex-shrink: 0;
  z-index: 9999;
  position: relative;
  color: var(--tk-primary);
  transition: all var(--tk-transition);
}
.toykar-menu-toggle:hover {
  background: var(--tk-primary-lighter);
  border-color: var(--tk-primary-light);
}

/* ═══════════════════════════════════════════
   RESPONSIVE — TABLET (≤992px)
   ═══════════════════════════════════════════ */
@media (max-width: 992px) {
  .toykar-content {
    padding: 18px 14px 28px;
  }

  body:not(.toykar-layout-apple-card) .toykar-content .fox-window {
    max-width: 100%;
  }

  /* Listing filters: drop fixed input widths */
  .invoice-list-filters .filter-input,
  .cs-list-filters .filter-input {
    width: 100%;
    max-width: 100%;
  }
  .invoice-list-filters .filter-row,
  .cs-list-filters .filter-row {
    flex-wrap: wrap;
    gap: 10px;
  }

  /* Stack label above control before phone breakpoint */
  .fox-form .form-row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    margin-bottom: 14px;
  }
  .fox-form .form-label {
    width: 100%;
    min-width: 0;
  }
  .fox-form .form-value {
    max-width: none;
    width: 100%;
    min-width: 0;
  }

  /* Wide data grids: horizontal scroll on tablet + phone */
  .fox-grid-wrap {
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
    max-width: 100%;
  }

  body.toykar-menu-open { overflow: hidden; }

  .toykar-menu-toggle { display: flex; }

  .toykar-menu-bar {
    flex-wrap: nowrap;
    padding: 6px 0;
  }

  .toykar-shell { padding-left: 14px; padding-right: 14px; }

  .toykar-menu-inner {
    display: none;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--tk-surface);
    z-index: 9998;
    margin: 0;
    padding: 0;
    overflow: hidden;
    flex-direction: column;
    -webkit-overflow-scrolling: touch;
  }
  body.toykar-menu-open .toykar-menu-inner {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
  }
  body.toykar-menu-open .toykar-menu-toggle {
    visibility: hidden;
    pointer-events: none;
  }

  .toykar-mobile-nav-wrap { display: block; }
  .toykar-menu-inner .menu-dot { display: none; }

  .toykar-menu-close {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 16px 20px;
    font-size: 15px;
    font-weight: 600;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #fff;
    border: none;
    border-bottom: 1px solid rgba(99, 102, 241, 0.35);
    cursor: pointer;
    text-align: left;
    min-height: 56px;
    flex-shrink: 0;
    transition: background var(--tk-transition);
    letter-spacing: 0.02em;
  }
  .toykar-menu-close:hover {
    background: linear-gradient(135deg, #020617 0%, #0f172a 100%);
  }

  .toykar-menu-inner .toykar-mobile-nav-wrap {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .toykar-menu-inner .toykar-mobile-nav-wrap > a,
  .toykar-menu-inner .toykar-mobile-nav-wrap > .menu-dropdown > a {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 1px solid var(--tk-border-light);
    min-height: 48px;
    line-height: 1.35;
    color: var(--tk-text);
  }
  .toykar-menu-inner .toykar-mobile-nav-wrap > a::after {
    display: none;
  }

  .toykar-menu-inner .menu-dropdown {
    display: block;
    border-bottom: 1px solid var(--tk-border-light);
  }
  .toykar-menu-inner .menu-dropdown .menu-submenu {
    display: none;
    position: static;
    min-width: 0;
    box-shadow: none;
    border: none;
    padding: 0 0 8px 0;
    margin: 0;
    border-radius: 0;
    border-left: 3px solid var(--tk-primary-light);
    margin-left: 20px;
    background: var(--tk-surface-alt);
    animation: none;
  }
  .toykar-menu-inner .menu-dropdown.expanded .menu-submenu {
    display: block;
  }
  body.toykar-menu-open .toykar-menu-inner .menu-dropdown .menu-submenu {
    display: block;
  }
  .toykar-menu-inner .menu-dropdown > a {
    padding: 14px 20px;
  }
  .toykar-menu-inner .menu-dropdown > a::after {
    content: '▸';
    font-size: 11px;
    opacity: 0.6;
    margin-left: auto;
    padding-left: 8px;
  }
  .toykar-menu-inner .menu-dropdown.expanded > a::after {
    content: '▾';
  }
  .toykar-menu-inner .menu-submenu a {
    display: flex;
    align-items: center;
    padding: 10px 20px 10px 16px;
    font-size: 13px;
    font-weight: 400;
    min-height: 44px;
    line-height: 1.35;
    border-bottom: none;
    color: var(--tk-text-secondary);
  }
  .toykar-menu-inner .menu-submenu a::after {
    display: none;
  }
  .toykar-menu-inner .menu-submenu a:hover {
    color: var(--tk-primary);
    background: var(--tk-primary-lighter);
  }
}

/* ═══════════════════════════════════════════
   RESPONSIVE — PHONE (≤768px)
   ═══════════════════════════════════════════ */
@media (max-width: 768px) {
  .toykar-topbar-inner {
    min-height: 48px;
    flex-wrap: nowrap;
  }
  .toykar-shell { padding-left: 12px; padding-right: 12px; }
  .toykar-system-title { font-size: 12px; letter-spacing: 0.05em; }
  .toykar-hello { font-size: 11px; }
  .toykar-date { font-size: 10px; }
  .toykar-topbar-right { align-items: flex-end; }

  .toykar-content {
    padding: 12px;
  }
  .toykar-content .fox-window {
    margin: 0 -4px;
    max-width: none;
    border-radius: 8px;
  }
  .fox-window .window-body,
  .fox-body {
    padding: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .fox-grid-wrap {
    margin-left: -8px;
    margin-right: -8px;
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
    border-radius: 0;
  }
  .fox-grid {
    font-size: 12px;
    min-width: 600px;
  }
  .fox-grid th,
  .fox-grid td {
    padding: 7px 10px;
  }
  .fox-form .form-actions,
  .form-actions {
    gap: 8px;
  }
  .fox-form .btn-cmd,
  .btn-cmd,
  .form-actions .btn-cmd,
  .form-actions a.btn-cmd {
    min-height: 44px;
    padding: 10px 16px;
    font-size: 14px;
  }
  .toykar-welcome { padding: 32px 16px; }
  .toykar-logo { font-size: 48px; letter-spacing: 3.5px; line-height: 1.08; }
  .toykar-tagline { font-size: 12px; letter-spacing: 1.5px; }
  .toykar-footer {
    padding: 10px 14px;
    font-size: 10px;
    text-align: center;
  }

  /* Line editors: more usable scroll area on short viewports */
  .invoice-lines-table-wrap {
    max-height: min(56vh, 560px);
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
  }
  .invoice-lines-table-wrap .invoice-lines-table {
    min-width: 780px;
  }
  /* Wider Code & Qty for touch typing when horizontally scrolling the line grid */
  .invoice-lines-table-wrap .invoice-lines-table thead th.col-code,
  .invoice-lines-table-wrap .invoice-lines-table tbody td.col-code {
    min-width: 132px;
    width: 132px;
    max-width: none;
  }
  .invoice-lines-table-wrap .invoice-lines-table thead th.col-qty,
  .invoice-lines-table-wrap .invoice-lines-table tbody td.col-qty {
    min-width: 104px;
    width: 104px;
    max-width: none;
  }
  .invoice-entry-window .invoice-lines-toolbar .btn-tool {
    min-height: 42px;
    padding: 6px 14px;
    font-size: 13px;
  }

  /* Toolbar rows above grids */
  .invoice-lines-toolbar,
  .app-toolbar {
    flex-wrap: wrap;
    gap: 8px;
  }
}

/* ═══════════════════════════════════════════
   RESPONSIVE — SMALL PHONE (≤480px)
   ═══════════════════════════════════════════ */
@media (max-width: 480px) {
  .toykar-shell { padding-left: 10px; padding-right: 10px; }
  .toykar-topbar-inner { min-height: 44px; }
  .toykar-system-title { font-size: 11px; }
  .toykar-content { padding: 8px; }

  .toykar-footer--split {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px 12px 12px;
    text-align: center;
  }
  .toykar-footer--split .toykar-footer__copyright {
    text-align: center;
    min-width: 0;
  }
  .toykar-footer--split .toykar-footer__theme-slot {
    justify-content: center;
  }
  .toykar-footer--split .tk-theme-bar {
    justify-content: center;
  }

  .fox-window .window-titlebar,
  .fox-title-bar {
    font-size: 13px;
    padding: 10px 14px;
  }
  .fox-window .window-body,
  .fox-body {
    padding: 10px;
  }

  input[type="text"],
  input[type="number"],
  input[type="email"],
  input[type="date"],
  input[type="password"],
  select,
  textarea {
    font-size: 16px !important;
    min-height: 44px;
    padding: 10px 12px !important;
  }
  textarea { min-height: 80px; }
  .fox-search input,
  .fox-search select {
    min-width: 0;
    width: 100%;
  }
}

/* ═══════════════════════════════════════════
   TOUCH DEVICES
   ═══════════════════════════════════════════ */
@media (pointer: coarse) {
  .btn-cmd,
  .fox-btn,
  .fox-form .btn-cmd,
  a.btn-cmd,
  .app-toolbar .btn-tool {
    min-height: 44px;
    min-width: 44px;
    padding: 10px 16px;
  }
  .toykar-menu a {
    min-height: 44px;
    padding: 10px 14px;
    display: inline-flex;
    align-items: center;
  }
  .fox-grid tbody tr { min-height: 44px; }
  .fox-grid td { padding: 9px 8px; }
}

/* ═══════════════════════════════════════════
   INLINE FILTERS (stacking on narrow screens)
   ═══════════════════════════════════════════ */
@media (max-width: 768px) {
  .invoice-list-filters .filter-row,
  .po-header .form-row,
  .receive-header .form-row {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  /* Stack label above field — avoids label + width:100% input overflowing the card */
  .invoice-list-filters .filter-cluster {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    flex-wrap: wrap;
    gap: 6px;
  }
  .invoice-list-filters .filter-cluster-dates {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
  }
  .invoice-list-filters label,
  .po-header label,
  .receive-header label { min-width: 0; }
  .invoice-list-filters .filter-input,
  .invoice-list-filters .filter-date,
  .invoice-list-filters .customer-search-wrap {
    width: 100% !important;
    max-width: 100%;
    box-sizing: border-box;
  }
  .invoice-list-filters .customer-search-wrap {
    display: block;
  }
  .invoice-list-filters .filter-cluster-dates .filter-date {
    flex: 1 1 7.5rem;
    width: auto !important;
  }
  .invoice-list-grid,
  .receive-grid,
  .po-grid {
    max-height: min(calc(100dvh - 260px), calc(100vh - 260px), 560px);
  }
  .po-footer,
  .receive-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .po-footer .btn-cmd,
  .receive-footer .btn-cmd { width: 100%; }
}

/* Line-number column (scoped to thead/tbody — tfoot label rows must not match td:first-child line-number rules). */
.inv-print-lines thead th:first-child {
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
  width: 2.25rem;
}
.inv-print-lines tbody td:first-child {
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
  width: 1%;
  max-width: 2rem;
  min-width: 0;
  text-align: center;
  padding-left: 4px;
  padding-right: 4px;
}

/* Body rows: plain text under headers (no column grid) — screenshot-style invoice lines */
.inv-print-lines tbody td {
  border: none;
}

/* Subtotal / tax / total sit outside the bordered line grid; rules only on amount column */
.inv-print-summary {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  margin-top: 10px;
  font-size: 12px;
}
.inv-print-summary td {
  border: none;
  padding: 3px 6px;
  vertical-align: baseline;
}
.inv-print-summary td.inv-print-sum-label {
  text-align: right;
  font-weight: 600;
}
.inv-print-summary td.inv-print-sum-num {
  text-align: right;
  white-space: nowrap;
  box-sizing: border-box;
  width: 95px;
  min-width: 95px;
  max-width: 95px;
  padding: 3px 4px;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
.inv-print-summary tbody tr:first-child td.inv-print-sum-num {
  border-top: 1px solid #000;
}
.inv-print-summary tbody tr:last-child td.inv-print-sum-num {
  border-bottom: 1px solid #000;
}

/* Invoice / quotation / consignment (inv-print-*) : flex “spring” fills leftover height so footer sits low; min scales with viewport */
.inv-print-wrapper > .inv-print-page-fill {
  flex: 1 1 auto;
  width: 100%;
  min-height: clamp(4mm, 3vmin, 14mm);
}

/* Screen: match @page margin so the on-page layout matches Chrome print preview / PDF (wrapper print padding is 0; @page supplies the inset — use same mm as each template). */
@media screen {
  body.toykar-body .inv-print-wrapper {
    padding: 6mm !important;
    box-sizing: border-box !important;
  }
  body.toykar-body .cn-print-wrapper,
  body.toykar-body .cs-print-wrapper,
  body.toykar-body .po-print-wrapper {
    padding: 6mm !important;
    box-sizing: border-box !important;
  }
}

/* ═══════════════════════════════════════════
   PRINT
   ═══════════════════════════════════════════ */
@media print {
  /* Let the document grow across pages; height:100% + flex scroll shell clips to one sheet in many browsers */
  html,
  body {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }
  .toykar-body {
    display: block !important;
    min-height: 0 !important;
    height: auto !important;
    /* Undo mobile-shell body padding if any max-width rules leaked into print */
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }
  /* Apple Card shell: 100dvh / flex scroll heights stack with inv-print min-heights → blank sheet 2 */
  body.toykar-layout-apple-card {
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    display: block !important;
    overflow: visible !important;
  }
  body.toykar-layout-apple-card .tk-ac-shell,
  body.toykar-layout-apple-card .tk-ac-stage,
  body.toykar-layout-apple-card .tk-ac-body-scroll {
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    display: block !important;
    overflow: visible !important;
  }
  body.toykar-layout-apple-card main.toykar-content.tk-ac-content,
  body.toykar-layout-apple-card .tk-ac-content-inner {
    min-height: 0 !important;
    max-width: none !important;
    padding: 0 !important;
  }
  .toykar-content {
    flex: none !important;
    overflow: visible !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 0 !important;
    /* Mobile shell fades main in with opacity; print must not freeze at opacity 0 (narrow printable width + max-width rules). */
    animation: none !important;
    opacity: 1 !important;
  }
  /* Classic + shared nav chrome (tk-gr-* reused by Apple Card): hide all app chrome */
  .toykar-topbar,
  .toykar-menu,
  .toykar-footer,
  .toykar-footer-dock,
  .toykar-footer-dock__hit,
  .tk-theme-bar,
  .tk-layout-bar,
  .tk-gr-topbar,
  .tk-gr-rail,
  .tk-gr-scrim,
  .tk-gr-fab-stack,
  .tk-gr-mobile-stock-strip,
  .tk-mas-appbar,
  .tk-mas-tabbar,
  .tk-mas-sheet,
  .tk-mas-scrim,
  .tk-mas-fab {
    display: none !important;
  }
  .fox-window { box-shadow: none !important; border: none !important; }
  .toykar-fab-stack,
  .toykar-mobile-quick-grid {
    display: none !important;
  }

  /* Print document pages: collapse app shell so only .inv-print-wrapper height counts (avoids blank sheet 2). */
  body.tk-print-doc,
  html:has(body.tk-print-doc) {
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
  body.tk-print-doc.toykar-layout-apple-card .tk-ac-shell,
  body.tk-print-doc.toykar-layout-apple-card .tk-ac-stage,
  body.tk-print-doc.toykar-layout-apple-card .tk-ac-body-scroll,
  body.tk-print-doc main.toykar-content,
  body.tk-print-doc .tk-ac-content-inner {
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    display: block !important;
    overflow: visible !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  body.tk-print-doc .toykar-footer-dock,
  body.tk-print-doc .tk-ac-fab-stack,
  body.tk-print-doc .inv-print-actions,
  body.tk-print-doc .tk-alert {
    display: none !important;
    height: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    visibility: hidden !important;
    border: none !important;
  }

  /* Invoice / quotation / consignment / DO — min-height set at print time by inv-print-layout.js */
  .inv-print-wrapper {
    max-width: 100% !important;
    width: 100% !important;
    box-shadow: none !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    font-size: 13px !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
    height: auto !important;
  }
  .inv-print-letterhead {
    flex-wrap: wrap !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }
  /* Tighter address block (smaller than body text) to align with left logo height */
  .inv-print-letterhead-center {
    flex: 1 1 160px !important;
    min-width: 0 !important;
    font-size: 7px !important;
    line-height: 1.2 !important;
    color: #000000 !important;
  }
  .inv-print-letterhead-center h2 {
    font-size: 34px !important;
    line-height: 1.2 !important;
    margin: 0 0 2px 0 !important;
    color: #000000 !important;
  }
  .inv-print-letterhead-center h3 {
    font-size: 8px !important;
    line-height: 1.2 !important;
    margin: 0 0 2px 0 !important;
    color: #000000 !important;
  }
  .inv-print-letterhead-center p {
    font-size: 7px !important;
    line-height: 1.2 !important;
    margin: 0 0 1px 0 !important;
    color: #000000 !important;
  }
  .inv-print-letterhead-center strong {
    font-size: 7px !important;
    color: #000000 !important;
  }
  .inv-print-letterhead-right {
    flex: 1 1 100px !important;
    min-width: 0 !important;
    text-align: right !important;
    font-size: 11px !important;
  }
  .inv-print-letterhead-right-title {
    font-size: 16px !important;
  }
  .inv-print-letterhead-logo img {
    max-width: 180px !important;
    width: auto !important;
    height: auto !important;
  }
  .inv-print-meta {
    flex-wrap: nowrap !important;
    font-size: 12px !important;
  }
  .inv-print-meta-item {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    box-sizing: border-box !important;
  }
  .inv-print-meta-label {
    white-space: nowrap !important;
  }
  .inv-print-box-title {
    font-size: 12px !important;
  }
  .inv-print-boxes {
    flex-wrap: wrap !important;
  }
  .inv-print-box {
    flex: 1 1 260px !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }
  .inv-print-box-text {
    white-space: pre-wrap !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
    font-size: 12px !important;
  }
  .inv-print-remarks {
    font-size: 12px !important;
  }
  .inv-print-lines {
    table-layout: fixed !important;
    width: 100% !important;
    font-size: 12px !important;
  }
  .inv-print-lines tbody td {
    border: none !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
    padding: 4px 6px !important;
    vertical-align: top !important;
  }
  .inv-print-lines thead th {
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
    padding: 4px 6px !important;
    vertical-align: top !important;
    border: 1px solid #000 !important;
  }
  .inv-print-lines thead th:first-child {
    white-space: nowrap !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
    width: 2.25rem !important;
  }
  .inv-print-lines tbody td:first-child {
    white-space: nowrap !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
    width: 1% !important;
    max-width: 2rem !important;
    min-width: 0 !important;
    text-align: center !important;
    padding-left: 4px !important;
    padding-right: 4px !important;
  }
  .inv-print-summary td.inv-print-sum-label {
    text-align: right !important;
    font-weight: 600 !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
  }
  .inv-print-summary td.inv-print-sum-num {
    text-align: right !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
    width: 95px !important;
    min-width: 95px !important;
    max-width: 95px !important;
    padding: 3px 4px !important;
    font-variant-numeric: tabular-nums !important;
    font-feature-settings: "tnum" 1 !important;
    vertical-align: baseline !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
  }
  .inv-print-summary tbody tr:first-child td.inv-print-sum-num {
    border-top: 1px solid #000 !important;
  }
  .inv-print-summary tbody tr:last-child td.inv-print-sum-num {
    border-bottom: 1px solid #000 !important;
  }
  .inv-print-footer-note {
    font-size: 11px !important;
  }
  /* Pin footer when JS sets one-page min-height (data-inv-print-fit=one-page) */
  .inv-print-wrapper[data-inv-print-fit='one-page'] .inv-print-footer-stack {
    margin-top: auto !important;
  }
  .inv-print-wrapper > .inv-print-page-fill {
    display: none !important;
    flex: none !important;
    height: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }
  .inv-print-footer-stack {
    flex-shrink: 0 !important;
    align-self: stretch !important;
    padding-top: 0 !important;
    page-break-before: auto !important;
    break-before: auto !important;
  }
  /* Bank / PayNow: use sizes from templates/print_footer.php (do not upscale in print) */
}

/* ═══════════════════════════════════════════
   THEME TOKENS — beat page-embedded <style> that hardcoded navy
   ═══════════════════════════════════════════ */
button.btn-primary,
a.btn-primary,
.btn-primary {
  background: var(--tk-primary-dark) !important;
  color: #fff !important;
  border-color: var(--tk-primary-dark) !important;
}
button.btn-primary:hover,
a.btn-primary:hover,
.btn-primary:hover {
  background: var(--tk-primary-hover) !important;
  border-color: var(--tk-primary-hover) !important;
  color: #fff !important;
}

.invoice-lines-table td.line-select-handle {
  color: var(--tk-primary-dark) !important;
}
tr.invoice-line-row.invoice-line-selected {
  outline: 2px solid var(--tk-primary-dark) !important;
  outline-offset: -2px;
  background: var(--tk-primary-lighter) !important;
}
.invoice-actions-group-title {
  color: var(--tk-primary-dark) !important;
}

/* Home: stacked floating shortcuts (config/home_floating_shortcuts.json — desktop list) */
.toykar-fab-stack {
  position: fixed;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: calc(12px + 3.5rem + env(safe-area-inset-bottom, 0px));
  z-index: 220;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: 10px;
  /* Keep the whole block inside the viewport when “More shortcuts” is expanded (scroll instead of clipping off-screen). */
  box-sizing: border-box;
  max-width: min(22rem, calc(100vw - 24px));
  /* cap height so the stack never grows past the viewport; inner .toykar-fab-stack__rest also scrolls if needed */
  max-height: min(90vh, calc(100vh - 3.5rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)));
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  min-height: 0;
  padding-left: 2px; /* room for focus ring / scrollbar */
}
/* Pill style shared by each stacked button */
.toykar-quickshare-fab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--tk-border-strong, #cbd5e1);
  background: var(--tk-primary, #4f46e5);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  box-shadow: var(--tk-shadow, 0 8px 20px rgba(0,0,0,0.2));
  transition: transform var(--tk-transition), background var(--tk-transition), box-shadow var(--tk-transition);
}
.toykar-fab-stack .toykar-quickshare-fab,
.toykar-fab-stack .toykar-fab-stack__btn {
  position: static;
  right: auto;
  bottom: auto;
  max-width: 100%;
  box-sizing: border-box;
}
.toykar-quickshare-fab:hover {
  background: var(--tk-primary-hover, #4338ca);
  color: #fff;
  text-decoration: none;
  transform: translateY(-1px);
}
.toykar-quickshare-fab:focus-visible {
  outline: none;
  box-shadow: var(--tk-shadow, 0 8px 20px rgba(0,0,0,0.2)), var(--tk-ring, 0 0 0 3px rgba(79,70,229,0.35));
}

/* Drag handle — last in DOM → top of stack (column-reverse) */
.toykar-fab-stack__drag {
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  border: 1px solid var(--tk-border-strong, #cbd5e1);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--tk-muted, #64748b);
  background: color-mix(in srgb, var(--tk-surface, #fff) 92%, var(--tk-muted, #64748b) 8%);
  box-shadow: var(--tk-shadow-sm, 0 2px 8px rgba(0, 0, 0, 0.08));
  flex-shrink: 0;
  max-width: 100%;
}
.toykar-fab-stack__drag:hover {
  color: var(--tk-text-secondary, #475569);
  background: var(--tk-surface-alt, #f1f5f9);
}
.toykar-fab-stack__drag:focus-visible {
  outline: none;
  box-shadow: var(--tk-shadow-sm, 0 2px 8px rgba(0, 0, 0, 0.08)), var(--tk-ring, 0 0 0 3px rgba(79, 70, 229, 0.35));
}

/* Classic home: extra shortcuts (collapsed by default; see home.php) */
.toykar-fab-stack__rest {
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: 10px;
  min-height: 0;
  flex-shrink: 1;
  width: 100%;
  max-width: 100%;
}
.toykar-fab-stack__rest[hidden] {
  display: none !important;
}
.toykar-fab-stack__rest:not([hidden]) {
  /* Scroll long lists inside the band so the parent FAB doesn’t exceed the viewport. */
  max-height: min(50vh, 16rem);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.toykar-fab-stack__expand {
  cursor: pointer;
  font: inherit;
  border: 1px solid color-mix(in srgb, var(--tk-primary, #4f46e5) 45%, var(--tk-border-strong, #cbd5e1));
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--tk-primary, #4f46e5);
  background: color-mix(in srgb, var(--tk-surface, #fff) 88%, var(--tk-primary-lighter, #e0e7ff));
  box-shadow: var(--tk-shadow-sm, 0 2px 8px rgba(0, 0, 0, 0.08));
  flex-shrink: 0;
  white-space: nowrap;
  max-width: 100%;
}
.toykar-fab-stack__expand:hover {
  background: color-mix(in srgb, var(--tk-primary-lighter, #e0e7ff) 70%, var(--tk-surface, #fff));
  color: var(--tk-primary-dark, #3730a3);
}
.toykar-fab-stack__expand:focus-visible {
  outline: none;
  box-shadow: var(--tk-shadow-sm, 0 2px 8px rgba(0, 0, 0, 0.08)), var(--tk-ring, 0 0 0 3px rgba(79, 70, 229, 0.35));
}

/* Maintenance — home shortcuts: row reorder (drag handle column) */
.hs-drag-cell {
  width: 40px;
  text-align: center;
  vertical-align: middle;
}
.hs-drag-handle {
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  display: inline-block;
  color: var(--tk-muted, #64748b);
  font-size: 14px;
  line-height: 1;
  letter-spacing: -0.06em;
  padding: 6px 8px;
  margin: -4px;
  touch-action: none;
  /* Required for HTML5 drag on the handle (not <tr>) in Chromium */
  -webkit-user-drag: element;
}
.hs-drag-handle:active {
  cursor: grabbing;
}
tr.hs-row--dragging {
  opacity: 0.55;
}
tr.hs-row--dragging td {
  background: color-mix(in srgb, var(--tk-primary-lighter, #e0e7ff) 55%, var(--tk-surface, #fff));
}

/* Mobile home: 2×2 shortcuts */
.toykar-mobile-quick-grid {
  display: none;
}
@media (max-width: 768px) {
  .toykar-fab-stack {
    display: none;
  }
  .toykar-mobile-quick-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
    max-width: 420px;
    margin: 4px auto 16px;
    padding: 0 4px;
    box-sizing: border-box;
  }
  .toykar-mobile-quick-tile {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 52px;
    padding: 8px 10px;
    border-radius: var(--tk-radius, 12px);
    border: 1px solid var(--tk-border-strong, #cbd5e1);
    background: var(--tk-primary, #4f46e5);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.25;
    text-decoration: none;
    box-shadow: var(--tk-shadow-sm, 0 3px 10px rgba(0,0,0,0.12));
    hyphens: auto;
    word-break: break-word;
  }
  .toykar-mobile-quick-tile:hover,
  .toykar-mobile-quick-tile:active {
    background: var(--tk-primary-hover, #4338ca);
    color: #fff;
    text-decoration: none;
  }
  .toykar-mobile-quick-tile:focus-visible {
    outline: none;
    box-shadow: var(--tk-shadow-sm, 0 3px 10px rgba(0,0,0,0.12)), var(--tk-ring, 0 0 0 3px rgba(79,70,229,0.35));
  }
}

/* ═══════════════════════════════════════════
   Full-screen barcode scanner (layout) — uses theme primary accents
   ═══════════════════════════════════════════ */
#barcode-scanner-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--tk-scanner-overlay-bg);
}
.bsc-fullscreen {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  background: var(--tk-scanner-overlay-bg);
  color: #fff;
}
.bsc-topbar {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  background: var(--tk-scanner-topbar-bg);
}
.bsc-topbar .bsc-title {
  font-weight: 700;
  font-size: 1.05em;
}
.bsc-close-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 2em;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bsc-reader-full {
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  background: var(--tk-scanner-overlay-bg);
}
.bsc-reader-full video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block !important;
}
.bsc-bottom {
  flex-shrink: 0;
  background: var(--tk-scanner-panel-bg);
  padding: 8px 12px 12px;
}
.bsc-manual-row {
  display: flex;
  gap: 6px;
  margin-bottom: 4px;
}
.bsc-manual-row input {
  flex: 1;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid var(--tk-scanner-input-border);
  background: var(--tk-scanner-input-bg);
  color: #fff;
  font-size: 16px;
}
.bsc-manual-row button {
  padding: 10px 16px;
  border-radius: 6px;
  border: none;
  background: var(--tk-primary);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
}
.bsc-status {
  color: var(--tk-scanner-muted);
  font-size: 0.8em;
  text-align: center;
  padding-top: 4px;
}
.bsc-no-cam {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--tk-scanner-muted);
  text-align: center;
  padding: 30px 20px;
}
.bsc-no-cam-icon {
  font-size: 4em;
  margin-bottom: 16px;
  opacity: 0.4;
}
.bsc-no-cam-title {
  font-size: 1.3em;
  font-weight: 700;
  color: #e0e0e0;
  margin-bottom: 10px;
}
.bsc-no-cam-hint {
  font-size: 0.95em;
  line-height: 1.5;
  color: var(--tk-scanner-muted);
  max-width: 320px;
}
.bsc-qty-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--tk-scanner-panel-bg);
}
.bsc-product-info {
  background: color-mix(in srgb, var(--tk-primary-dark) 40%, #1e1b4b);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 20px;
  text-align: center;
  width: 100%;
  max-width: 360px;
}
.bsc-prod-code {
  font-weight: 700;
  font-size: 1.2em;
  color: var(--tk-primary-light);
}
.bsc-prod-desc {
  color: #e0e0e0;
  margin: 6px 0;
}
.bsc-prod-price {
  color: #9ca3af;
  font-size: 0.95em;
}
.bsc-qty-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
}
.bsc-qty-row label {
  font-weight: 600;
  font-size: 1.1em;
  color: #fff;
}
.bsc-qty-row input {
  width: 100px;
  padding: 10px;
  font-size: 1.2em;
  text-align: center;
  border-radius: 8px;
  border: 1px solid var(--tk-scanner-input-border);
  background: var(--tk-scanner-input-bg);
  color: #fff;
}
.bsc-qty-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.bsc-btn-primary {
  padding: 12px 24px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, var(--tk-primary) 0%, var(--tk-accent) 100%);
  color: #fff;
  font-weight: 600;
  font-size: 1em;
  cursor: pointer;
}
.bsc-btn-secondary {
  padding: 12px 20px;
  border-radius: 8px;
  border: 1px solid var(--tk-primary-light);
  background: color-mix(in srgb, var(--tk-primary-dark) 55%, #0f172a);
  color: var(--tk-primary-light);
  font-weight: 500;
  font-size: 1em;
  cursor: pointer;
}
.bsc-btn-cancel {
  padding: 12px 20px;
  border-radius: 8px;
  border: 1px solid #555;
  background: #333;
  color: #ccc;
  font-size: 1em;
  cursor: pointer;
}

/* Tag-new-barcode step */
.bsc-assign-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 12px;
  background: var(--tk-scanner-panel-bg);
  overflow: hidden;
}
.bsc-assign-head {
  color: #e0e0e0;
  font-size: 0.95em;
  line-height: 1.4;
  text-align: center;
}
.bsc-assign-head b { color: var(--tk-primary-light); }
.bsc-assign-searchrow input {
  width: 100%;
  padding: 12px;
  font-size: 1.1em;
  border-radius: 8px;
  border: 1px solid var(--tk-scanner-input-border);
  background: var(--tk-scanner-input-bg);
  color: #fff;
  box-sizing: border-box;
}
.bsc-assign-results {
  flex: 1;
  overflow-y: auto;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}
.bsc-assign-results > div {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
}
.bsc-assign-results > div:active { background: rgba(255, 255, 255, 0.12); }
.bsc-ar-code { font-weight: 700; color: var(--tk-primary-light); }
.bsc-ar-desc { color: #d0d0d0; font-size: 0.9em; margin: 2px 0; }
.bsc-ar-meta { color: #9ca3af; font-size: 0.82em; }

/* Part-number OCR scanner (reuses bsc-* chrome) */
#partno-scanner-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--tk-scanner-overlay-bg);
}
.pno-camera-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: #000;
}
.pno-camera-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.pno-guide-box {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(96vw, 680px);
  height: min(26vh, 150px);
  min-height: 96px;
  transform: translate(-50%, -50%);
  border: 2px dashed rgba(255, 255, 255, 0.9);
  border-radius: 10px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.22);
  pointer-events: none;
}
.pno-guide-box::after {
  content: "Center the part number inside the box";
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  text-transform: none;
  color: rgba(255, 255, 255, 0.78);
  white-space: nowrap;
}
.pno-search-results {
  max-height: 160px;
  overflow-y: auto;
  margin: 0 0 6px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}
.pno-search-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.pno-search-item:hover {
  background: rgba(255, 255, 255, 0.1);
}
.pno-search-empty {
  padding: 8px 10px;
  font-size: 0.85rem;
  opacity: 0.7;
}
.pno-live-hud {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  width: min(92vw, 560px);
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.15);
  text-align: center;
  pointer-events: none;
  z-index: 2;
}
.pno-live-read {
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  min-height: 1.3em;
  word-break: break-word;
}
.pno-live-sharp {
  margin-top: 4px;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.65);
}
.pno-live-sharp.pno-sharp-ok {
  color: #86efac;
}
.pno-live-sharp.pno-sharp-low {
  color: #fca5a5;
}
.pno-live-toggle {
  min-width: 88px;
}
.pno-live-toggle.pno-live-off {
  opacity: 0.75;
}
.pno-capture-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.pno-capture-btn {
  flex: 1;
  min-width: 160px;
  max-width: 280px;
}
.pno-pick-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 12px;
  background: var(--tk-scanner-panel-bg);
  overflow: hidden;
}
.pno-ocr-readout {
  color: #e5e7eb;
  text-align: center;
  margin-bottom: 10px;
  font-size: 0.95em;
  line-height: 1.4;
}
.pno-pick-hint {
  color: var(--tk-scanner-muted);
  font-size: 0.9em;
}
.pno-pick-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.pno-pick-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--tk-scanner-input-border);
  background: var(--tk-scanner-input-bg);
  color: #fff;
  cursor: pointer;
}
.pno-pick-item:active {
  border-color: var(--tk-primary-light);
}
.pno-pick-code {
  font-weight: 700;
  color: var(--tk-primary-light);
}
.pno-pick-desc {
  color: #d1d5db;
  font-size: 0.92em;
}
.pno-read-match {
  margin-top: 8px;
  color: var(--tk-scanner-muted);
  font-size: 0.85em;
}
.pno-match-via {
  display: block;
  margin-top: 4px;
  font-size: 0.78em;
  color: var(--tk-primary-light);
  font-style: italic;
}

html[data-theme="navy"] {
  --tk-scanner-topbar-bg: linear-gradient(135deg, #132238 0%, #b45309 100%);
}
html[data-theme="plum"] {
  --tk-scanner-topbar-bg: linear-gradient(135deg, #4a3d66 0%, #0891b2 100%);
}
html[data-theme="stone"] {
  --tk-scanner-topbar-bg: linear-gradient(135deg, #292524 0%, #0d9488 100%);
}
html[data-theme="ember"] {
  --tk-scanner-topbar-bg: linear-gradient(135deg, #991b1b 0%, #ea580c 100%);
}

/* ── Quick stock lookup (full page; desktop + classic layout) ─────────────── */
.tk-quick-stock-page .tk-gr-mobile-stock-strip {
  display: block;
  padding: 0;
  margin: 0;
  border: none;
  box-shadow: none;
  background: transparent;
}
.tk-quick-stock-page .tk-gr-stock-strip-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
}
.tk-quick-stock-page .tk-gr-stock-q {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--tk-border-strong, #cbd5e1) 55%, transparent);
  background: var(--tk-surface, #fff);
  color: var(--tk-text, #0f172a);
  font-size: 15px;
  box-sizing: border-box;
}
.tk-quick-stock-page .tk-gr-stock-q:focus {
  outline: none;
  border-color: var(--tk-primary, #4f46e5);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tk-primary, #4f46e5) 28%, transparent);
}
.tk-quick-stock-page .tk-gr-stock-scan {
  flex-shrink: 0;
  min-width: 76px;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--tk-primary, #4f46e5) 45%, transparent);
  background: color-mix(in srgb, var(--tk-primary-lighter, #eef2ff) 35%, var(--tk-surface, #fff));
  color: var(--tk-primary-dark, var(--tk-primary, #4f46e5));
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-sizing: border-box;
}
.tk-quick-stock-page .tk-gr-stock-scan:active {
  transform: scale(0.98);
}

@media screen and (min-width: 901px) {
  .tk-quick-stock-page .tk-gr-stock-scan {
    display: none !important;
  }
}

.tk-quick-stock-page .tk-gr-stock-results {
  margin-top: 12px;
  max-height: min(65vh, 560px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--tk-border, #e2e8f0) 70%, transparent);
  background: color-mix(in srgb, var(--tk-surface, #fff) 96%, var(--tk-bg, #f8fafc));
}
.tk-quick-stock-page .tk-gr-stock-msg {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--tk-text-secondary, #64748b);
  text-align: center;
}
.tk-quick-stock-page .tk-gr-stock-hit {
  padding: 12px 14px;
  border-bottom: 1px solid color-mix(in srgb, var(--tk-border, #e2e8f0) 55%, transparent);
}
.tk-quick-stock-page .tk-gr-stock-hit:last-child {
  border-bottom: none;
}
.tk-quick-stock-page .tk-gr-stock-hit-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.tk-quick-stock-page .tk-gr-stock-hit-code {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.02em;
  color: var(--tk-text, #0f172a);
}
.tk-quick-stock-page .tk-gr-stock-hit-report {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  text-decoration: none;
  background: var(--tk-primary, #4f46e5);
  color: #fff !important;
  border: 1px solid color-mix(in srgb, #fff 22%, var(--tk-primary-dark, var(--tk-primary, #4f46e5)));
}
.tk-quick-stock-page .tk-gr-stock-hit-desc {
  font-size: 13px;
  color: var(--tk-text-secondary, #64748b);
  line-height: 1.35;
  margin-bottom: 8px;
}
.tk-quick-stock-page .tk-gr-stock-hit-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-bottom: 6px;
}
.tk-quick-stock-page .tk-gr-stock-hit-meta {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  font-size: 14px;
}
.tk-quick-stock-page .tk-gr-stock-k {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tk-text-muted, var(--tk-text-secondary, #64748b));
}
.tk-quick-stock-page .tk-gr-stock-v {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--tk-text, #0f172a);
}

.tk-quick-stock-page .tk-gr-stock-cost-reveal {
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px dashed var(--tk-text-muted, var(--tk-text-secondary, #64748b));
  background: transparent;
  color: var(--tk-text-secondary, #64748b);
  cursor: pointer;
}

.tk-quick-stock-page .tk-gr-stock-cost-reveal:hover:not(:disabled) {
  border-style: solid;
  color: var(--tk-text, #0f172a);
}

.tk-quick-stock-page .tk-gr-stock-cost-reveal:disabled {
  cursor: wait;
  opacity: 0.7;
}

.tk-gr-stock-qty-meta.tk-gr-stock-qty-ok .tk-gr-stock-k,
.tk-gr-stock-qty-meta.tk-gr-stock-qty-ok .tk-gr-stock-v {
  color: #1a7f37;
}

.tk-gr-stock-qty-meta.tk-gr-stock-qty-zero .tk-gr-stock-k,
.tk-gr-stock-qty-meta.tk-gr-stock-qty-zero .tk-gr-stock-v {
  color: #b42318;
}
.tk-quick-stock-page .tk-gr-stock-hit-loc {
  font-size: 11px;
  color: var(--tk-text-muted, var(--tk-text-secondary, #64748b));
  font-variant-numeric: tabular-nums;
}

.tk-gr-stock-loc-link {
  color: var(--tk-accent, #c026a6);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
  padding: 2px 1px;
}

.tk-gr-stock-loc-link:active {
  opacity: 0.7;
}

/* Price History / Quotations — desktop sheet helpers (mobile overrides in tk-mobile-app-pages.css) */
.tk-page-sheet--price-history {
  max-width: 1100px;
  margin: 18px auto;
}
.tk-page-sheet--price-history .tk-ph-body {
  padding: 14px;
}
.tk-ph-results {
  max-height: min(52vh, calc(100dvh - 340px), 520px);
  overflow: auto;
  position: relative;
  margin-top: 8px;
  border: 1px solid var(--tk-border-light, rgba(148, 163, 184, 0.35));
  border-radius: 8px;
  -webkit-overflow-scrolling: touch;
}
