/* ==========================================================================
   UA Pro CRM - Design System & Brand Book v5.0 (Frozen Baseline)
   Tokens live in /design-vars.css. Zero gradients, zero dark card shadows.
   ========================================================================== */

/* ==========================================================================
   Base Reset, WebKit SVG Guard & Typography
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg-canvas);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  font-stretch: 87.5%;
  font-weight: var(--body-weight);
  font-size: 13.5px;
  line-height: 1.45;
  /* Critical Fixel rule: prevent slashed zero glyph substitution */
  font-feature-settings: "tnum" 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
  overscroll-behavior-y: none;
}

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-sans);
  font-stretch: 100%;
  font-weight: 600;
  color: var(--ink-primary);
}

p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button, .ua-pill, .ua-btn, .quiet-btn { -webkit-appearance: none; appearance: none; }
a, button, [role="button"], [tabindex], .chart-svg, .bar-col, .bar-col *, .chart-hit {
  -webkit-tap-highlight-color: transparent;
}

/* Intrinsic default icon size prevents giant unstyled SVG stretch on WebKit */
:where(svg.ua-ico) { width: 16px; height: 16px; display: block; flex: 0 0 auto; }

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: -0.015em;
}

:where(button, a, input, select, textarea, tr[tabindex], [tabindex]):focus-visible {
  outline: 2px solid var(--accent-ring);
  outline-offset: 2px;
}

/* Circular View-Transition theme sweep */
html.ua-theme-vt::view-transition-old(root),
html.ua-theme-vt::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

html.ua-theme-vt::view-transition-new(root) {
  animation: uaThemeCircle 440ms var(--ease-in-out) forwards;
  clip-path: circle(0 at var(--ua-vt-x, 50%) var(--ua-vt-y, 50%));
}

@keyframes uaThemeCircle {
  to {
    clip-path: circle(var(--ua-vt-r, 150vmax) at var(--ua-vt-x, 50%) var(--ua-vt-y, 50%));
  }
}

/* ==========================================================================
   Body Scroll Lock
   ========================================================================== */

html.is-scroll-locked { overscroll-behavior-y: none; }

body.is-scroll-locked {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
  overflow: hidden;
  padding-right: var(--scrollbar-comp, 0px);
  overscroll-behavior: none;
}

/* ==========================================================================
   Layout Frame & Flush Architectural Sidebar
   ========================================================================== */

.app-frame {
  display: flex;
  min-height: 100dvh;
  width: 100%;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  width: 240px;
  flex: 0 0 240px;
  display: flex;
  flex-direction: column;
  padding: 12px 10px;
  background: var(--bg-surface-1);
  border-right: 1px solid var(--border-subtle);
  z-index: 30;
  transition: width 200ms var(--ease-out), flex-basis 200ms var(--ease-out);
}

.sidebar.collapsed {
  width: 64px;
  flex-basis: 64px;
  padding: 12px 8px;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  margin-bottom: 10px;
}

.sidebar.collapsed .sidebar-head { flex-direction: column; gap: 8px; }

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 2px 4px;
  border-radius: var(--r-md);
}

.brand-mark {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  background: var(--bg-inverse);
  color: var(--ink-inverse);
}

.brand-mark svg { width: 17px; height: 21px; display: block; }
.brand-copy { display: flex; flex-direction: column; min-width: 0; }
.brand-title-row { display: flex; align-items: center; gap: 6px; }
.brand-name { font-stretch: 100%; font-weight: 600; font-size: 15px; letter-spacing: -0.03em; line-height: 1.1; white-space: nowrap; }

.brand-tag {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--r-xs);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--accent-text);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.brand-sub { font-size: 11.5px; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar.collapsed .brand-copy,
.sidebar.collapsed .sidebar-section-label,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .nav-chev,
.sidebar.collapsed .sub-nav,
.sidebar.collapsed .rail-status-text,
.sidebar.collapsed .profile-meta { display: none; }

.rail-pin-btn {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--ink-secondary);
  cursor: pointer;
  transition: background-color var(--dur-press) ease, color var(--dur-press) ease, border-color var(--dur-press) ease;
}

@media (hover: hover) and (pointer: fine) {
  .rail-pin-btn:hover { background: var(--bg-surface-2); border-color: var(--border-strong); color: var(--ink-primary); }
}

.rail-pin-btn svg { width: 16px; height: 16px; display: block; }

.sidebar-section-label {
  padding: 8px 10px 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.sidebar-section-label:first-child { padding-top: 2px; }

.sidebar-nav {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-item {
  position: relative;
  width: 100%;
  height: 36px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-secondary);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background-color var(--dur-press) ease, color var(--dur-press) ease, border-color var(--dur-press) ease;
}

.sidebar.collapsed .nav-item {
  width: 44px;
  height: 44px;
  padding: 0;
  margin-inline: auto;
  justify-content: center;
}

@media (hover: hover) and (pointer: fine) {
  .nav-item:hover { background: var(--bg-surface-2); color: var(--ink-primary); }
}

.nav-item.active {
  background: var(--bg-surface-2);
  border-color: var(--border-subtle);
  color: var(--ink-primary);
  font-weight: 600;
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--accent-primary);
}

.sidebar.collapsed .nav-item.active::before { left: 0; }
.nav-ico { width: 18px; height: 18px; flex: 0 0 18px; display: grid; place-items: center; }
.nav-ico svg { width: 18px; height: 18px; display: block; }
.nav-item.active .nav-ico { color: var(--accent-text); }
.nav-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-badge {
  height: 18px;
  min-width: 20px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--bg-surface-3);
  color: var(--ink-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
}

.nav-badge.unread { background: var(--accent-soft); color: var(--accent-text); }
.nav-badge.alert  { background: var(--bad-bg); color: var(--bad-text); border: 1px solid var(--bad-border); }
.nav-chev { width: 14px; height: 14px; flex: 0 0 14px; color: var(--ink-muted); transition: transform 180ms var(--ease-out); }
.nav-item.expanded .nav-chev { transform: rotate(180deg); }
.nav-chev svg { width: 14px; height: 14px; display: block; }
.nav-collapsed-dot { display: none; }

.sidebar.collapsed .nav-collapsed-dot {
  display: block;
  position: absolute;
  top: 8px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-primary);
}
.sidebar.collapsed .nav-collapsed-dot.is-warn { background: var(--bad-dot); }

.sub-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 2px 0 6px 18px;
  padding-left: 10px;
  border-left: 1px solid var(--border-subtle);
}

.sub-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 30px;
  padding: 0 8px;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink-secondary);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background-color var(--dur-press) ease, color var(--dur-press) ease;
}

@media (hover: hover) and (pointer: fine) {
  .sub-nav-item:hover { background: var(--bg-surface-2); color: var(--ink-primary); }
}

.sub-nav-item.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.sub-dot { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; }

.sidebar-footer {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rail-status-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 34px;
  padding: 0 8px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  color: var(--ink-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--dur-press) ease, color var(--dur-press) ease;
}

.sidebar.collapsed .rail-status-btn {
  width: 44px;
  height: 44px;
  padding: 0;
  margin-inline: auto;
  justify-content: center;
}

@media (hover: hover) and (pointer: fine) {
  .rail-status-btn:hover { border-color: var(--border-strong); color: var(--ink-primary); }
}

.rail-status-ico { width: 15px; height: 15px; flex: 0 0 15px; color: var(--accent-text); }
.rail-status-ico svg { width: 15px; height: 15px; display: block; }
.rail-status-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.profile-row { display: flex; align-items: center; gap: 10px; padding: 6px 6px 2px; }
.sidebar.collapsed .profile-row { justify-content: center; padding: 4px 0 0; }

.avatar-chip {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--bg-surface-3);
  border: 1px solid var(--border-strong);
  color: var(--ink-primary);
  font-size: 12px;
  font-weight: 600;
}

.profile-meta { display: flex; flex-direction: column; min-width: 0; }
.profile-name { font-size: 13px; font-weight: 600; color: var(--ink-primary); line-height: 1.2; }
.profile-role { font-size: 11.5px; color: var(--ink-muted); }

/* ==========================================================================
   Workspace Column & Single-Row Top Bar
   ========================================================================== */

.workspace-col { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.top-bar {
  position: sticky;
  top: 0;
  z-index: 25;
  min-height: 56px;
  padding: env(safe-area-inset-top) max(24px, env(safe-area-inset-right)) 0 max(24px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: nowrap;
  background: var(--bg-surface-1);
  border-bottom: 1px solid var(--border-subtle);
}

.top-bar-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 auto; }

.mobile-mark {
  display: none;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  place-items: center;
  border-radius: var(--r-md);
  background: var(--bg-inverse);
  color: var(--ink-inverse);
}

.mobile-mark svg { width: 15px; height: 19px; display: block; }
.page-head-copy { display: flex; align-items: baseline; gap: 10px; min-width: 0; flex: 1 1 auto; overflow: hidden; }

.page-head-copy h1 {
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  white-space: nowrap;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-meta {
  font-size: 12.5px;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1 1 auto;
}

.top-bar-right { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.biz-scope-bar .ua-pill { padding: 0 9px; font-size: 12px; }
.mobile-scope-row { display: none; align-items: center; justify-content: space-between; gap: 8px; }

.search-trigger {
  height: 36px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  color: var(--ink-muted);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color var(--dur-press) ease, color var(--dur-press) ease;
}

@media (hover: hover) and (pointer: fine) {
  .search-trigger:hover { border-color: var(--border-strong); color: var(--ink-primary); }
}

.kbd-chip {
  height: 20px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--r-xs);
  background: var(--bg-surface-1);
  border: 1px solid var(--border-subtle);
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: 500;
}

.theme-switch {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border-radius: var(--r-md);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  gap: 2px;
}

.theme-opt {
  height: 28px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--dur-press) ease, color var(--dur-press) ease;
}

.theme-opt.active { background: var(--bg-surface-1); color: var(--ink-primary); font-weight: 600; }

.theme-single-btn {
  display: none;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  color: var(--ink-primary);
  cursor: pointer;
}

/* ==========================================================================
   Buttons & Color-Fill Sweep
   ========================================================================== */

.ua-btn {
  --btn-bg: var(--bg-surface-1);
  --btn-ink: var(--ink-primary);
  --btn-border: var(--border-strong);
  --btn-fill-bg: var(--bg-inverse);
  --btn-fill-ink: var(--ink-inverse);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-md);
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-ink);
  padding: 0;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  transition: transform 160ms var(--ease-snappy), border-color var(--dur-base) ease;
}

.ua-btn--secondary {
  --btn-bg: var(--bg-surface-1);
  --btn-ink: var(--ink-primary);
  --btn-border: var(--border-strong);
  --btn-fill-bg: var(--bg-surface-3);
  --btn-fill-ink: var(--ink-primary);
}

.ua-btn--primary {
  --btn-bg: var(--accent-primary);
  --btn-ink: var(--accent-on);
  --btn-border: var(--accent-primary);
  --btn-fill-bg: var(--accent-hover);
  --btn-fill-ink: var(--accent-on);
}

.ua-btn__base,
.ua-btn__fill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 34px;
  padding: 0 12px;
  width: 100%;
  border-radius: calc(var(--r-md) - 1px);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ua-btn--primary .ua-btn__base,
.ua-btn--primary .ua-btn__fill { font-weight: 600; }

.ua-btn.sm .ua-btn__base,
.ua-btn.sm .ua-btn__fill { height: 30px; padding: 0 10px; font-size: 12.5px; }

.ua-btn--block { width: 100%; }

.ua-btn--sweep .ua-btn__fill {
  position: absolute;
  inset: 0;
  background: var(--btn-fill-bg);
  color: var(--btn-fill-ink);
  pointer-events: none;
  clip-path: inset(0 100% 0 0 round var(--r-md));
  transition: clip-path var(--dur-base) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .ua-btn--sweep:hover .ua-btn__fill { clip-path: inset(0 0 0 0 round var(--r-md)); }
  .ua-btn--sweep.ua-btn--primary:hover { border-color: var(--accent-hover); }
}

.ua-btn:disabled { opacity: 0.48; cursor: not-allowed; }
.ua-pressable { transition: transform 160ms var(--ease-snappy); }

.ua-btn:not(:disabled):active,
.ua-pressable:not(:disabled):active { transform: scale(var(--press-scale)); transition-duration: 90ms; }

.btn-ico { width: 15px; height: 15px; flex: 0 0 15px; display: inline-grid; place-items: center; }
.btn-ico svg, .ua-btn svg { width: 15px; height: 15px; display: block; flex: 0 0 auto; }
.cta-label-short { display: none; }

.quiet-btn {
  height: 34px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface-1);
  color: var(--ink-primary);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background-color var(--dur-press) ease, border-color var(--dur-press) ease, transform 160ms var(--ease-snappy);
}

.quiet-btn.sm { height: 30px; padding: 0 10px; }
.quiet-btn.is-active { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent-text); font-weight: 600; }
.quiet-btn.danger { color: var(--bad-text); border-color: var(--bad-border); background: var(--bad-bg); }

@media (hover: hover) and (pointer: fine) {
  .quiet-btn:hover { background: var(--bg-surface-2); }
  .quiet-btn.is-active:hover { background: var(--accent-soft); }
}

.quiet-btn:active { transform: scale(var(--press-scale)); transition-duration: 90ms; }
.quiet-btn svg { width: 14px; height: 14px; display: block; flex: 0 0 auto; }

/* ==========================================================================
   Main Viewport, Cards & Anti-Replay
   ========================================================================== */

.main-viewport {
  width: 100%;
  max-width: 1380px;
  margin-inline: auto;
  padding: 16px 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  container-type: inline-size;
  container-name: workspace;
}

.main-viewport > * { min-width: 0; }

.card {
  position: relative;
  background: var(--bg-surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.card.panel-pad { padding: 16px; }
.card-interactive { transition: border-color var(--dur-base) ease; }

@media (hover: hover) and (pointer: fine) {
  .card-interactive:hover { border-color: var(--border-strong); }
}

@media (prefers-reduced-motion: no-preference) {
  #mainViewport[data-animate="enter"] .reveal-item {
    animation: uaRevealIn var(--dur-reveal) var(--ease-wave) both;
    animation-delay: calc(min(var(--stagger, 0), 12) * var(--stagger-step));
    will-change: transform, opacity;
  }
  [data-wave="enter"] .wave-tab-item {
    animation: uaTabWaveIn var(--dur-tab-wave) var(--ease-wave) both;
    animation-delay: calc(min(var(--stagger, 0), 10) * var(--tab-stagger-step));
    will-change: transform, opacity;
  }
}

#mainViewport[data-animate="none"] .reveal-item { animation: none; will-change: auto; }

@keyframes uaRevealIn {
  from { opacity: 0; transform: translate3d(0, var(--reveal-y), 0) scale(0.972); }
  to   { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

@keyframes uaTabWaveIn {
  from { opacity: 0; transform: translate3d(0, 16px, 0) scale(0.976); }
  to   { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

/* Directional Solid Fill Pills (WebKit Dark-Mode Independent) */
.ua-pill {
  --pill-fill: var(--bg-inverse);
  --pill-fill-ink: var(--ink-inverse);
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 11px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  color: var(--ink-secondary);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  isolation: isolate;
  overflow: hidden;
  transition: color var(--dur-base) var(--ease-snappy),
              border-color var(--dur-base) var(--ease-snappy),
              background-color var(--dur-base) ease,
              transform 160ms var(--ease-snappy);
}

.ua-pill > * { position: relative; z-index: 1; }

.ua-pill::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--pill-fill);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--dur-base) var(--ease-snappy);
}

@media (hover: hover) and (pointer: fine) {
  .ua-pill:not(.on):not(.active):hover { border-color: var(--border-strong); color: var(--ink-primary); }
  .ua-pill:not(.on):not(.active):hover::before { background: var(--bg-surface-3); transform: scaleX(1); }
}

.ua-pill.on, .ua-pill.active {
  background: var(--pill-fill);
  color: var(--pill-fill-ink);
  border-color: var(--pill-fill);
  font-weight: 600;
}
.ua-pill.on::before, .ua-pill.active::before { background: var(--pill-fill); transform: scaleX(1); }
.ua-pill:active { transform: scale(var(--press-scale)); transition-duration: 90ms; }

.seg-pills {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--r-md);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
}
.seg-pills::-webkit-scrollbar { display: none; }
.panel-head > .seg-pills:first-child { flex: 0 1 auto; max-width: 100%; }

.seg-pills .ua-pill { height: auto; min-height: 28px; padding: 0 10px; border: none; border-radius: var(--r-sm); background: transparent; flex-shrink: 0; white-space: nowrap; }
.seg-pills .ua-pill.active, .seg-pills .ua-pill.on { background: var(--bg-inverse); color: var(--ink-inverse); }

[data-theme="dark"] .seg-pills .ua-pill.active,
[data-theme="dark"] .seg-pills .ua-pill.on {
  background: var(--accent-soft);
  color: var(--accent-text);
  border: 1px solid var(--accent-border);
}
[data-theme="dark"] .seg-pills .ua-pill.active::before,
[data-theme="dark"] .seg-pills .ua-pill.on::before { display: none; }

.tab-dot { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 6px; background: var(--c, var(--ink-muted)); }

.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--bg-surface-1);
  color: var(--ink-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
}

.ua-pill.on .tab-count, .ua-pill.active .tab-count { background: var(--pill-count-active-bg); color: var(--pill-fill-ink); }
[data-theme="dark"] .ua-pill.on .tab-count, [data-theme="dark"] .ua-pill.active .tab-count { background: var(--bg-surface-3); color: var(--ink-primary); }
[data-theme="dark"] .seg-pills .ua-pill.on .tab-count, [data-theme="dark"] .seg-pills .ua-pill.active .tab-count { background: var(--pill-count-active-bg); color: var(--accent-text); }

/* Status & Semantic Chips (incl. TOC 5-zone) */
.badge-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  color: var(--ink-secondary);
}

.badge-chip.st-new      { background: var(--st-new-bg);      border-color: var(--st-new-border);      color: var(--st-new-text); }
.badge-chip.st-progress { background: var(--st-progress-bg); border-color: var(--st-progress-border); color: var(--st-progress-text); }
.badge-chip.st-assembly { background: var(--st-assembly-bg); border-color: var(--st-assembly-border); color: var(--st-assembly-text); }
.badge-chip.st-delivery { background: var(--st-delivery-bg); border-color: var(--st-delivery-border); color: var(--st-delivery-text); }
.badge-chip.st-done     { background: var(--st-done-bg);     border-color: var(--st-done-border);     color: var(--st-done-text); }
.badge-chip.st-canceled { background: var(--st-canceled-bg); border-color: var(--st-canceled-border); color: var(--st-canceled-text); }
.badge-chip.pipe-csl    { background: var(--pipe-csl-bg);    border-color: var(--pipe-csl-border);    color: var(--pipe-csl-text); }
.badge-chip.pipe-part   { background: var(--pipe-part-bg);   border-color: var(--pipe-part-border);   color: var(--pipe-part-text); }
.badge-chip.ok          { background: var(--ok-bg);          border-color: var(--ok-border);          color: var(--ok-text); }
.badge-chip.warn        { background: var(--warn-bg);        border-color: var(--warn-border);        color: var(--warn-text); }
.badge-chip.bad         { background: var(--bad-bg);         border-color: var(--bad-border);         color: var(--bad-text); }
.badge-chip.info        { background: var(--info-bg);        border-color: var(--info-border);        color: var(--info-text); }
.badge-chip.toc-black   { background: var(--toc-black-bg);   border-color: var(--toc-black-border);   color: var(--toc-black-text); }
.badge-chip.toc-red     { background: var(--bad-bg);         border-color: var(--bad-border);         color: var(--bad-text); }
.badge-chip.toc-yellow  { background: var(--warn-bg);        border-color: var(--warn-border);        color: var(--warn-text); }
.badge-chip.toc-green   { background: var(--ok-bg);          border-color: var(--ok-border);          color: var(--ok-text); }
.badge-chip.toc-blue    { background: var(--info-bg);        border-color: var(--info-border);        color: var(--info-text); }

/* Confirmation Color-Fill Pulse */
.ua-confirm-target { position: relative; overflow: hidden; }
.ua-confirm-target.is-confirmed { --confirm-color: var(--ok-dot); }

.ua-confirm-target.is-confirmed::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--confirm-color);
  transform-origin: top center;
  pointer-events: none;
  z-index: 2;
  animation: uaEdgeConfirm var(--dur-pulse) var(--ease-out) forwards;
}

.ua-confirm-target.is-confirmed::after {
  content: "";
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--confirm-color) 13%, transparent);
  transform-origin: left center;
  pointer-events: none;
  z-index: 0;
  animation: uaWashConfirm var(--dur-pulse) var(--ease-out) forwards;
}

@keyframes uaEdgeConfirm {
  0%   { transform: scaleY(0); opacity: 1; }
  30%  { transform: scaleY(1); opacity: 1; }
  75%  { transform: scaleY(1); opacity: 1; }
  100% { transform: scaleY(1); opacity: 0; }
}

@keyframes uaWashConfirm {
  0%   { transform: scaleX(0); opacity: 0.9; }
  38%  { transform: scaleX(1); opacity: 0.85; }
  100% { transform: scaleX(1); opacity: 0; }
}

tr.is-confirmed td { animation: uaRowTint var(--dur-pulse) var(--ease-out) forwards; }
@keyframes uaRowTint {
  0%   { background-color: color-mix(in srgb, var(--confirm-color, var(--ok-dot)) 14%, transparent); }
  100% { background-color: transparent; }
}

/* ==========================================================================
   Dashboard: KPIs, Health Strip, Bar+Trend Chart, Calendar, Funnel, Ticks
   ========================================================================== */

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@container workspace (max-width: 960px) { .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.kpi-grid.kpi-grid--asymmetric {
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
}
.kpi-card { padding: 16px; display: flex; flex-direction: column; justify-content: space-between; gap: 10px; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-label { font-size: 12.5px; font-weight: 500; color: var(--ink-secondary); }
.kpi-ico { width: 16px; height: 16px; flex: 0 0 16px; color: var(--ink-muted); }
.kpi-ico svg { width: 16px; height: 16px; display: block; }
.kpi-value { font-size: 25px; font-weight: 600; line-height: 1.08; color: var(--ink-primary); letter-spacing: -0.025em; }
.kpi-foot { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 12px; color: var(--ink-muted); }
.kpi-foot-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.kpi-card--hero { order: -1; justify-content: space-between; gap: 12px; }
.kpi-card--hero .kpi-value { font-size: 30px; letter-spacing: -0.03em; line-height: 1.08; }
.kpi-hero-sub {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}
.kpi-hero-sub-lbl { font-size: 11.5px; color: var(--ink-muted); }
.kpi-hero-sub-val { font-size: 13px; font-weight: 600; color: var(--ink-primary); margin-top: 2px; }
.kpi-card--compact {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "top right"
    "foot right";
  align-items: center;
  gap: 4px 12px;
  padding: 12px 16px;
}
.kpi-card--compact .kpi-top { grid-area: top; min-width: 0; }
.kpi-card--compact .kpi-value { grid-area: right; font-size: 20px; text-align: right; white-space: nowrap; }
.kpi-card--compact .kpi-foot { grid-area: foot; flex-wrap: wrap; min-width: 0; }
.kpi-card--hero .kpi-foot { flex-wrap: wrap; min-width: 0; }
.kpi-trend-row { display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; }
.kpi-spark { width: 56px; height: 18px; display: block; flex: 0 0 56px; overflow: visible; }
.kpi-spark-line { fill: none; stroke: var(--accent-primary); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.kpi-spark-line.is-ok { stroke: var(--ok-dot); }
@container workspace (min-width: 821px) {
  .kpi-grid.kpi-grid--asymmetric {
    grid-template-columns: minmax(0, 1.32fr) minmax(0, 1fr);
    grid-template-rows: repeat(3, minmax(0, auto));
    grid-template-areas:
      "hero s0"
      "hero s1"
      "hero s2";
  }
  .kpi-card--hero { grid-area: hero; order: 0; }
  .kpi-card--compact:nth-child(1) { grid-area: s0; }
  .kpi-card--compact:nth-child(3) { grid-area: s1; }
  .kpi-card--compact:nth-child(4) { grid-area: s2; }
}

/* Health Strip on Dashboard linking FOP Limits + TOC Buffers */
.health-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@container workspace (max-width: 780px) { .health-strip { grid-template-columns: minmax(0, 1fr); } }

.health-dot { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 6px; background: var(--ok-dot); }
.health-dot.warn { background: var(--warn-dot); }
.health-dot.bad  { background: var(--bad-dot); }

.health-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  padding: 12px 16px;
  border-radius: var(--r-card);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-1);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--dur-press) ease;
}
@media (hover: hover) and (pointer: fine) {
  .health-card:hover { border-color: var(--border-strong); }
}
.health-card-left { display: flex; align-items: center; gap: 10px; flex: 1 1 auto; min-width: 0; }
.health-card-copy { flex: 1 1 auto; min-width: 0; }
.health-card > .badge-chip { flex-shrink: 0; }
.health-card-title { font-size: 13px; font-weight: 600; color: var(--ink-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.health-card-sub { font-size: 12px; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@container workspace (max-width: 520px) {
  .health-card { padding: 10px 12px; gap: 8px; }
  .health-card-title, .health-card-sub { white-space: normal; line-height: 1.32; }
}

.bento-grid-main { display: grid; grid-template-columns: minmax(0, 1.58fr) minmax(0, 1fr); gap: 12px; align-items: stretch; }
.bento-grid-ops  { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: stretch; }
.bento-grid-bottom { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 12px; align-items: start; }

@container workspace (max-width: 960px) {
  .bento-grid-main, .bento-grid-ops, .bento-grid-bottom { grid-template-columns: minmax(0, 1fr); }
}

.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-head > :first-child { min-width: 0; flex: 1 1 auto; }
.panel-title { font-size: 15px; line-height: 1.25; letter-spacing: -0.015em; }
.panel-sub { margin-top: 2px; font-size: 12px; color: var(--ink-muted); }

.chart-head-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Revenue Bar + Line Chart (WebKit Zero fill-box Artifact Fix) */
.chart-box { position: relative; width: 100%; }
.chart-svg { width: 100%; height: auto; display: block; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.chart-axis-text { font-family: var(--font-mono); font-size: 10.5px; fill: var(--ink-muted); }

.bar-col { transition: opacity 220ms var(--ease-wave); cursor: pointer; outline: none; }
.chart-svg.has-active .bar-col:not(.is-active) { opacity: 0.56; }
.bar-rise { transform-origin: 0 224px; }
.bar-rest { fill: var(--chart-bar-rest); stroke: var(--chart-bar-border); stroke-width: 1; transition: stroke 240ms var(--ease-wave); }
.bar-fill {
  fill: var(--chart-bar-active-bg);
  opacity: 0;
  transition: opacity 240ms var(--ease-wave);
  pointer-events: none;
}
.bar-cap { fill: var(--chart-cap-rest); transition: fill 240ms var(--ease-wave); pointer-events: none; }
.bar-col.is-active .bar-cap, .bar-col:focus-visible .bar-cap { fill: var(--accent-primary); }
.bar-col.is-active .bar-fill, .bar-col:focus-visible .bar-fill { opacity: 1; }
.bar-col.is-active .bar-rest, .bar-col:focus-visible .bar-rest { stroke: var(--accent-primary); }

.chart-guide-group {
  opacity: 0;
  pointer-events: none;
  transition: transform 300ms var(--ease-out), opacity 220ms ease;
}
.chart-guide-group.is-snap { transition: opacity 220ms ease; }
.chart-guide-group.visible { opacity: 1; }
.chart-crosshair {
  stroke: var(--ink-muted);
  stroke-opacity: 0.65;
  stroke-width: 1.3;
  stroke-dasharray: 3.5 3.5;
}
.chart-dot-group { transition: transform 300ms var(--ease-out); }
.chart-guide-group.is-snap .chart-dot-group { transition: none; }
.chart-active-dot {
  fill: var(--accent-primary);
  stroke: var(--bg-surface-1);
  stroke-width: 2.5;
}

@media (prefers-reduced-motion: no-preference) {
  .bar-rise {
    transform: scaleY(0);
    animation: uaBarRise var(--dur-bar-rise) var(--ease-out) forwards;
    animation-delay: calc(40ms + min(var(--i, 0), 10) * 32ms);
  }
  .chart-avg-line {
    clip-path: inset(0 100% 0 0);
    animation: uaAreaWipe 480ms var(--ease-out) 160ms forwards;
  }
  .chart-line {
    stroke-dasharray: 100 102;
    stroke-dashoffset: 100;
    animation: uaLineDraw var(--dur-fill-chart) var(--ease-out) 60ms forwards;
  }
  .chart-area {
    clip-path: inset(0 100% 0 0);
    animation: uaAreaWipe var(--dur-fill-chart) var(--ease-out) 100ms forwards;
  }
  .chart-dot {
    opacity: 0;
    animation: uaReducedFade 240ms var(--ease-out) forwards;
    animation-delay: calc(200ms + min(var(--i, 0), 8) * 36ms);
  }
}

@keyframes uaBarRise { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes uaLineDraw { to { stroke-dashoffset: 0; } }
@keyframes uaAreaWipe { to { clip-path: inset(0 0 0 0); } }
@keyframes uaTabFade  { from { opacity: 0; transform: translate3d(0, 4px, 0) scale(0.98); } to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); } }

.chart-dot { transition: opacity 140ms ease; }
.chart-hit { cursor: pointer; }

.chart-tooltip {
  position: absolute;
  top: 0;
  left: 0;
  padding: 8px 12px;
  border-radius: var(--r-lg);
  background: var(--bg-surface-1);
  color: var(--ink-primary);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-tooltip);
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(var(--tx, 0px), calc(var(--ty, 0px) + 6px), 0) scale(0.94);
  transform-origin: bottom center;
  transition:
    opacity 200ms var(--ease-wave),
    transform 300ms var(--ease-out);
  white-space: nowrap;
  z-index: 12;
}
[data-theme="dark"] .chart-tooltip {
  background: var(--bg-surface-2);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-tooltip);
}
.chart-tooltip.is-snap-pos { transition: opacity 200ms var(--ease-wave); }
.chart-tooltip.visible {
  opacity: 1;
  transform: translate3d(var(--tx, 0px), var(--ty, 0px), 0) scale(1);
}
.chart-tip-date { font-size: 11px; color: var(--ink-muted); font-weight: 500; transition: opacity 160ms ease; }
.chart-tip-row { display: flex; align-items: baseline; gap: 7px; }
.chart-tip-val { font-size: 15.5px; font-weight: 700; color: var(--ink-primary); letter-spacing: -0.02em; }
.chart-tip-delta {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ok-text);
}
.chart-tip-delta.is-neg { color: var(--bad-text); }

/* Rolling Odometer Digit Reels */
.odo-wrap { display: inline-flex; align-items: baseline; line-height: 1.25; }
.odo-slot {
  display: inline-block;
  height: 1.25em;
  overflow: hidden;
  vertical-align: bottom;
}
.odo-reel {
  display: flex;
  flex-direction: column;
  transform: translate3d(0, calc(var(--d, 0) * -1.25em), 0);
  transition: transform 420ms var(--ease-wave);
  transition-delay: calc(var(--di, 0) * 22ms);
  will-change: transform;
}
.odo-reel > span { display: block; height: 1.25em; line-height: 1.25em; text-align: center; }
.odo-char { display: inline-block; line-height: 1.25em; }

[data-theme="dark"] .toast-item svg { color: var(--ok-on-inverse); }

/* Compact 7-Day Calendar & Tasks */
.cal-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }

.cal-day {
  position: relative;
  min-height: 48px;
  padding: 5px 2px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  background: var(--bg-surface-2);
  color: var(--ink-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  overflow: hidden;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.cal-day__wd { font-size: 11px; color: var(--ink-muted); line-height: 1; }
.cal-day__num { font-size: 13px; font-weight: 600; color: var(--ink-primary); line-height: 1.15; }
.cal-day__dots { display: inline-flex; gap: 3px; height: 4px; }
.cal-day__dot { width: 4px; height: 4px; border-radius: 50%; background: var(--c, var(--accent-primary)); }

.cal-day.active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent-text);
}

.cal-day.active::before {
  content: "";
  position: absolute;
  top: 0; left: 5px; right: 5px;
  height: 2px;
  border-radius: 0 0 2px 2px;
  background: var(--accent-primary);
}

.cal-day.active .cal-day__wd,
.cal-day.active .cal-day__num { color: var(--accent-text); }

.task-list {
  margin-top: 12px;
  padding-top: 4px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
}

.task-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.task-row:last-child { border-bottom: 0; padding-bottom: 0; }

.task-check-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: transparent;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.task-check-box {
  width: 18px;
  height: 18px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border-strong);
  background: var(--bg-surface-1);
  color: var(--accent-on);
  display: grid;
  place-items: center;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.task-check-box svg {
  width: 12px;
  height: 12px;
  display: block;
  flex: 0 0 auto;
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
  transition: stroke-dashoffset 200ms var(--ease-snappy);
}

.task-row.is-done .task-check-box { background: var(--ok-dot); border-color: var(--ok-dot); }
.task-row.is-done .task-check-box svg { stroke-dashoffset: 0; }
.task-row.is-done .task-title { text-decoration: line-through; color: var(--ink-muted); }

.task-title { font-size: 13px; font-weight: 500; color: var(--ink-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-meta { font-size: 11.5px; color: var(--ink-muted); }

/* Lead Funnel Matrix + Repeat Orders Tick-Bar */
.funnel-list { display: flex; flex-direction: column; gap: 11px; }

.funnel-row {
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  padding: 4px 0;
  text-align: left;
  cursor: pointer;
}

.funnel-row-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 5px;
}

.funnel-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-primary);
  min-width: 0;
}

.funnel-val { font-size: 12.5px; font-weight: 600; color: var(--ink-primary); }
.funnel-pct { font-size: 12px; color: var(--ink-muted); min-width: 38px; text-align: right; }

.repeat-card-stack { display: flex; flex-direction: column; justify-content: space-between; gap: 14px; }
.repeat-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.repeat-hero { font-size: 24px; font-weight: 600; color: var(--ink-primary); line-height: 1.05; }
.cohort-btn-row { display: flex; gap: 8px; flex-wrap: wrap; font-size: 11.5px; }
.cohort-btn {
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 500;
}
@media (hover: hover) and (pointer: fine) {
  .cohort-btn:hover { background: var(--bg-surface-2); }
}

.repeat-tick-bar {
  display: grid;
  grid-template-columns: repeat(28, minmax(0, 1fr));
  gap: 3px;
  height: 26px;
  align-items: end;
}

.repeat-tick {
  height: 24px;
  border-radius: 3px;
  background: var(--tick-color, var(--bg-surface-3));
  transform-origin: center bottom;
  transition: opacity 150ms ease, transform 140ms var(--ease-snappy);
}

.repeat-tick-bar[data-active-cohort] .repeat-tick { opacity: 0.24; }
.repeat-tick-bar[data-active-cohort="repeat"] .repeat-tick[data-cohort="repeat"],
.repeat-tick-bar[data-active-cohort="vip"] .repeat-tick[data-cohort="vip"],
.repeat-tick-bar[data-active-cohort="first"] .repeat-tick[data-cohort="first"] { opacity: 1; }

@media (prefers-reduced-motion: no-preference) {
  .repeat-tick.is-filled {
    transform: scaleY(0);
    animation: uaBarRise 240ms var(--ease-out) forwards;
    animation-delay: calc(80ms + var(--ti, 0) * var(--dur-tick-step));
  }
}

/* Donut + Legend + Feed + Managers */
.donut-wrap { display: flex; align-items: center; gap: 16px; padding-top: 12px; border-top: 1px solid var(--border-subtle); }
.donut-svg-box { position: relative; width: 126px; height: 126px; flex: 0 0 126px; }
.donut-svg { width: 126px; height: 126px; display: block; }
.donut-seg { stroke-dasharray: var(--seg-len) 102; stroke-dashoffset: 0; cursor: pointer; transition: opacity 180ms ease, stroke-width 180ms var(--ease-snappy); }

@media (prefers-reduced-motion: no-preference) {
  .donut-seg {
    stroke-dashoffset: var(--seg-len);
    animation: uaDonutSweep var(--seg-dur, 240ms) var(--ease-out) var(--seg-delay, 0ms) forwards;
  }
}

@keyframes uaDonutSweep { to { stroke-dashoffset: 0; } }

.donut-wrap[data-active-seg] .donut-seg { opacity: 0.25; }
.donut-wrap[data-active-seg="0"] .donut-seg[data-seg-idx="0"],
.donut-wrap[data-active-seg="1"] .donut-seg[data-seg-idx="1"],
.donut-wrap[data-active-seg="2"] .donut-seg[data-seg-idx="2"],
.donut-wrap[data-active-seg="3"] .donut-seg[data-seg-idx="3"] { opacity: 1; stroke-width: 17; }

.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.donut-center b { font-size: 16px; font-weight: 600; line-height: 1.1; }
.donut-center span { margin-top: 2px; font-size: 11px; color: var(--ink-muted); }

.legend-list { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }

.legend-row {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding: 2px 6px;
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background-color 140ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .legend-row:hover { background: var(--bg-surface-2); }
}

.legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.legend-name { font-size: 12.5px; color: var(--ink-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-val { font-size: 12.5px; font-weight: 600; color: var(--ink-primary); }

.feed-list { display: flex; flex-direction: column; }
.feed-item { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border-subtle); }
.feed-item:first-child { padding-top: 0; }
.feed-item:last-child { border-bottom: 0; padding-bottom: 0; }
.feed-item.clickable { cursor: pointer; }

.feed-ico { width: 32px; height: 32px; border-radius: var(--r-md); display: grid; place-items: center; border: 1px solid var(--border-subtle); }
.feed-ico svg { width: 15px; height: 15px; display: block; flex: 0 0 auto; }
.feed-ico.info { background: var(--info-bg); border-color: var(--info-border); color: var(--info-text); }
.feed-ico.ok   { background: var(--ok-bg);   border-color: var(--ok-border);   color: var(--ok-text); }
.feed-ico.warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-text); }
.feed-ico.bad  { background: var(--bad-bg);  border-color: var(--bad-border);  color: var(--bad-text); }

.feed-body { min-width: 0; }
.feed-title { font-size: 13px; font-weight: 500; color: var(--ink-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-meta  { font-size: 12px; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-time  { font-size: 12px; color: var(--ink-muted); white-space: nowrap; }

.mgr-list { display: flex; flex-direction: column; gap: 14px; }
.mgr-row-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.mgr-name-col { font-size: 13px; color: var(--ink-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mgr-name-col b { font-weight: 600; }
.mgr-name-col span { font-size: 12px; color: var(--ink-muted); }

.fill-bar { position: relative; height: 7px; border-radius: 999px; background: var(--bg-surface-2); overflow: hidden; }
.fill-bar__inner { width: var(--pct, 0%); height: 100%; border-radius: 999px; background: var(--bar-color, var(--accent-primary)); transform-origin: left center; }

@media (prefers-reduced-motion: no-preference) {
  .fill-bar__inner {
    transform: scaleX(0);
    animation: uaBarFill var(--dur-fill-bar) var(--ease-out) forwards;
    animation-delay: calc(80ms + min(var(--bar-i, 0), 5) * 55ms);
  }
}

@keyframes uaBarFill { to { transform: scaleX(1); } }

/* ==========================================================================
   Orders Screen & Sticky Totals Footer + Online KP
   ========================================================================== */

.status-bar-scroll { display: flex; align-items: center; gap: 6px; overflow-x: auto; padding-bottom: 12px; border-bottom: 1px solid var(--border-subtle); scrollbar-width: none; }
.status-bar-scroll::-webkit-scrollbar { display: none; }
.tab-sep { width: 1px; height: 20px; background: var(--border-strong); flex: 0 0 1px; margin-inline: 2px; }
.orders-controls { margin-top: 12px; display: grid; grid-template-columns: minmax(220px, 1fr) 150px 150px auto auto; gap: 8px; align-items: center; }
.search-field { position: relative; display: flex; align-items: center; }
.search-field svg { position: absolute; left: 11px; width: 15px; height: 15px; color: var(--ink-muted); pointer-events: none; }

.crm-input, .crm-select {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-input);
  background: var(--bg-surface-1);
  color: var(--ink-primary);
  font-size: 13px;
  transition: border-color var(--dur-press) ease;
}

.crm-textarea {
  width: 100%;
  min-height: 76px;
  padding: 8px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-input);
  background: var(--bg-surface-1);
  color: var(--ink-primary);
  font-size: 13px;
  resize: vertical;
}

.crm-input:focus-visible, .crm-select:focus-visible, .crm-textarea:focus-visible { border-color: var(--accent-primary); }
.crm-input.is-invalid, .crm-select.is-invalid, .crm-textarea.is-invalid { border-color: var(--bad-dot); }
.field-error { display: block; margin-top: 4px; font-size: 12px; color: var(--bad-text); line-height: 1.35; }

.search-field .crm-input { padding-left: 34px; }
.crm-input::placeholder, .crm-textarea::placeholder { color: var(--ink-muted); opacity: 1; }
.orders-count-note { font-size: 12px; color: var(--ink-muted); white-space: nowrap; }
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.crm-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.desktop-orders-card .crm-table { min-width: 980px; }
.table-wrap--sticky { max-height: 540px; overflow: auto; }

.crm-table th {
  height: 38px;
  padding: 0 12px;
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-muted);
  background: var(--bg-surface-2);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}
.table-wrap--sticky .crm-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--bg-surface-2);
}
.crm-table .col-sticky-chk {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--bg-surface-1);
}
.crm-table thead th.col-sticky-chk { z-index: 4; background: var(--bg-surface-2); }
.crm-table .col-sticky-id {
  position: sticky;
  left: 40px;
  z-index: 2;
  background: var(--bg-surface-1);
  border-right: 1px solid var(--border-subtle);
}
.crm-table thead th.col-sticky-id { z-index: 4; background: var(--bg-surface-2); }

.crm-table td { padding: 4px 12px; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.crm-table td .ord-id { line-height: 1.25; }
.crm-table td .sub-txt { margin-top: 1px; line-height: 1.2; }

/* 3-Mode Row Density: Compact 40px | Default 48px | Comfortable 56px */
.crm-table--dense-compact tbody tr { height: 40px; }
.crm-table--dense-compact td { padding: 3px 10px; }
.crm-table--dense-compact td .sub-txt { display: none; }
.crm-table--dense-default tbody tr { height: 48px; }
.crm-table--dense-default td { padding: 4px 12px; }
.crm-table--dense-comfortable tbody tr { height: 56px; }
.crm-table--dense-comfortable td { padding: 8px 12px; }

/* Cells: single-line trunc + title tooltip; numeric never truncates; dash for empty */
.cell-trunc { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.cell-num { white-space: nowrap; overflow: visible; text-overflow: clip; font-variant-numeric: lining-nums tabular-nums; }
.crm-table td.col-right, .crm-table th.col-right { overflow: visible; }
.cell-empty { color: var(--ink-disabled); font-family: var(--font-mono); }
.crm-table--wide-zebra tbody tr:nth-child(even) td { background: var(--bg-surface-2); }

/* Sortable Headers (active arrow only) & Hover-Reveal Row Actions */
.th-sort-btn { display: inline-flex; align-items: center; gap: 4px; border: none; background: transparent; padding: 0; color: inherit; font: inherit; cursor: pointer; white-space: nowrap; }
.th-sort-btn.is-active { color: var(--ink-primary); font-weight: 600; }
.th-sort-arrow { font-family: var(--font-mono); font-size: 11px; color: var(--accent-text); }

.row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease;
}
.crm-table tbody tr:hover .row-actions,
.crm-table tbody tr:focus-within .row-actions { opacity: 1; pointer-events: auto; }

.row-act-btn {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-1);
  color: var(--ink-secondary);
  cursor: pointer;
  padding: 0;
  flex: 0 0 28px;
}
.row-act-btn--touch { display: none; }
@media (hover: hover) and (pointer: fine) {
  .row-act-btn:hover { border-color: var(--border-strong); color: var(--ink-primary); background: var(--bg-surface-2); }
}
@media (hover: none), (pointer: coarse) {
  .row-actions { opacity: 1; pointer-events: auto; }
  .row-act-btn--hover-only { display: none; }
  .row-act-btn--touch { display: grid; min-width: 44px; min-height: 44px; }
  .ua-btn .ua-btn__base, .ua-btn .ua-btn__fill { min-height: 44px; height: auto; }
  .quiet-btn:not(.row-act-btn) { min-height: 44px; }
  .kc-move-btn, .kc-expand-btn, .icon-close-btn, .action-center-btn, .search-trigger, .card-more-btn { min-width: 44px; min-height: 44px; }
  .toast-undo-btn, .copy-inline-btn { min-height: 44px; }
}
.crm-table tbody tr:last-child td { border-bottom: 0; }
.crm-table tbody tr[data-open-order],
.crm-table tbody tr[data-open-kp],
.crm-table tbody tr[data-toc-sku],
.crm-table tbody tr[data-dbr-id] { cursor: pointer; }
@media (hover: hover) and (pointer: fine) {
  .crm-table tbody tr[data-open-order]:hover td,
  .crm-table tbody tr[data-open-kp]:hover td,
  .crm-table tbody tr[data-toc-sku]:hover td,
  .crm-table tbody tr[data-dbr-id]:hover td { background: var(--row-hover); }
}
.crm-table th.col-right, .crm-table td.col-right { text-align: right; white-space: nowrap; }

.row-stage-border { border-left: 3px solid var(--row-stripe, transparent); }

.totals-footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  font-size: 12.5px;
  color: var(--ink-secondary);
}

.ord-id { font-size: 13px; font-weight: 600; color: var(--ink-primary); }
.sub-txt { margin-top: 2px; font-size: 12px; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ellipsis-cell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.orders-results-wrap {
  container-type: inline-size;
  container-name: orders-table;
  width: 100%;
  min-width: 0;
}
.orders-mobile-sort {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.orders-mobile-sort .crm-select { flex: 0 0 auto; width: auto; min-width: 176px; }

.mobile-orders-list { display: none; flex-direction: column; gap: 8px; }
.mobile-order-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  min-height: 72px;
  padding: 10px 12px;
  border-radius: var(--r-card);
  background: var(--bg-surface-1);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--card-stripe, var(--border-subtle));
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.mo-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.mo-top > div { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mo-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 8px; border-top: 1px solid var(--border-subtle); }
.mo-row-1, .mo-row-2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.mo-ident { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto; overflow: hidden; }
.mo-name { font-size: 13.5px; font-weight: 600; color: var(--ink-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mo-sum { font-size: 13.5px; font-weight: 600; color: var(--ink-primary); white-space: nowrap; flex: 0 0 auto; }
.mo-meta { display: inline-flex; align-items: center; gap: 6px; min-width: 0; flex: 1 1 auto; overflow: hidden; font-size: 12px; color: var(--ink-muted); }
.mo-date-lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mobile-order-card .row-check-wrap { width: 30px; height: 30px; position: relative; }
.mobile-order-card .row-check-wrap::after { content: ""; position: absolute; inset: -7px; }
.mo-expand-btn {
  position: relative;
  height: 28px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  color: var(--ink-secondary);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  flex: 0 0 auto;
}
.mo-expand-btn::after { content: ""; position: absolute; inset: -8px -6px; }
.mo-inline-extra {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 8px;
  padding-top: 8px;
  margin-top: 2px;
  border-top: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--ink-secondary);
}
@container orders-table (max-width: 700px) {
  .desktop-orders-card { display: none !important; }
  .mobile-orders-list { display: flex; }
  .orders-mobile-sort { display: flex; }
}

/* ==========================================================================
   Multi-Kanban v4 (3px Stage Stripe + Folded/Expanded Card + Filter Popover)
   ========================================================================== */

.kanban-header-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; max-width: 100%; }
.kanban-header-controls .seg-pills { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.kanban-header-controls .seg-pills::-webkit-scrollbar { display: none; }
.kanban-active-filters { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border-subtle); }

.kanban-board-scroll {
  display: grid;
  grid-template-columns: repeat(var(--col-count, 5), minmax(216px, 1fr));
  gap: 12px;
  align-items: start;
  max-width: 100%;
  overflow-x: auto;
  padding-bottom: 8px;
}

.kanban-board-scroll.many-cols {
  display: flex;
  scroll-snap-type: x proximity;
}

.kanban-board-scroll.many-cols .kanban-col {
  flex: 0 0 250px;
  scroll-snap-align: start;
}

.kanban-col {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-card);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 240px;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.kanban-col.drag-over { border-color: var(--accent-primary); background: var(--accent-soft); }

.kanban-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 2px 8px;
  border-bottom: 1px solid var(--border-subtle);
}
.kanban-col-head > div { min-width: 0; flex: 1 1 auto; }

.kanban-col-title { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--ink-primary); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kanban-col-sum { margin-top: 2px; font-size: 12px; color: var(--ink-muted); }

.kanban-col.is-wip-limit .kanban-col-head { background: var(--warn-bg); border-radius: var(--r-md); padding: 6px 8px; border-bottom-color: var(--warn-border); }
.kanban-wip-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px; border-radius: var(--r-sm); font-size: 11px; font-weight: 600; background: var(--bg-surface-1); color: var(--ink-secondary); border: 1px solid var(--border-subtle); white-space: nowrap; }
.kanban-wip-badge.is-at-limit { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-text); }
.kanban-wip-badge svg { width: 12px; height: 12px; display: block; flex: 0 0 12px; }
.kanban-col.is-collapsed { flex: 0 0 48px !important; min-width: 48px; width: 48px; padding: 10px 6px; align-items: center; justify-content: flex-start; cursor: pointer; }
.kanban-col.is-collapsed .kanban-col-head { border-bottom: 0; padding: 0; flex-direction: column; width: 100%; align-items: center; }
.kanban-col.is-collapsed .kanban-collapsed-label { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 12px; font-weight: 600; color: var(--ink-secondary); white-space: nowrap; margin-top: 8px; }
.kanban-drop-slot { border: 1.5px dashed var(--accent-primary); border-radius: var(--r-lg); background: var(--accent-soft); box-sizing: border-box; transition: height 140ms var(--ease-out); }
.kanban-card.is-dragging { transform: scale(1.03) rotate(3deg); background: var(--bg-surface-3); border-color: var(--accent-primary); z-index: 10; }
.kanban-swim-head { grid-column: 1 / -1; width: 100%; padding: 8px 12px; border-radius: var(--r-md); background: var(--bg-surface-2); border: 1px solid var(--border-subtle); font-size: 12px; font-weight: 600; color: var(--ink-secondary); display: flex; align-items: center; justify-content: space-between; }

.kanban-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: var(--r-lg);
  background: var(--bg-surface-1);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--card-stripe, var(--border-strong));
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms var(--ease-snappy);
}

@media (hover: hover) and (pointer: fine) {
  .kanban-card:hover { border-color: var(--border-strong); }
}

.kc-top, .kc-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.kc-top-right { display: inline-flex; align-items: center; gap: 5px; }
.kc-val-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kc-val-pill { padding: 2px 7px; border-radius: var(--r-sm); background: var(--bg-surface-2); border: 1px solid var(--border-subtle); font-size: 12px; font-weight: 600; color: var(--ink-primary); white-space: nowrap; }

.kc-ready-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; font-size: 11px; color: var(--ink-muted); }
.kc-ready-track { height: 4px; border-radius: 999px; background: var(--bg-surface-2); overflow: hidden; }
.kc-ready-fill { height: 100%; width: var(--pct, 0%); border-radius: 999px; background: var(--prog-color, var(--accent-primary)); }

.kc-expand-panel {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 7px 8px;
  border-radius: var(--r-sm);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  font-size: 11.5px;
  color: var(--ink-secondary);
}

.kc-foot { padding-top: 7px; border-top: 1px solid var(--border-subtle); }
.kc-meta-cluster { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--ink-muted); min-width: 0; }
.kc-stat { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.kc-stat svg { width: 12px; height: 12px; display: block; flex: 0 0 auto; }
.kc-stat.sla-warn { color: var(--bad-text); font-weight: 600; }

.kc-mgr-pill { height: 22px; padding: 0 6px; display: inline-flex; align-items: center; border-radius: var(--r-xs); background: var(--bg-surface-2); color: var(--ink-secondary); font-size: 11px; font-weight: 600; }

.kc-move-btn {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface-1);
  color: var(--ink-primary);
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color var(--dur-press) ease, border-color var(--dur-press) ease, transform 160ms var(--ease-snappy);
}

@media (hover: hover) and (pointer: fine) {
  .kc-move-btn:hover { background: var(--bg-surface-2); border-color: var(--accent-primary); color: var(--accent-text); }
}

.kc-move-btn svg { width: 14px; height: 14px; display: block; flex: 0 0 auto; }

/* Stage Color Swatches (+ Новий етап) */
.swatch-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 460px) { .swatch-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; } }

.swatch-cell { display: grid; place-items: center; min-height: 44px; }
.swatch-btn {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--swatch-border);
  background: var(--swatch-color);
  color: var(--swatch-ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  transition: transform 140ms var(--ease-snappy);
}

.swatch-btn svg { width: 14px; height: 14px; opacity: 0; transform: scale(0.6); transition: opacity 140ms ease, transform 140ms var(--ease-snappy); }
.swatch-btn.is-selected { outline: 2px solid var(--ink-primary); outline-offset: 2px; }
.swatch-btn.is-selected svg { opacity: 1; transform: scale(1); }

/* ==========================================================================
   Root Popover Portal (#popoverRoot)
   ========================================================================== */

.ua-popover {
  position: fixed;
  z-index: 150;
  width: 320px;
  max-width: calc(100vw - 24px);
  max-height: calc(var(--vv-h, 100dvh) - 24px);
  overflow-y: auto;
  padding: 12px;
  border-radius: var(--r-card);
  background: var(--bg-surface-1);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sheet);
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: uaTabFade 150ms var(--ease-out) both;
}

.ua-popover--menu { width: 224px; padding: 6px; gap: 3px; }
.pop-label { font-size: 11.5px; font-weight: 600; color: var(--ink-secondary); margin-bottom: 6px; }
.pop-chip-row { display: flex; flex-wrap: wrap; gap: 6px; }

.pop-menu-item {
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  border: none;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--ink-primary);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  text-align: left;
  transition: background-color 120ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .pop-menu-item:hover { background: var(--bg-surface-2); }
}

.pop-menu-item-left { display: inline-flex; align-items: center; gap: 8px; }
.pop-menu-item svg { width: 15px; height: 15px; color: var(--accent-text); flex: 0 0 15px; display: block; }

/* ==========================================================================
   Chats & Clients B2B / B2C
   ========================================================================== */

.chats-shell { display: grid; grid-template-columns: 316px minmax(0, 1fr); gap: 12px; height: calc(100dvh - 104px); min-height: 500px; max-height: 780px; }
.chat-pane { display: flex; flex-direction: column; min-height: 0; }
.chat-list-head { padding: 14px; border-bottom: 1px solid var(--border-subtle); display: flex; flex-direction: column; gap: 10px; }
.channel-chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.channel-chips::-webkit-scrollbar { display: none; }
.channel-chips .ua-pill { height: 28px; padding: 0 9px; font-size: 12px; }
.chat-threads { flex: 1 1 auto; overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 2px; }

.thread-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 62px;
  padding: 9px 10px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background-color 140ms ease, border-color 140ms ease;
}

@media (hover: hover) and (pointer: fine) { .thread-row:hover { background: var(--bg-surface-2); } }
.thread-row.active { background: var(--bg-surface-2); border-color: var(--border-subtle); }
.thread-row.active::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 2px 2px 0; background: var(--accent-primary); }

.thread-av { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 999px; display: grid; place-items: center; font-size: 12px; font-weight: 600; border: 1px solid transparent; }
.thread-av.tone-plum { background: var(--pipe-csl-bg); border-color: var(--pipe-csl-border); color: var(--pipe-csl-text); }
.thread-av.tone-info { background: var(--info-bg); border-color: var(--info-border); color: var(--info-text); }
.thread-av.tone-ok   { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok-text); }
.thread-av.tone-teal { background: var(--st-delivery-bg); border-color: var(--st-delivery-border); color: var(--st-delivery-text); }
.thread-av.tone-warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-text); }

.thread-body { flex: 1 1 auto; min-width: 0; }
.thread-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.thread-name { font-size: 13.5px; font-weight: 600; color: var(--ink-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-prev { margin-top: 2px; font-size: 12px; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chat-main-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 58px; padding: 10px 14px; border-bottom: 1px solid var(--border-subtle); }
.chat-main-head > :first-child { min-width: 0; flex: 1 1 auto; }
.chat-back-btn { display: none; align-items: center; justify-content: center; gap: 4px; min-width: 44px; height: 44px; padding: 0 10px; border-radius: var(--r-md); border: 1px solid var(--border-subtle); background: var(--bg-surface-2); color: var(--ink-primary); font-size: 13px; font-weight: 500; cursor: pointer; flex: 0 0 auto; }
.chat-back-btn svg { width: 16px; height: 16px; display: block; flex: 0 0 auto; }

.order-ctx-chip { height: 34px; padding: 0 10px; display: inline-flex; align-items: center; gap: 7px; border-radius: var(--r-md); border: 1px solid var(--border-strong); background: var(--bg-surface-2); color: var(--ink-primary); font-size: 12.5px; font-weight: 500; cursor: pointer; white-space: nowrap; flex: 0 0 auto; transition: border-color var(--dur-press) ease, background-color var(--dur-press) ease; }
@media (hover: hover) and (pointer: fine) { .order-ctx-chip:hover { border-color: var(--accent-primary); background: var(--accent-soft); color: var(--accent-text); } }
.order-ctx-chip svg { width: 14px; height: 14px; display: block; flex: 0 0 auto; }

.chat-messages { flex: 1 1 auto; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg-bubble { max-width: 82%; padding: 10px 13px; font-size: 13.5px; line-height: 1.45; }
.msg-bubble.in  { align-self: flex-start; background: var(--bg-surface-2); border: 1px solid var(--border-subtle); color: var(--ink-primary); border-radius: 12px 12px 12px 4px; }
.msg-bubble.out { align-self: flex-end; background: var(--bg-inverse); color: var(--ink-inverse); border-radius: 12px 12px 4px 12px; }
.msg-bubble.msg-enter { animation: uaMsgIn 180ms var(--ease-out) both; }
@keyframes uaMsgIn { from { opacity: 0; transform: translate3d(0, 6px, 0); } to { opacity: 1; transform: translate3d(0, 0, 0); } }
.msg-time { margin-top: 4px; font-size: 11px; opacity: 0.72; text-align: right; }

.ai-bar { margin: 0 12px 8px; padding: 10px 12px; border-radius: var(--r-lg); background: var(--bg-surface-2); border: 1px solid var(--border-subtle); display: flex; flex-direction: column; gap: 6px; }
.ai-bar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ai-bar-title { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--accent-text); }
.ai-bar-title svg { width: 14px; height: 14px; display: block; flex: 0 0 auto; }
.ai-bar-text { font-size: 12.5px; line-height: 1.4; color: var(--ink-secondary); }
.ai-bar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chat-composer { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border-subtle); }
.chat-composer .crm-input { min-width: 0; flex: 1 1 auto; }
.chat-composer .quiet-btn { flex: 0 0 auto; }
#aiFlowForm .quiet-btn { width: 40px; height: 40px; padding: 0; }

/* B2B Risk Banner */
.risk-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-lg);
  border: 1px solid var(--ok-border);
  background: var(--ok-bg);
  color: var(--ok-text);
  font-size: 12.5px;
  flex-wrap: wrap;
}
.risk-banner.warn { border-color: var(--warn-border); background: var(--warn-bg); color: var(--warn-text); }
.risk-banner.bad  { border-color: var(--bad-border);  background: var(--bad-bg);  color: var(--bad-text); }

/* ==========================================================================
   Automation & AI v4 (Scenarios, Node Inspector, If/Else Branching)
   ========================================================================== */

.auto-mobile-tabs { display: none; }
.auto-scenario-strip { display: flex; align-items: center; gap: 6px; overflow-x: auto; padding-bottom: 10px; border-bottom: 1px solid var(--border-subtle); scrollbar-width: none; }
.auto-scenario-strip::-webkit-scrollbar { display: none; }

.auto-shell {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 12px;
  height: calc(100dvh - 210px);
  min-height: 520px;
  max-height: 820px;
}

.flow-pane { display: flex; flex-direction: column; min-height: 0; }
.flow-pane-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 52px; padding: 10px 14px; border-bottom: 1px solid var(--border-subtle); background: var(--bg-surface-1); }
.flow-pane-head > :first-child { min-width: 0; flex: 1 1 auto; }

.flow-test-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  font-size: 12px;
}
.flow-test-field { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-secondary); }
.flow-test-field .crm-input { width: 88px; height: 30px; padding: 0 8px; font-size: 12px; }

.flow-prompts { padding: 8px 12px 0; display: flex; flex-wrap: wrap; gap: 6px; }
.flow-prompt-chip {
  min-height: 28px;
  padding: 4px 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  color: var(--ink-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease;
}
@media (hover: hover) and (pointer: fine) {
  .flow-prompt-chip:hover { border-color: var(--accent-primary); background: var(--accent-soft); color: var(--accent-text); }
}

.flow-canvas {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--flow-canvas-bg);
}

.flow-canvas-inner {
  position: relative;
  min-height: 100%;
  padding: 20px 14px 32px;
}

.flow-dot-grid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.flow-spine {
  position: relative;
  z-index: 1;
  width: min(100%, 660px);
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.flow-node {
  position: relative;
  width: min(100%, 400px);
  padding: 12px 14px;
  border-radius: var(--r-card);
  background: var(--bg-surface-1);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  overflow: hidden;
  text-align: left;
  transition: border-color 180ms ease, opacity 200ms ease;
}

.flow-node[data-node-status="running"] { border-color: var(--accent-primary); }
.flow-node[data-node-status="passed"]  { border-color: var(--ok-dot); }
.flow-node[data-node-status="skipped"] { opacity: 0.45; }
.flow-node.is-selected { border-color: var(--accent-primary); outline: 2px solid var(--accent-ring); outline-offset: 1px; }

.flow-node-top {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.flow-node-ico {
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  display: grid;
  place-items: center;
}

.flow-node-ico svg { width: 16px; height: 16px; display: block; flex: 0 0 auto; }
.flow-node-ico.tone-info     { background: var(--info-bg);        border-color: var(--info-border);        color: var(--info-text); }
.flow-node-ico.tone-plum     { background: var(--pipe-csl-bg);    border-color: var(--pipe-csl-border);    color: var(--pipe-csl-text); }
.flow-node-ico.tone-warn     { background: var(--warn-bg);        border-color: var(--warn-border);        color: var(--warn-text); }
.flow-node-ico.tone-delivery { background: var(--st-delivery-bg); border-color: var(--st-delivery-border); color: var(--st-delivery-text); }
.flow-node-ico.tone-ok       { background: var(--ok-bg);          border-color: var(--ok-border);          color: var(--ok-text); }

.flow-node-kind { font-size: 10.5px; color: var(--ink-muted); letter-spacing: 0.04em; text-transform: uppercase; }
.flow-node-title { font-size: 13.5px; font-weight: 600; color: var(--ink-primary); margin-top: 1px; }
.flow-node-sub { font-size: 12px; color: var(--ink-secondary); margin-top: 2px; }

.flow-node-result {
  padding: 6px 9px;
  border-radius: var(--r-sm);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  font-size: 11.5px;
  color: var(--ink-secondary);
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.flow-connector {
  position: relative;
  width: 44px;
  height: 30px;
  display: grid;
  place-items: center;
}

.flow-connector-line {
  width: 2px;
  height: 100%;
  background: var(--border-strong);
  transition: background-color 220ms ease;
}

.flow-connector.is-passed .flow-connector-line { background: var(--ok-dot); }

/* If / Else Split Branching (Desktop 2-col SVG rails, Mobile Tabs) */
.branch-svg-split { width: 100%; height: 28px; display: block; overflow: visible; }
.branch-mobile-tabs { display: none; width: min(100%, 400px); margin-bottom: 10px; }

.branch-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.branch-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 10px;
  border-radius: var(--r-card);
  border: 1px dashed var(--border-strong);
  background: color-mix(in srgb, var(--bg-surface-1) 60%, transparent);
  transition: opacity 200ms ease, border-color 200ms ease;
}
.branch-col.is-active-branch { border-style: solid; border-color: var(--ok-dot); }
.branch-col.is-skipped { opacity: 0.44; }
.branch-col .flow-node { width: 100%; }

.branch-col-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.flow-add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface-1);
  color: var(--ink-primary);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .flow-add-btn:hover { border-color: var(--accent-primary); background: var(--accent-soft); color: var(--accent-text); }
}

.flow-add-btn svg { width: 14px; height: 14px; display: block; flex: 0 0 auto; }

/* Knowledge Base Source Grid & Uploader */
.kb-source-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

.kb-source-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 76px;
  padding: 12px;
  border-radius: var(--r-card);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  color: var(--ink-primary);
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease;
}
.kb-source-card > span:last-child { min-width: 0; flex: 1 1 auto; display: block; }

@media (hover: hover) and (pointer: fine) {
  .kb-source-card:hover { border-color: var(--accent-primary); background: var(--accent-soft); }
}

.kb-source-ico {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-1);
  color: var(--accent-text);
  display: grid;
  place-items: center;
}
.kb-source-ico svg { width: 16px; height: 16px; display: block; }

.kb-dropzone {
  padding: 16px;
  border-radius: var(--r-card);
  border: 1.5px dashed var(--border-strong);
  background: var(--bg-surface-2);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.kb-dropzone .sub-txt { white-space: normal; max-width: 100%; }

.upload-list { display: flex; flex-direction: column; gap: 10px; }
.upload-row { padding: 10px 12px; border-radius: var(--r-lg); border: 1px solid var(--border-subtle); background: var(--bg-surface-1); display: flex; flex-direction: column; gap: 7px; }
.upload-row-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.upload-bar-fill { width: 100%; height: 100%; border-radius: 999px; background: var(--accent-primary); transform-origin: left center; transform: scaleX(var(--p, 0)); transition: transform 140ms var(--ease-out), background-color 240ms ease; }
.upload-row.is-done .upload-bar-fill { background: var(--ok-dot); }

/* ==========================================================================
   TOC Module (DDMRP Buffers + DBR Production Bottleneck)
   ========================================================================== */

.toc-zone-bar {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  display: flex;
}
.toc-zone-seg { height: 100%; }
.toc-zone-seg.z-red    { background: var(--bad-bg); width: 33%; }
.toc-zone-seg.z-yellow { background: var(--warn-bg); width: 33%; }
.toc-zone-seg.z-green  { background: var(--ok-bg); width: 34%; }
.toc-flow-marker {
  position: absolute;
  top: 1px; bottom: 1px; left: 0;
  width: var(--p, 40%);
  max-width: 100%;
  background: var(--marker-color, var(--accent-primary));
  border-radius: 999px;
}

.toc-batch-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
}

.dbr-bottleneck-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 12px; }
@container workspace (max-width: 900px) { .dbr-bottleneck-grid { grid-template-columns: minmax(0, 1fr); } }

.heat-strip-10 { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; }
@container workspace (max-width: 560px) { .heat-strip-10 { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; } }
.heat-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 2px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  font-size: 11px;
}
.heat-cell.is-over { background: var(--bad-bg); border-color: var(--bad-border); color: var(--bad-text); font-weight: 600; }
.heat-cell.is-near { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-text); }

/* ==========================================================================
   Settings, Multi-FOP, Banks/PRRO & Connectors Catalog (v4.0)
   ========================================================================== */

.fop-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@container workspace (max-width: 1040px) { .fop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container workspace (max-width: 680px)  { .fop-grid { grid-template-columns: minmax(0, 1fr); } }

.fop-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.fop-card.is-active-entity { border-color: var(--accent-primary); }

.fop-limit-track { height: 8px; border-radius: 999px; background: var(--bg-surface-2); overflow: hidden; }
.fop-limit-fill { height: 100%; width: var(--pct, 0%); border-radius: 999px; background: var(--fop-color, var(--ok-dot)); transition: width 260ms var(--ease-out); }

.connector-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@container workspace (max-width: 1040px) { .connector-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container workspace (max-width: 680px)  { .connector-grid { grid-template-columns: minmax(0, 1fr); } }

.connector-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  padding: 14px;
  text-align: left;
  cursor: pointer;
}
.connector-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.connector-meta-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--ink-muted); padding-top: 8px; border-top: 1px solid var(--border-subtle); }

.rule-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 12px;
  min-width: 0;
  max-width: 100%;
  padding: 10px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
}
.rule-row > :first-child { min-width: 0; flex: 1 1 200px; }
.rule-row .sub-txt,
.fop-card .sub-txt,
.connector-card .sub-txt,
.flow-pane-head .sub-txt {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
  line-height: 1.38;
}

/* ==========================================================================
   Finance
   ========================================================================== */

.finance-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
@container workspace (max-width: 1200px) { .finance-grid { grid-template-columns: minmax(0, 1fr); } }
.finance-grid .crm-table { min-width: 520px; }
.amt-in { color: var(--ok-text); font-weight: 600; }
.amt-out { color: var(--ink-primary); font-weight: 600; }
.finance-ledger-wrap { container-type: inline-size; container-name: fin-table; width: 100%; min-width: 0; }
.mobile-ledger-list { display: none; flex-direction: column; }
@container fin-table (max-width: 480px) {
  .desktop-ledger-wrap { display: none !important; }
  .mobile-ledger-list { display: flex; }
}
.ledger-mobile-row { padding: 11px 0; border-bottom: 1px solid var(--border-subtle); display: flex; flex-direction: column; gap: 5px; }
.ledger-mobile-row:first-child { padding-top: 0; }
.ledger-mobile-row:last-child { border-bottom: 0; padding-bottom: 0; }
.ledger-m-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.ledger-m-line > :first-child { min-width: 0; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ledger-m-line > :last-child { flex: 0 0 auto; white-space: nowrap; }
.link-order-btn { border: none; background: transparent; padding: 0; color: var(--accent-text); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

/* ==========================================================================
   Sheets, Order Inspector Tabs, Gantt Timeline & Logs/JSON
   ========================================================================== */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: var(--bg-scrim);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  touch-action: none;
  overscroll-behavior: contain;
  transition: opacity var(--dur-sheet-exit) ease, visibility 0s linear var(--dur-sheet-exit);
}

.sheet-backdrop.open { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity var(--dur-sheet) var(--ease-out), visibility 0s linear 0s; }
.sheet-backdrop.is-dragging { transition: none !important; }

.sheet-panel {
  position: fixed;
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overscroll-behavior: contain;
  touch-action: none;
  background: var(--bg-surface-1);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sheet);
  visibility: hidden;
  pointer-events: none;
  transition: transform var(--dur-sheet-exit) var(--ease-sheet), opacity var(--dur-sheet-exit) ease, visibility 0s linear var(--dur-sheet-exit);
}

.sheet-panel.open { visibility: visible; pointer-events: auto; transition: transform var(--dur-sheet) var(--ease-sheet), opacity var(--dur-sheet) var(--ease-out), visibility 0s linear 0s; }
.sheet-panel.is-dragging { transition: none !important; will-change: transform; }

.sheet-panel--drawer { top: 12px; right: 12px; bottom: 12px; width: clamp(320px, 34vw, 40vw); max-width: calc(100vw - 24px); border-radius: var(--r-sheet); transform: translate3d(calc(100% + 20px), 0, 0); }
.sheet-panel--drawer.open { transform: translate3d(0, 0, 0); }

.sheet-panel--modal { top: 50%; left: 50%; width: 468px; max-width: calc(100vw - 24px); max-height: min(86svh, 700px); border-radius: var(--r-sheet); opacity: 0; transform: translate3d(-50%, -48%, 0) scale(0.96); }
.sheet-panel--modal.sheet-panel--wide { width: 580px; }
.sheet-panel--modal.open { opacity: 1; transform: translate3d(-50%, -50%, 0) scale(1); }

.sheet-grab-zone { display: none; flex: 0 0 auto; align-items: center; justify-content: center; padding: 10px 0 4px; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.sheet-grab-pill { width: 38px; height: 4px; border-radius: 999px; background: var(--border-strong); transition: width 160ms var(--ease-snappy), background-color 160ms ease; }
.sheet-panel.is-dragging .sheet-grab-pill { width: 48px; background: var(--ink-muted); }

.sheet-head { flex: 0 0 auto; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 20px 12px; border-bottom: 1px solid var(--border-subtle); touch-action: none; user-select: none; }
.sheet-head > :first-child { min-width: 0; flex: 1 1 auto; }
.sheet-title-row { display: flex; align-items: center; gap: 8px; margin-top: 3px; flex-wrap: wrap; }
.sheet-title { font-size: 18px; line-height: 1.2; }

.icon-close-btn { width: 36px; height: 36px; flex: 0 0 36px; display: grid; place-items: center; border-radius: var(--r-md); border: 1px solid var(--border-subtle); background: var(--bg-surface-2); color: var(--ink-primary); cursor: pointer; }
.icon-close-btn svg { width: 16px; height: 16px; display: block; flex: 0 0 auto; }

.drawer-tabs {
  position: relative;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 0 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface-1);
  touch-action: none;
}

.drawer-tab {
  height: 40px;
  border: none;
  background: transparent;
  color: var(--ink-secondary);
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color 150ms ease, border-color 150ms ease;
}

.drawer-tab.active { color: var(--accent-text); font-weight: 600; border-bottom-color: var(--accent-primary); }

.sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: 16px 20px calc(20px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sheet-body > * { min-width: 0; max-width: 100%; }
.sheet-section, .qr-preview-box { flex: 0 0 auto; }
.sheet-section { padding-bottom: 16px; border-bottom: 1px solid var(--border-subtle); display: flex; flex-direction: column; gap: 8px; }
.sheet-section:last-child { padding-bottom: 0; border-bottom: 0; }

.sheet-footer { flex: 0 0 auto; padding: 12px 20px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border-subtle); background: var(--bg-surface-1); touch-action: none; display: flex; flex-direction: column; gap: 8px; }
.sheet-footer-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

.next-action-banner > div { min-width: 0; max-width: 100%; }
.next-action-banner {
  flex: 0 0 auto;
  padding: 11px 12px;
  border-radius: var(--r-lg);
  border: 1px solid var(--warn-border);
  background: var(--warn-bg);
  color: var(--warn-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.next-action-banner.tone-info { border-color: var(--info-border); background: var(--info-bg); color: var(--info-text); }
.next-action-banner.tone-ok   { border-color: var(--ok-border);   background: var(--ok-bg);   color: var(--ok-text); }

/* Readiness SVG Ring + Checklist + 14-day Dot Matrix */
.readiness-panel {
  flex: 0 0 auto;
  padding: 12px;
  border-radius: var(--r-lg);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.readiness-top { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; align-items: center; }
.ready-ring-box { position: relative; width: 64px; height: 64px; }
.ready-ring-svg { width: 64px; height: 64px; display: block; transform: rotate(-90deg); }
.ready-ring-track { fill: none; stroke: var(--border-subtle); stroke-width: 6; }
.ready-ring-fill { fill: none; stroke: var(--ring-color, var(--accent-primary)); stroke-width: 6; stroke-linecap: round; stroke-dasharray: var(--pct, 0) 102; stroke-dashoffset: 0; }

@media (prefers-reduced-motion: no-preference) {
  .ready-ring-fill { stroke-dashoffset: var(--pct, 0); animation: uaRingFill 520ms var(--ease-out) 60ms forwards; }
}
@keyframes uaRingFill { to { stroke-dashoffset: 0; } }

.ready-ring-val { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; font-weight: 600; color: var(--ink-primary); }

.readiness-checks { display: flex; flex-wrap: wrap; gap: 6px; }
.ready-check-btn {
  height: 28px;
  padding: 0 8px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-1);
  color: var(--ink-secondary);
  font-size: 11.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}
.ready-check-btn svg { width: 12px; height: 12px; display: block; flex: 0 0 12px; }
.ready-check-btn.is-done { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok-text); font-weight: 600; }

.activity-dots-14 { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 4px; align-items: end; }
.activity-dot-14 { aspect-ratio: 1; border-radius: 3px; background: var(--bg-surface-3); border: 1px solid var(--border-subtle); }
.activity-dot-14.lvl-1 { background: var(--accent-border); border-color: var(--accent-border); }
.activity-dot-14.lvl-2 { background: var(--accent-primary); border-color: var(--accent-primary); opacity: 0.72; }
.activity-dot-14.lvl-3 { background: var(--accent-primary); border-color: var(--accent-primary); }

.doc-list { display: flex; flex-direction: column; gap: 6px; }
.doc-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: var(--r-md); border: 1px solid var(--border-subtle); background: var(--bg-surface-2); }
.doc-ext { padding: 2px 6px; border-radius: var(--r-xs); background: var(--bad-bg); border: 1px solid var(--bad-border); color: var(--bad-text); font-size: 10.5px; font-weight: 600; }

/* Gantt Execution Timeline */
.gantt-shell { border: 1px solid var(--border-subtle); border-radius: var(--r-lg); background: var(--bg-surface-1); overflow: hidden; }
.gantt-axis { display: flex; justify-content: space-between; padding: 7px 12px; background: var(--bg-surface-2); border-bottom: 1px solid var(--border-subtle); font-size: 10.5px; color: var(--ink-muted); }

.gantt-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--border-subtle);
  background: transparent;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
}
.gantt-row:last-child { border-bottom: 0; }
.gantt-row-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; width: 100%; }
.gantt-row-head > :first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.gantt-row-head > :last-child { flex: 0 0 auto; white-space: nowrap; }
.gantt-track { position: relative; width: 100%; height: 18px; border-radius: var(--r-sm); background: var(--bg-surface-2); overflow: hidden; }

.gantt-bar {
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: var(--start, 0%);
  width: max(18px, var(--span, 20%));
  border-radius: var(--r-xs);
  border: 1px solid var(--g-border);
  border-left: 3px solid var(--g-cap);
  background: var(--g-bg);
  transform-origin: left center;
}

.gantt-bar.tone-info     { --g-bg: var(--info-bg);        --g-border: var(--info-border);        --g-cap: var(--info-dot); }
.gantt-bar.tone-delivery { --g-bg: var(--st-delivery-bg); --g-border: var(--st-delivery-border); --g-cap: var(--st-delivery-dot); }
.gantt-bar.tone-warn     { --g-bg: var(--warn-bg);        --g-border: var(--warn-border);        --g-cap: var(--warn-dot); }
.gantt-bar.tone-ok       { --g-bg: var(--ok-bg);          --g-border: var(--ok-border);          --g-cap: var(--ok-dot); }
.gantt-bar.tone-plum     { --g-bg: var(--pipe-csl-bg);    --g-border: var(--pipe-csl-border);    --g-cap: var(--pipe-csl-dot); }

@media (prefers-reduced-motion: no-preference) {
  .gantt-bar { transform: scaleX(0); animation: uaBarFill 400ms var(--ease-out) forwards; animation-delay: calc(40ms + min(var(--i, 0), 7) * 50ms); }
}

.gantt-detail { margin-top: 2px; padding: 7px 9px; border-radius: var(--r-sm); background: var(--bg-surface-2); font-size: 12px; color: var(--ink-secondary); }

/* Logs Table & Wrapped JSON Payload Viewer */
.logs-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.log-table { border: 1px solid var(--border-subtle); border-radius: var(--r-lg); overflow: hidden; background: var(--bg-surface-1); }

.webhook-log-row {
  width: 100%;
  border: none;
  border-left: 3px solid transparent;
  border-bottom: 1px solid var(--border-subtle);
  background: transparent;
  padding: 9px 10px;
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  text-align: left;
  cursor: pointer;
}
.webhook-log-row:last-child { border-bottom: 0; }
.webhook-log-row.is-selected { background: var(--bg-surface-2); border-left-color: var(--accent-primary); }

.json-viewer { border-radius: var(--r-lg); border: 1px solid var(--code-border); background: var(--code-bg); color: var(--code-ink); overflow: hidden; max-width: 100%; }
.json-viewer__head { padding: 7px 10px; background: var(--code-head-bg); border-bottom: 1px solid var(--code-border); display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--syn-punct); }
.json-viewer__head > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.log-json-pre {
  margin: 0;
  padding: 11px 12px;
  font-size: 11.5px;
  line-height: 1.5;
  max-width: 100%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.j-key { color: var(--syn-key); }
.j-str { color: var(--syn-str); }
.j-num { color: var(--syn-num); }
.j-bool { color: var(--syn-bool); }
.j-punct { color: var(--syn-punct); }

.field-label { display: block; font-size: 12px; font-weight: 500; color: var(--ink-secondary); margin-bottom: 4px; }
.kv-grid { display: grid; grid-template-columns: 108px minmax(0, 1fr); gap: 7px 12px; margin: 0; font-size: 13px; }
.kv-grid dt { color: var(--ink-muted); }
.kv-grid dd { margin: 0; color: var(--ink-primary); word-break: break-word; }
.drawer-line-item { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 13px; }
.drawer-line-item b { white-space: nowrap; flex: 0 0 auto; }
.drawer-total-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-top: 8px; margin-top: 4px; border-top: 1px solid var(--border-subtle); font-size: 14.5px; font-weight: 600; }

.qr-preview-box { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--r-lg); background: var(--qr-surface); color: var(--qr-ink); border: 1px solid var(--border-strong); }
.qr-preview-box svg { width: 76px; height: 76px; flex: 0 0 76px; display: block; }
.qr-url { font-size: 11.5px; color: var(--qr-sub); word-break: break-all; }

/* Mobile More Routes Sheet Rows (Bug #1 fixed) */
.more-nav-list { display: flex; flex-direction: column; gap: 8px; }
.more-nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 58px;
  padding: 10px 12px;
  border-radius: var(--r-card);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  color: var(--ink-primary);
  text-align: left;
  cursor: pointer;
}
.more-nav-row.is-active { background: var(--accent-soft); border-color: var(--accent-border); }
.more-nav-left { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1 1 auto; }
.more-nav-left > div { min-width: 0; flex: 1 1 auto; }
.more-nav-row > svg { width: 16px; height: 16px; flex: 0 0 16px; color: var(--ink-muted); display: block; }
.more-nav-ico { width: 36px; height: 36px; flex: 0 0 36px; border-radius: var(--r-md); background: var(--bg-surface-1); border: 1px solid var(--border-subtle); display: grid; place-items: center; color: var(--accent-text); }
.more-nav-ico svg { width: 17px; height: 17px; display: block; flex: 0 0 auto; }

/* ==========================================================================
   Docked Mobile Bar & Toasts
   ========================================================================== */

.mobile-dock {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 45;
  height: var(--dock-h);
  padding: 4px max(8px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(8px, env(safe-area-inset-left));
  background: var(--bg-surface-1);
  border-top: 1px solid var(--border-subtle);
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
}

.dock-item { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 48px; border: none; border-radius: var(--r-md); background: transparent; color: var(--ink-muted); font-size: 11px; font-weight: 500; cursor: pointer; }
.dock-item svg { width: 18px; height: 18px; display: block; flex: 0 0 auto; }
.dock-item.active { background: var(--bg-surface-2); color: var(--ink-primary); font-weight: 600; }
.dock-item.active::after { content: ""; position: absolute; top: 2px; width: 18px; height: 2px; border-radius: 999px; background: var(--accent-primary); }

.dock-badge { position: absolute; top: 4px; right: calc(50% - 18px); min-width: 16px; height: 16px; padding: 0 4px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; background: var(--accent-primary); color: var(--accent-on); font-family: var(--font-mono); font-size: 10.5px; font-weight: 600; }
.dock-badge.is-warn { background: var(--bad-dot); color: var(--accent-on); }

.toast-stack {
  position: fixed;
  top: auto;
  bottom: 20px;
  right: 24px;
  left: auto;
  transform: none;
  z-index: 160;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}

.toast-item { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--r-lg); background: var(--bg-inverse); color: var(--ink-inverse); font-size: 13px; font-weight: 500; box-shadow: var(--shadow-sheet); animation: uaMsgIn 200ms var(--ease-out) both; }
.toast-undo-btn { margin-left: auto; padding: 4px 10px; border-radius: var(--r-sm); border: 1px solid var(--border-strong); background: transparent; color: var(--ink-inverse); font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.toast-item svg { width: 16px; height: 16px; display: block; flex: 0 0 16px; color: var(--ok-dot); }

/* 4-Language Top Bar Switcher (Desktop pills, Tablet/Mobile compact trigger) */
.lang-switch {
  flex: 0 0 auto;
  padding: 2px;
  gap: 2px;
}
.lang-switch .ua-pill {
  padding: 0 7px;
  min-height: 28px;
  font-size: 11px;
}
.lang-single-btn {
  display: none;
  width: 38px;
  height: 36px;
  padding: 0;
  place-items: center;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  color: var(--ink-primary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  flex: 0 0 auto;
}
@media (max-width: 1099px) {
  .lang-switch { display: none; }
  .lang-single-btn { display: grid; }
}
@media (max-width: 767px) {
  .lang-single-btn { width: 44px; height: 44px; }
}

/* ==========================================================================
   Responsive Tiers: Desktop 1100-1359, Tablet 768-1099, Mobile <= 767
   ========================================================================== */

@media (max-width: 1359px) {
  .kanban-board-scroll { display: flex; scroll-snap-type: x proximity; }
  .kanban-col { flex: 0 0 264px; scroll-snap-align: start; }
}

@media (max-width: 1099px) {
  .sidebar { width: 64px; flex-basis: 64px; padding: 12px 8px; }
  .sidebar .brand-copy, .sidebar .sidebar-section-label, .sidebar .nav-label, .sidebar .nav-badge, .sidebar .nav-chev, .sidebar .sub-nav, .sidebar .rail-status-text, .sidebar .profile-meta { display: none; }
  .sidebar .sidebar-head { flex-direction: column; gap: 8px; }
  .sidebar .nav-item { width: 44px; height: 44px; padding: 0; margin-inline: auto; justify-content: center; }
  .sidebar .nav-collapsed-dot { display: block; position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent-primary); }
  .sidebar .rail-status-btn { width: 44px; height: 44px; padding: 0; margin-inline: auto; justify-content: center; }
  .sidebar .profile-row { justify-content: center; padding: 4px 0 0; }
  .rail-pin-btn { display: none; }

  .top-bar { padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); }
  .page-meta, .sync-btn, .search-trigger-label, .kbd-chip { display: none; }
  .search-trigger { width: 40px; height: 40px; padding: 0; justify-content: center; }
  .main-viewport { padding: 16px 16px 28px; }
  .orders-controls { grid-template-columns: minmax(160px, 1fr) 132px 132px auto; }
  .orders-density-pills { gap: 2px; padding: 2px; }
  .orders-density-pills .ua-pill { padding: 0 7px; font-size: 11.5px; }
  .orders-count-note, .col-items-cell, .col-carrier-cell { display: none; }
  .desktop-orders-card .crm-table { min-width: 640px; }
  .chats-shell { grid-template-columns: 256px minmax(0, 1fr); height: calc(100dvh - 88px); }

  .auto-mobile-tabs { display: flex; }
  .auto-shell { grid-template-columns: minmax(0, 1fr); height: auto; max-height: none; min-height: 460px; }
  .auto-shell[data-auto-pane="canvas"] .auto-copilot-pane { display: none; }
  .auto-shell[data-auto-pane="copilot"] .auto-canvas-pane { display: none; }
  .auto-copilot-pane, .auto-canvas-pane { min-height: 440px; }
}

@media (max-width: 767px) {
  .sidebar { display: none; }
  .mobile-dock, .mobile-mark { display: grid; }
  .top-bar {
    padding: env(safe-area-inset-top) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
    gap: 8px;
  }
  .top-bar-right { gap: 4px; }
  .top-bar .biz-scope-bar { display: none; }
  .mobile-scope-row { display: flex; }
  .page-head-copy h1 { font-size: 16px; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; }
  .theme-switch { display: none; }
  .theme-single-btn { display: grid; }
  .search-trigger { width: 44px; height: 44px; }
  .cta-label-full { display: none; }
  .cta-label-short { display: inline; }
  .cta-new-btn .ua-btn__base, .cta-new-btn .ua-btn__fill { height: 44px; padding: 0 10px; }

  .main-viewport { padding: 12px 12px calc(var(--dock-h) + 20px); gap: 12px; }
  .card.panel-pad { padding: 12px; }

  .kpi-grid { gap: 8px; }
  .kpi-card { padding: 12px; gap: 8px; }
  .kpi-value { font-size: 20px; }
  .kpi-foot:has(> .badge-chip) .kpi-foot-sub { display: none; }
  .kpi-foot:not(:has(> .badge-chip)) .kpi-foot-sub { display: block; }

  /* Video-grade floating chart popover works identically on mobile with top headroom */
  .chart-box { padding-top: 24px; }
  .chart-axis-text { font-size: 12px; }
  .heat-strip-10 { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
  .toc-batch-bar .quiet-btn {
    max-width: 100%;
    width: 100%;
    justify-content: center;
    white-space: normal;
    height: auto;
    min-height: 44px;
    padding: 8px 12px;
    text-align: center;
  }

  .cal-strip { gap: 3px; }
  .cal-day { min-height: 44px; }
  .task-check-btn { width: 44px; height: 44px; }
  .task-row { grid-template-columns: 44px minmax(0, 1fr) auto; gap: 4px; }
  .repeat-tick-bar { gap: 2px; }

  .donut-wrap { flex-direction: column; align-items: stretch; gap: 12px; }
  .donut-svg-box { margin-inline: auto; }

  .ua-pill { min-height: 40px; padding: 0 12px; }
  .seg-pills .ua-pill { min-height: 36px; }
  .orders-controls { grid-template-columns: 1fr 1fr; }
  .search-field { grid-column: span 2; }
  .crm-input, .crm-select { height: 44px; font-size: 16px; }
  .crm-textarea { font-size: 16px; }
  .flow-test-field .crm-input { height: 44px; font-size: 16px; }

  .desktop-orders-card, .desktop-ledger-wrap, .orders-density-pills { display: none !important; }
  .mobile-orders-list, .mobile-ledger-list { display: flex; }

  .kanban-col, .kanban-board-scroll.many-cols .kanban-col { flex: 0 0 calc(100vw - 56px); min-height: 240px; }
  .kc-move-btn { width: 44px; height: 44px; }
  .kanban-header-controls .quiet-btn,
  .kanban-header-controls .ua-btn__base,
  .kanban-header-controls .ua-btn__fill { min-height: 44px; height: 44px; }

  /* Compact Mobile Automation Header + Branch Tabs */
  .auto-hero-card { padding: 12px 14px !important; }
  .auto-hero-card .panel-head { margin-bottom: 10px; }
  .auto-actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
  .auto-actions-grid #addStepBtn { display: none; }
  .auto-actions-grid .quiet-btn,
  .auto-actions-grid .ua-btn__base,
  .auto-actions-grid .ua-btn__fill { height: 40px; min-height: 40px; width: 100%; }
  .auto-copilot-pane, .auto-canvas-pane { min-height: 380px; }

  .branch-svg-split { display: none; }
  .branch-mobile-tabs { display: flex; }
  .branch-grid { grid-template-columns: minmax(0, 1fr); }
  .branch-grid[data-active-branch="true"] .branch-col[data-branch-key="false"] { display: none; }
  .branch-grid[data-active-branch="false"] .branch-col[data-branch-key="true"] { display: none; }

  /* Mobile Chats header space recovery */
  .chats-shell { grid-template-columns: minmax(0, 1fr); height: calc(var(--vv-h, 100dvh) - 144px - env(safe-area-inset-bottom)); min-height: 360px; }
  .chats-shell:not(.show-thread) .chat-thread-pane { display: none; }
  .chats-shell.show-thread .chat-list-pane { display: none; }
  .chat-back-btn { display: inline-flex; }
  .chat-main-head { padding: 8px 10px; gap: 6px; }
  .chat-main-head .thread-av { display: none; }
  .order-ctx-chip { height: 40px; padding: 0 8px; }
  .chat-send-label { display: none; }
  #chatForm .quiet-btn, #aiFlowForm .quiet-btn { width: 44px; height: 44px; padding: 0; flex: 0 0 44px; }

  .flow-add-btn { min-height: 44px; }
  .kb-source-grid { grid-template-columns: minmax(0, 1fr); }

  /* Bottom-sheet controls on mobile */
  .drawer-tab { height: 44px; }
  .sheet-body { padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); }
  .sheet-footer { padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); }
  .sheet-footer .ua-btn__base, .sheet-footer .ua-btn__fill { height: 44px; padding: 0 8px; }
  .icon-close-btn { width: 44px; height: 44px; flex-basis: 44px; }
  .pop-menu-item { min-height: 44px; }

  .toast-stack { top: auto; bottom: calc(var(--dock-h) + 12px); left: 12px; right: 12px; transform: none; max-width: none; align-items: stretch; }
  html.is-scroll-locked .toast-stack { bottom: calc(16px + env(safe-area-inset-bottom)); }
}

@media (max-width: 480px) {
  .order-ctx-sum { display: none; }
  .hide-xs { display: none; }
  .panel-head > .seg-pills { gap: 2px; padding: 2px; }
  .panel-head > .seg-pills .ua-pill { padding: 0 7px; font-size: 12px; gap: 4px; }
}


/* ==========================================================================
   v5.0 Frozen Baseline: Capacitor Guard, Action Center, Bulk Bar, Matrix,
   WMS Floor Heatmap, P&L Waterfall, KPI Tier Bar, AI Calls & 1C Recon
   ========================================================================== */

.nav-item, .dock-item, .ua-pill, .ua-btn, .quiet-btn, .kanban-card {
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}

.action-center-btn {
  position: relative;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  color: var(--ink-primary);
  cursor: pointer;
  transition: border-color var(--dur-press) ease, background-color var(--dur-press) ease;
}
@media (hover: hover) and (pointer: fine) {
  .action-center-btn:hover { border-color: var(--border-strong); background: var(--bg-surface-3); }
}
.ac-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--bad-dot);
  color: var(--accent-on);
  border: 2px solid var(--bg-surface-1);
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ac-badge[hidden] { display: none; }

.crm-select--compact { width: 184px; height: 32px; font-size: 12.5px; flex: 0 0 auto; }
.toc-qty-input { width: 82px; height: 30px; font-size: 12.5px; text-align: right; }
.kc-expand-btn { width: 26px; height: 26px; min-width: 26px; padding: 0; justify-content: center; }

/* Orders Bulk Selection Bar & Checkboxes */
.row-check-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  cursor: pointer;
  flex: 0 0 auto;
}
.row-check {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-primary);
  cursor: pointer;
  margin: 0;
}
.bulk-bar {
  position: sticky;
  top: 64px;
  z-index: 18;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-radius: var(--r-card);
  background: var(--bg-surface-1);
  border: 1px solid var(--accent-border);
}
.bulk-bar-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* Order Unit Economics Margin Strip */
.margin-strip {
  flex: 0 0 auto;
  padding: 11px 12px;
  border-radius: var(--r-lg);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.margin-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}
@media (max-width: 520px) {
  .margin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .margin-cell.is-net { grid-column: span 2; display: flex; align-items: center; justify-content: space-between; }
  .margin-cell.is-net .margin-cell-val { margin-top: 0; }
}
.margin-cell {
  padding: 6px 8px;
  border-radius: var(--r-sm);
  background: var(--bg-surface-1);
  border: 1px solid var(--border-subtle);
  min-width: 0;
}
.margin-cell-lbl { font-size: 10.5px; color: var(--ink-muted); display: block; }
.margin-cell-val { font-size: 12.5px; font-weight: 600; color: var(--ink-primary); display: block; margin-top: 2px; }
.margin-cell.is-net .margin-cell-val { color: var(--ok-text); }

/* Catalog Variant Matrix & Barcode Labels */
.matrix-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.matrix-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
@media (max-width: 960px) { .matrix-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .matrix-grid { grid-template-columns: minmax(0, 1fr); } }
.matrix-chip {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color var(--dur-press) ease, background-color var(--dur-press) ease;
}
@media (hover: hover) and (pointer: fine) {
  .matrix-chip:hover { border-color: var(--border-strong); background: var(--bg-surface-3); }
}
.matrix-chip.is-low { border-left: 3px solid var(--bad-dot); }
.matrix-chip.is-ok  { border-left: 3px solid var(--ok-dot); }

/* WMS Bin Heatmap & Scan-to-Pack Station */
.wms-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
@container workspace (max-width: 960px) {
  .wms-shell { grid-template-columns: minmax(0, 1fr); }
}
.wms-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
@media (max-width: 680px) { .wms-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.wms-bin {
  padding: 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--dur-press) ease;
}
.wms-bin.tone-ok   { background: var(--ok-bg);   border-color: var(--ok-border); }
.wms-bin.tone-warn { background: var(--warn-bg); border-color: var(--warn-border); }
.wms-bin.tone-bad  { background: var(--bad-bg);  border-color: var(--bad-border); }
.wms-bin.tone-info { background: var(--info-bg); border-color: var(--info-border); }
.wms-bin.is-selected { outline: 2px solid var(--accent-primary); outline-offset: 1px; }

.pack-scan-box {
  padding: 12px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pack-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  background: var(--bg-surface-1);
  border: 1px solid var(--border-subtle);
}
.pack-item-row.is-scanned { border-color: var(--ok-border); background: var(--ok-bg); }

/* P&L Waterfall, Cash Gap Calendar & KPI Tiers */
.wf-list { display: flex; flex-direction: column; gap: 9px; }
.wf-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 92px; align-items: center; gap: 10px; font-size: 12.5px; }
@media (max-width: 540px) { .wf-row { grid-template-columns: 112px minmax(0, 1fr) 78px; font-size: 12px; gap: 6px; } }
.wf-track { position: relative; height: 12px; border-radius: var(--r-xs); background: var(--bg-surface-2); overflow: hidden; }
.wf-fill { height: 100%; border-radius: var(--r-xs); width: var(--pct, 0%); background: var(--wf-color, var(--chart-1)); transform-origin: left center; }

.cash-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}
@media (max-width: 680px) { .cash-cal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.cash-day-cell {
  padding: 8px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.cash-day-cell.is-gap { background: var(--bad-bg); border-color: var(--bad-border); color: var(--bad-text); }

.kpi-tier-track { position: relative; height: 10px; border-radius: 999px; background: var(--bg-surface-2); overflow: visible; margin: 8px 0 4px; }
.kpi-tier-fill { height: 100%; border-radius: 999px; background: var(--accent-primary); max-width: 100%; transition: width 320ms var(--ease-wave); }
.kpi-tier-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink-muted); }

/* AI Calls QA & 1C Reconciliation */
.ai-calls-shell { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 12px; align-items: start; }
@container workspace (max-width: 900px) { .ai-calls-shell { grid-template-columns: minmax(0, 1fr); } }
.qa-checks-list { display: flex; flex-direction: column; gap: 6px; }
.qa-check-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: var(--r-md); background: var(--bg-surface-2); border: 1px solid var(--border-subtle); font-size: 12.5px; }
.ai-audio-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-radius: var(--r-md); background: var(--bg-surface-2); border: 1px solid var(--border-subtle); margin-bottom: 12px; }
.audio-wave-bar { display: flex; align-items: center; gap: 2px; height: 28px; flex: 1 1 auto; min-width: 110px; }
.audio-wave-bar span { flex: 1 1 0; border-radius: 2px; background: var(--accent-border); min-width: 2px; }
.audio-wave-bar span.is-lit { background: var(--accent-primary); }

.recon-table th, .recon-table td { font-size: 12.5px; padding: 8px 10px; }
.label-sheet-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 560px) { .label-sheet-grid { grid-template-columns: minmax(0, 1fr); } }
.label-card {
  padding: 12px;
  border-radius: var(--r-md);
  border: 1px dashed var(--border-strong);
  background: var(--qr-surface);
  color: var(--qr-ink);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.label-card svg { width: 100%; max-width: 220px; height: 38px; display: block; color: var(--qr-ink); }


@media (max-width: 767px) {
  .action-center-btn { width: 44px; height: 44px; }
  .ac-badge { top: 2px; right: 2px; }
  .crm-select--compact { width: 100%; height: 44px; font-size: 16px; }
  .toc-qty-input { width: 96px; height: 44px; font-size: 16px; }
  .kc-expand-btn { width: 44px; height: 44px; min-width: 44px; }
  .row-check-wrap { width: 44px; height: 44px; }
}

/* Unified <= 799px Responsive Bottom Sheets (Desktop/Tablet >= 800px stays 320px..40vw Drawer) */
@media (max-width: 799px) {
  .sheet-panel--drawer,
  .sheet-panel--modal,
  .sheet-panel--modal.sheet-panel--wide {
    top: auto;
    left: 0; right: 0; bottom: 0;
    width: 100%;
    max-width: 100%;
    max-height: min(92svh, calc(var(--vv-h, 100dvh) - 16px));
    border-radius: var(--r-sheet) var(--r-sheet) 0 0;
    border-bottom: none;
    opacity: 1;
    transform: translate3d(0, 100%, 0);
  }
  .sheet-panel--drawer.open, .sheet-panel--modal.open { opacity: 1; transform: translate3d(0, 0, 0); }
  .sheet-grab-zone { display: flex; }
  .sheet-head { padding: 8px 16px 12px; }
  .drawer-tabs { padding: 0 16px; }
}

/* ==========================================================================
   v5.5 UI Craft Extensions: Command Palette, AI Plum, Receipts, Copy, Empty
   ========================================================================== */

.cmd-modal-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
}
.cmd-search-input {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--ink-primary);
  font-size: 14px;
  outline: none;
}
.cmd-search-input::placeholder { color: var(--ink-muted); opacity: 1; }
.cmd-search-input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.cmd-progress-track {
  position: relative;
  height: 2px;
  width: 100%;
  background: var(--border-subtle);
  overflow: hidden;
}
.cmd-progress-bar {
  height: 100%;
  width: 100%;
  background: var(--accent-primary);
  transform-origin: left center;
  transform: scaleX(0);
  opacity: 0;
  transition: transform 180ms var(--ease-out), opacity 160ms ease;
}
.cmd-progress-track.is-scanning .cmd-progress-bar {
  transform: scaleX(1);
  opacity: 1;
}
.cmd-list {
  max-height: min(56vh, 380px);
  overflow-y: auto;
  padding: 8px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cmd-group-label {
  padding: 8px 8px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cmd-item {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}
.cmd-item.is-active,
.cmd-item:hover {
  background: var(--bg-surface-2);
  border-color: var(--border-subtle);
}
.cmd-item-main { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; }
.cmd-item-title { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmd-item-sub { font-size: 12px; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmd-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  font-size: 12px;
  color: var(--ink-muted);
}
.cmd-hints { display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap; }
@media (max-width: 767px) {
  .cmd-search-input { font-size: 16px; min-height: 44px; }
  .cmd-item { min-height: 44px; }
  .cmd-footer .kbd-chip { display: none; }
}

.disabled-reason {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--ink-secondary);
}
.copy-inline-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 2px 8px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  color: var(--ink-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
}
.copy-inline-btn svg { width: 13px; height: 13px; color: var(--ink-muted); display: block; flex: 0 0 13px; }
.fin-receipt-card {
  padding: 12px 16px;
  border-radius: var(--r-lg);
  border: 1px solid var(--ok-border);
  background: var(--ok-bg);
  color: var(--ok-text);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.card-more-btn {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  color: var(--ink-secondary);
  cursor: pointer;
  flex: 0 0 auto;
}

.ai-plum-surface {
  background: var(--ai-bg);
  border: 1px solid var(--ai-border);
  border-radius: var(--r-lg);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.badge-chip.ai-plum {
  background: var(--ai-bg);
  border-color: var(--ai-border);
  color: var(--ai-text);
  font-weight: 600;
}
.ai-source-row { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-source-chip {
  height: 26px;
  padding: 0 8px;
  border-radius: var(--r-sm);
  border: 1px solid var(--ai-border);
  background: var(--bg-surface-1);
  color: var(--ai-text);
  font-size: 11.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.ai-source-chip.is-unsourced {
  background: var(--bad-bg);
  border-color: var(--bad-border);
  color: var(--bad-text);
}
.ai-version-bar { display: inline-flex; align-items: center; gap: 6px; }
.audio-wave-bar.is-interactive span { cursor: pointer; transition: background-color 140ms ease, height 160ms ease; }
.transcript-cue {
  width: 100%;
  text-align: left;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-secondary);
}
.transcript-cue:hover,
.transcript-cue.is-active { background: var(--bg-surface-2); border-color: var(--border-subtle); color: var(--ink-primary); }

.empty-state-box {
  padding: 24px 16px;
  border-radius: var(--r-card);
  border: 1px dashed var(--border-strong);
  background: var(--bg-surface-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}

/* ==========================================================================
   v5.7 Modular CRM, @container Tables & Cashier Workstation (Tokenized)
   ========================================================================== */

b, strong { font-weight: 600; }
[hidden] { display: none !important; }

.mobile-menu-btn {
  display: none;
  width: 44px;
  height: 44px;
  padding: 0;
  flex: 0 0 44px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-1);
  color: var(--ink-primary);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
@media (hover: hover) and (pointer: fine) {
  .mobile-menu-btn:hover { background: var(--bg-surface-2); border-color: var(--border-strong); }
}
@media (min-width: 768px) and (max-width: 1099px) {
  .mobile-menu-btn { display: inline-flex; }
}

.cmd-modal-head:focus-within {
  border-bottom-color: var(--accent-primary);
}

.scope-group { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.inline-actions { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ok-txt { color: var(--ok-text); }
.badge-chip.neutral {
  background: var(--bg-surface-2);
  border-color: var(--border-subtle);
  color: var(--ink-secondary);
}
.stage-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex: 0 0 8px;
  display: inline-block;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.form-grid-qty {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 10px;
}
.custom-field-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 128px 116px auto;
  gap: 8px;
}

.filter-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.filter-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.search-field .ico-left {
  position: absolute;
  left: 11px;
  display: inline-flex;
  align-items: center;
  color: var(--ink-muted);
  pointer-events: none;
}
.search-field .ico-left svg { position: static; width: 15px; height: 15px; }
.search-field > .crm-input,
.search-field > input { padding-left: 34px; }

.orders-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.orders-view-switch .ua-pill { height: 28px; }
.seg-pills--wrap { flex-wrap: wrap; overflow-x: visible; row-gap: 4px; }
.desktop-orders-card .row-actions { gap: 2px; flex-wrap: nowrap; }
.desktop-orders-card .row-act-btn { width: 26px; height: 26px; flex: 0 0 26px; }
.pos-shell .crm-table th,
.pos-shell .crm-table td { padding: 6px 8px; }

.stage-pill-group {
  display: inline-flex;
  align-items: stretch;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
}
.stage-action-pill {
  border: none;
  background: transparent;
  padding: 2px 8px;
  border-radius: 999px 0 0 999px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-primary);
  cursor: pointer;
}
.stage-tray-btn {
  border: none;
  border-left: 1px solid var(--border-subtle);
  background: transparent;
  padding: 2px 7px;
  border-radius: 0 999px 999px 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-muted);
  cursor: pointer;
}
.stage-tray-btn svg { width: 13px; height: 13px; }
@media (hover: hover) and (pointer: fine) {
  .stage-action-pill:hover { background: var(--bg-surface-3); }
  .stage-tray-btn:hover { background: var(--bg-surface-3); color: var(--ink-primary); }
}

.orders-filter-panel { padding: 14px; }
.filter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.filter-panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}
.filter-chk-lbl {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-primary);
  cursor: pointer;
}
.active-filter-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.active-fchip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 8px 0 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 500;
}
.chip-x-btn {
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 2px;
  display: inline-flex;
  align-items: center;
}
.chip-x-btn svg { width: 12px; height: 12px; }

.funnel-stage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 10px;
}
.funnel-stage-card {
  text-align: left;
  padding: 12px;
  border-radius: var(--r-card);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-1);
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: border-color var(--dur-press) var(--ease-out), background-color var(--dur-press) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .funnel-stage-card:hover { border-color: var(--border-strong); background: var(--bg-surface-2); }
}
.funnel-stage-card.active,
.funnel-stage-card.is-active { border-color: var(--accent-primary); background: var(--accent-soft); }
.funnel-stage-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.funnel-stage-name { font-size: 13px; font-weight: 600; color: var(--ink-primary); }
.funnel-stage-sum { font-size: 12.5px; color: var(--ink-secondary); font-weight: 600; }

/* Responsive Data Tables via @container */
.table-responsive-wrap {
  container-type: inline-size;
  container-name: data-table;
  width: 100%;
  min-width: 0;
}
.table-responsive-wrap .desktop-orders-card .crm-table {
  min-width: 620px;
}
.label-editor-shell .table-responsive-wrap,
.pos-shell .table-responsive-wrap,
.finance-grid .table-responsive-wrap,
.table-responsive-wrap--sheet {
  container-name: data-table-narrow;
}
.label-editor-shell .table-responsive-wrap .desktop-orders-card .crm-table,
.pos-shell .table-responsive-wrap .desktop-orders-card .crm-table,
.finance-grid .table-responsive-wrap .desktop-orders-card .crm-table,
.table-responsive-wrap--sheet .desktop-orders-card .crm-table {
  min-width: 0;
  width: 100%;
}
@container data-table (max-width: 680px) {
  .desktop-orders-card { display: none !important; }
  .mobile-orders-list { display: flex; }
}
@container data-table-narrow (max-width: 440px) {
  .desktop-orders-card { display: none !important; }
  .mobile-orders-list { display: flex; }
}

.rule-row--stack { flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 8px; }
.rule-row--stack > :first-child { flex: 0 0 auto; }
.col-check { width: 38px; text-align: center; }
.group-header-row td {
  background: var(--bg-surface-2);
  color: var(--ink-primary);
  font-size: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
}
.is-selected-row td { background: var(--accent-soft); }

.moc-top, .moc-bot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.moc-mid { font-size: 12px; color: var(--ink-secondary); }
.moc-id, .moc-meta { font-size: 11.5px; color: var(--ink-muted); }
.moc-cust { font-size: 13.5px; font-weight: 600; color: var(--ink-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.kpi-label:has(.kpi-chip) { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.kpi-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--r-sm);
  background: var(--bg-surface-2);
  color: var(--ink-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}
.kpi-chip.ok { background: var(--ok-bg); color: var(--ok-text); }
.kpi-chip.warn { background: var(--warn-bg); color: var(--warn-text); }
.kpi-chip.bad { background: var(--bad-bg); color: var(--bad-text); }
.kpi-chip.info { background: var(--info-bg); color: var(--info-text); }
.kpi-sub { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--ink-muted); }
.kpi-delta.ok { color: var(--ok-text); font-weight: 600; }

.clients-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.drawer-erp-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.msg-attachments { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.chat-attach-img {
  max-width: 240px;
  width: 100%;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  display: block;
}
.chat-attach-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-1);
  color: var(--ink-primary);
}
.chat-attach-ico { color: var(--accent-primary); display: inline-flex; flex: 0 0 auto; }
.chat-attach-meta { min-width: 0; flex: 1; }
.chat-attach-title { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-attach-actions { display: inline-flex; gap: 4px; flex: 0 0 auto; }
.chat-attach-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
}
.chat-attach-thumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-1);
  font-size: 11.5px;
}
.chat-gallery-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
}

.label-editor-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.95fr);
  gap: 14px;
  align-items: start;
}
.label-preview-stage {
  padding: 18px;
  border-radius: var(--r-card);
  background: var(--bg-surface-2);
  border: 1px dashed var(--border-strong);
}
.label-card.is-compact { padding: 8px 10px; font-size: 11px; }
.label-card.is-large { padding: 16px; }

.finmap-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.finmap-accounts-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 10px;
}
.finmap-acc-card {
  text-align: left;
  padding: 12px;
  border-radius: var(--r-card);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-1);
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  transition: border-color var(--dur-press) var(--ease-out), background-color var(--dur-press) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .finmap-acc-card:hover { border-color: var(--border-strong); background: var(--bg-surface-2); }
}
.finmap-acc-card.active { border-color: var(--accent-primary); background: var(--accent-soft); }
.finmap-cal-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.finmap-cal-grid--wide { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }
.finmap-cal-day {
  padding: 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.finmap-cal-day.is-gap {
  background: var(--bad-bg);
  border-color: var(--bad-border);
}

.customizer-list { display: flex; flex-direction: column; gap: 6px; }
.customizer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  font-size: 13px;
}
.roles-matrix-table th,
.roles-matrix-table td { text-align: center; }
.roles-matrix-table th:first-child,
.roles-matrix-table td:first-child { text-align: left; }

/* ==========================================================================
   v5.7 Cashier Workstation (#pos) & Bidirectional Settings (#settings:pos)
   ========================================================================== */

.pos-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.pos-top-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
  flex: 1 1 auto;
}
.pos-top-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--ink-secondary);
  margin-top: 2px;
}
.pos-top-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.pos-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.95fr);
  gap: 14px;
  align-items: start;
}
.pos-catalog-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.pos-cart {
  position: sticky;
  top: 76px;
  min-width: 0;
}

.pos-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.pos-kits-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.pos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 10px;
}
.pos-sku-card {
  text-align: left;
  padding: 12px;
  border-radius: var(--r-card);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-1);
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: border-color var(--dur-press) var(--ease-out), background-color var(--dur-press) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .pos-sku-card:hover:not(:disabled) { border-color: var(--accent-primary); background: var(--bg-surface-2); }
}
.pos-sku-card:disabled { opacity: 0.5; cursor: not-allowed; }
.pos-sku-thumb {
  height: 42px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  color: var(--ink-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}
.pos-sku-thumb svg.ua-ico { width: 20px; height: 20px; }
.pos-sku-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.pos-sku-title { font-size: 13px; font-weight: 600; color: var(--ink-primary); line-height: 1.3; }
.pos-sku-price { font-size: 14px; font-weight: 600; color: var(--accent-text); margin-top: auto; }

.pos-client-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pos-cust-hits {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}
.pos-step1-extras {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.pos-wizard-card {
  padding: 12px;
  border-radius: var(--r-lg);
  border: 1px solid var(--accent-border);
  background: var(--bg-surface-2);
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pos-ral-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px;
}
.pos-ral-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-1);
  text-align: left;
  cursor: pointer;
  font-size: 12px;
}
.pos-ral-btn > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.pos-ral-btn.active { border-color: var(--accent-primary); background: var(--accent-soft); }
.pos-ral-swatch {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border-radius: var(--r-xs);
  border: 1px solid var(--swatch-border);
}
.pos-calc-readout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-1);
  font-size: 12.5px;
}
.pos-mod-groups {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pos-parked-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px 10px;
  margin-bottom: 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
}
.pos-cart-items { display: flex; flex-direction: column; gap: 8px; }
.pos-cart-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
}
.qty-stepper { display: inline-flex; align-items: center; gap: 4px; }
.pos-qty-num { min-width: 24px; text-align: center; font-weight: 600; font-size: 13px; }
.pos-line-total { min-width: 72px; text-align: right; font-weight: 600; font-size: 13px; }

.pos-checkout-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}
.pos-pay-pills { width: 100%; }
.pos-pay-subpanel {
  padding: 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pos-bills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 6px;
}
.pos-change-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 4px;
  font-size: 12.5px;
}
.pos-change-val { font-size: 14px; font-weight: 600; }
.pos-split-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.pos-split-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}

.pos-preflight-box {
  padding: 10px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pos-preflight-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pos-pf-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-secondary);
}
.pos-grand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border-subtle);
  font-weight: 600;
}
.pos-grand-total { font-size: 19px; font-weight: 600; color: var(--ink-primary); }
.pos-hint-strip {
  font-size: 11.5px;
  color: var(--ink-muted);
}

.pos-lifecycle-track {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}
.pos-lc-step {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-1);
  font-size: 11.5px;
  color: var(--ink-muted);
}
.pos-lc-step.is-done {
  border-color: var(--ok-border);
  background: var(--ok-bg);
  color: var(--ok-text);
  font-weight: 600;
}
.pos-lc-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  flex: 0 0 7px;
  background: var(--ink-muted);
}
.pos-lc-step.is-done .pos-lc-dot { background: var(--ok-dot); }
.pos-lc-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  background: var(--bg-surface-1);
  border: 1px solid var(--border-subtle);
}
.pos-lc-kpis > div { display: flex; flex-direction: column; gap: 2px; }

.pos-receipt-paper {
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0 auto;
  width: 100%;
  padding: 12px;
  border-radius: var(--r-md);
  border: 1px dashed var(--border-strong);
  background: var(--bg-surface-1);
  color: var(--ink-primary);
  overflow-x: auto;
}
.pos-receipt-paper.w-58 { max-width: 248px; font-size: 11px; }
.pos-receipt-paper.w-80 { max-width: 340px; }
.pos-receipt-paper.w-110 { max-width: 100%; font-size: 12px; }

.pos-journal-stack { display: flex; flex-direction: column; gap: 14px; }

.pos-pin-card {
  max-width: 560px;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.pos-worker-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.pos-pin-dots {
  font-size: 24px;
  letter-spacing: 0.45em;
  text-align: center;
  padding: 8px 0;
  color: var(--ink-primary);
}
.pos-pin-pad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  max-width: 320px;
  width: 100%;
  margin-inline: auto;
}
.pos-pin-key { min-height: 48px; font-size: 16px; }

.pos-settings-wrap { display: flex; flex-direction: column; gap: 14px; }
.pos-preset-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.pos-preset-card {
  text-align: left;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
}
.pos-preset-card.is-active {
  border-color: var(--accent-primary);
  background: var(--accent-soft);
}

.pos-mobile-bar { display: none; }

@media (max-width: 1024px) {
  .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pos-shell, .label-editor-shell { grid-template-columns: minmax(0, 1fr); }
  .pos-cart { position: static; }
  .pos-preset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .finmap-cal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
  .filter-grid,
  .finmap-cal-grid,
  .funnel-stage-grid,
  .pos-shell,
  .label-editor-shell,
  .form-grid-2,
  .form-grid-qty,
  .custom-field-form-grid,
  .pos-preset-grid,
  .pos-worker-grid,
  .pos-split-grid,
  .pos-lc-kpis {
    grid-template-columns: minmax(0, 1fr);
  }
  .pos-lifecycle-track { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .finmap-toolbar { flex-direction: column; align-items: stretch; }
  .pos-top-bar { padding: 10px 12px; margin-bottom: 10px; gap: 6px; }
  .pos-top-meta { gap: 6px; }
  .pos-top-right { width: 100%; justify-content: space-between; }
  .pos-shell > .pos-cart { display: none; }
  .pos-shell { padding-bottom: calc(var(--dock-h) + 76px); }
  .pos-mobile-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    position: fixed;
    left: 0;
    right: 0;
    bottom: var(--dock-h);
    z-index: 44;
    padding: 8px 14px;
    background: var(--bg-surface-1);
    border-top: 1px solid var(--border-strong);
  }
  .orders-filter-panel .crm-input,
  .orders-filter-panel .crm-select,
  .clients-toolbar .crm-input,
  .clients-toolbar .crm-select,
  .custom-field-form-grid .crm-input,
  .custom-field-form-grid .crm-select,
  #smsTemplatesForm .crm-input,
  .pos-shell .crm-input,
  .pos-shell .crm-select,
  .pos-cart .crm-input,
  .pos-cart .crm-select,
  .pos-settings-wrap .crm-input,
  .pos-settings-wrap .crm-select,
  .label-editor-shell .crm-input,
  .label-editor-shell .crm-select,
  #mainViewport input,
  #mainViewport select {
    font-size: 16px;
  }
  .stage-action-pill,
  .stage-tray-btn,
  .pos-cart .qty-stepper .quiet-btn,
  .pos-ral-btn,
  .pos-bills-grid .quiet-btn,
  .pos-top-right .quiet-btn {
    min-height: 44px;
  }
  .card, .card.panel-pad, .kpi-card, .finmap-acc-card { min-width: 0; max-width: 100%; }
}

/* ==========================================================================
   v5.8 Optional Digital Signage Module (Brandbook v5.5, 100% Tokenized)
   ========================================================================== */

.sig-shell {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.sig-top-bar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.sig-top-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}

.sig-preset-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
  min-width: 0;
}

.sig-preset-row-lbl {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  white-space: nowrap;
  flex: 0 0 auto;
}

.sig-preset-row .seg-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  width: 100%;
  background: transparent;
  border: 0;
  padding: 0;
}

.sig-top-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  min-width: 0;
}

.sig-top-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sig-top-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.sig-incident-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border-left: 3px solid var(--warn-dot);
  background: var(--bg-surface-1);
}

.sig-fleet-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.sig-screen-card {
  width: 100%;
  text-align: left;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  background: var(--bg-surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  transition: border-color var(--dur-press) var(--ease-out), background-color var(--dur-press) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .sig-screen-card:hover {
    border-color: var(--border-strong);
    background: var(--bg-surface-2);
  }
}

.sig-sc-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.sig-sc-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 11.5px;
  color: var(--ink-muted);
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

/* 3-Column Smart Studio */
.sig-studio-shell {
  display: grid;
  grid-template-columns: 224px minmax(0, 1.45fr) minmax(276px, 0.85fr);
  gap: 12px;
  align-items: start;
}

.sig-layers-card,
.sig-inspector-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  box-shadow: var(--shadow-card);
}

.sig-inspector-card {
  position: sticky;
  top: 76px;
}

.sig-layer-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sig-layer-row {
  width: 100%;
  min-width: 0;
  text-align: left;
  padding: 8px 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  box-shadow: var(--shadow-card);
}

.sig-layer-row > div:first-child {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.sig-layer-row .ord-id,
.sig-layer-row .sub-txt {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sig-layer-row > .badge-chip {
  flex: 0 0 auto;
}

.sig-layer-row.is-active {
  border-color: var(--accent-primary);
  background: var(--accent-soft);
}

.sig-stage-mat {
  background: var(--flow-canvas-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-card);
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  box-shadow: var(--shadow-card);
}

.sig-wall-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-1);
}

/* TV Bezel & Architectural Preview Canvas (Never uses --bg-inverse) */
.sig-bezel {
  background: var(--toc-black-bg);
  border: 2px solid var(--code-border);
  border-radius: var(--r-lg);
  padding: var(--sp-2);
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  min-width: 0;
  box-shadow: var(--shadow-card);
}

.sig-bezel.fmt-16x9 {
  max-width: 680px;
  margin-inline: auto;
}

.sig-bezel.fmt-9x16 {
  max-width: 280px;
  min-height: 440px;
  margin-inline: auto;
}

.sig-bezel.fmt-2x2 {
  max-width: 680px;
  margin-inline: auto;
}

.sig-bezel-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 2px 6px;
  font-size: 11px;
  color: var(--syn-punct);
}

.sig-screen-inner {
  border-radius: var(--r-sm);
  padding: var(--sp-2);
  display: grid;
  gap: 8px;
  min-height: 296px;
  flex: 1 1 auto;
}

.sig-screen-inner.is-dark {
  background: var(--code-bg);
  color: var(--code-ink);
}

.sig-screen-inner.is-paper {
  background: var(--bg-canvas);
  color: var(--ink-primary);
}

.sig-screen-inner.is-landscape-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sig-screen-inner.is-portrait-grid {
  grid-template-columns: minmax(0, 1fr);
  min-height: 400px;
}

.sig-screen-inner.is-wall-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  background: var(--toc-black-bg);
  padding: 2px;
}

.sig-wall-quad {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border-radius: var(--r-xs);
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  min-width: 0;
}

.sig-wall-quad-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 10.5px;
  color: var(--syn-punct);
}

.sig-slot {
  width: 100%;
  text-align: left;
  padding: 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--code-border);
  background: var(--code-head-bg);
  color: var(--code-ink);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  min-width: 0;
  box-shadow: var(--shadow-card);
  transition: border-color var(--dur-press) var(--ease-out), background-color var(--dur-press) var(--ease-out);
}

.sig-screen-inner.is-paper .sig-slot {
  background: var(--bg-surface-1);
  color: var(--ink-primary);
  border-color: var(--border-subtle);
  border-left: 3px solid var(--accent-primary);
}

.sig-slot.is-selected {
  border-color: var(--accent-primary);
  outline: 2px solid var(--accent-ring);
  outline-offset: -2px;
}

.sig-slot.is-fallback {
  border-style: dashed;
  border-color: var(--warn-dot);
}

.sig-slot.is-dimmed {
  opacity: 0.72;
}

.sig-slot-top,
.sig-slot-body,
.sig-slot-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.sig-slot-info {
  min-width: 0;
  flex: 1 1 auto;
}

.sig-slot-sku,
.sig-slot-var,
.sig-slot-stock {
  font-size: 11px;
  color: var(--syn-key);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sig-screen-inner.is-paper .sig-slot-sku,
.sig-screen-inner.is-paper .sig-slot-var,
.sig-screen-inner.is-paper .sig-slot-stock {
  color: var(--ink-muted);
}

.sig-slot-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--code-ink);
  line-height: 1.3;
}

.sig-screen-inner.is-paper .sig-slot-title {
  color: var(--ink-primary);
}

.sig-slot-prices {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.sig-slot-price {
  font-size: 16px;
  font-weight: 600;
  color: var(--syn-num);
  white-space: nowrap;
}

.sig-screen-inner.is-paper .sig-slot-price {
  color: var(--accent-text);
}

.sig-slot-old {
  font-size: 11.5px;
  color: var(--code-ink);
  text-decoration: line-through;
  opacity: 0.78;
}

.sig-screen-inner.is-paper .sig-slot-old {
  color: var(--ink-muted);
}

.sig-slot-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex: 0 0 auto;
}

.sig-qr-box {
  padding: 4px;
  border-radius: var(--r-xs);
  background: var(--qr-surface);
  color: var(--qr-ink);
  border: 1px solid var(--border-subtle);
}

.sig-qr-box svg {
  width: 36px;
  height: 36px;
  display: block;
}

.sig-slot-qr-lbl {
  font-size: 9.5px;
  color: var(--syn-str);
}

.sig-screen-inner.is-paper .sig-slot-qr-lbl {
  color: var(--ink-muted);
}

/* Pickup Queue Live Board */
.sig-slot--queue {
  grid-column: span 2;
}

.sig-screen-inner.is-portrait-grid .sig-slot--queue {
  grid-column: auto;
}

.sig-queue-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.sig-queue-col {
  padding: 8px;
  border-radius: var(--r-xs);
  border: 1px solid var(--code-border);
  background: var(--code-bg);
}

.sig-screen-inner.is-paper .sig-queue-col {
  background: var(--bg-surface-2);
  border-color: var(--border-subtle);
}

.sig-queue-head {
  font-size: 11px;
  font-weight: 600;
  color: var(--syn-num);
  margin-bottom: 6px;
}

.sig-queue-head.is-ready {
  color: var(--syn-str);
}

.sig-screen-inner.is-paper .sig-queue-head {
  color: var(--warn-text);
}

.sig-screen-inner.is-paper .sig-queue-head.is-ready {
  color: var(--ok-text);
}

.sig-queue-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sig-queue-num {
  padding: 3px 8px;
  border-radius: var(--r-xs);
  font-size: 12px;
  font-weight: 600;
  background: var(--code-head-bg);
  color: var(--code-ink);
  border: 1px solid var(--code-border);
}

.sig-queue-num.is-ready {
  border-color: var(--ok-dot);
  color: var(--syn-str);
}

.sig-screen-inner.is-paper .sig-queue-num {
  background: var(--bg-surface-1);
  color: var(--ink-primary);
  border-color: var(--border-subtle);
}

.sig-insp-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sig-insp-publish {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sig-diff-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
}

/* Dayparting & Canary Pipeline */
.sig-daypart-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.sig-daypart-block {
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: border-color var(--dur-press) var(--ease-out), background-color var(--dur-press) var(--ease-out);
}

.sig-daypart-block.is-active {
  border-color: var(--accent-primary);
  background: var(--accent-soft);
}

.sig-canary-pipeline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.sig-canary-stage {
  padding: 12px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-card);
}

.sig-canary-stage.is-active {
  border-color: var(--accent-primary);
  background: var(--accent-soft);
}

.sig-canary-stage.is-halted {
  border-color: var(--bad-dot);
  background: var(--bad-bg);
}

.sig-watchdog-ladder {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.sig-wd-step {
  padding: 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}

.sig-table-wrap {
  container-type: inline-size;
  container-name: sig-table;
  width: 100%;
  min-width: 0;
  overflow-x: auto;
}

.sig-preset-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.sig-preset-card {
  text-align: left;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  box-shadow: var(--shadow-card);
}

.sig-preset-card.is-active {
  border-color: var(--accent-primary);
  background: var(--accent-soft);
}

.sig-diff-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
}

.sig-snapshot-frame {
  padding: 10px;
  border-radius: var(--r-lg);
  border: 2px solid var(--code-border);
  background: var(--toc-black-bg);
  color: var(--code-ink);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sig-snap-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--syn-punct);
}

.sig-snap-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.sig-snap-tile {
  padding: 8px 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--code-border);
  background: var(--code-head-bg);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

@container workspace (max-width: 1060px) {
  .sig-studio-shell {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .sig-stage-mat {
    grid-column: 1 / -1;
    order: -1;
  }
  .sig-inspector-card {
    position: static;
  }
}

@container workspace (max-width: 960px) {
  .sig-fleet-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@container workspace (max-width: 820px) {
  .sig-canary-pipeline,
  .sig-daypart-grid,
  .sig-watchdog-ladder {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@container workspace (max-width: 680px) {
  .sig-studio-shell {
    grid-template-columns: minmax(0, 1fr);
  }
  .sig-fleet-grid,
  .sig-canary-pipeline,
  .sig-daypart-grid,
  .sig-watchdog-ladder {
    grid-template-columns: minmax(0, 1fr);
  }
}

@container sig-table (max-width: 640px) {
  .sig-table-wrap {
    overflow-x: visible;
  }
  .sig-table-wrap .crm-table {
    display: block;
    width: 100%;
    min-width: 0;
  }
  .sig-table-wrap .crm-table thead {
    display: none;
  }
  .sig-table-wrap .crm-table tbody {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }
  .sig-table-wrap .crm-table.crm-table--dense-default tbody tr,
  .sig-table-wrap .crm-table tbody tr {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    height: auto;
    min-height: 0;
    padding: 12px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-md);
    margin: 0;
    background: var(--bg-surface-2);
  }
  .sig-table-wrap .crm-table tbody td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    height: auto;
    padding: 2px 0;
    border: 0;
    text-align: right;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .sig-table-wrap .crm-table tbody td.sig-td-main {
    display: block;
    order: -1;
    text-align: left;
    padding: 0 0 8px;
    margin-bottom: 2px;
    border-bottom: 1px solid var(--border-subtle);
  }
  .sig-table-wrap .crm-table tbody td[data-label]::before {
    content: attr(data-label);
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 500;
    color: var(--ink-muted);
    text-align: left;
    flex: 0 0 auto;
    max-width: 46%;
  }
  .sig-table-wrap .crm-table tbody td.sig-td-main::before {
    display: none;
  }
  .sig-table-wrap .crm-table tbody td.sig-td-action {
    align-items: center;
    padding-top: 8px;
    margin-top: 2px;
    border-top: 1px solid var(--border-subtle);
  }
}

@media (max-width: 1024px) {
  .sig-preset-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .sig-top-left,
  .sig-top-right {
    width: 100%;
    min-width: 0;
  }
  .sig-top-bar .seg-pills {
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    justify-content: flex-start;
  }
  .sig-preset-row .seg-pills {
    flex-wrap: nowrap;
    padding-bottom: 2px;
  }
  .sig-top-bar .seg-pills .ua-pill {
    flex: 0 0 auto;
    min-height: 44px;
  }
  .sig-preset-grid,
  .sig-snap-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .sig-bezel.fmt-9x16,
  .sig-tv-frame.fmt-9x16 {
    max-width: 256px;
  }
  .sig-screen-card,
  .sig-daypart-block,
  .sig-preset-card,
  .sig-layer-row,
  .sig-top-right .quiet-btn {
    min-height: 44px;
  }
}

/* ==========================================================================
   v5.9 Signage SaaS Extensions (100% Tokenized, Zero Shadows in Dark, Zero Gradients)
   ========================================================================== */

.sig-map-card {
  padding: 12px;
  border-radius: var(--r-card);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sig-map-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.sig-map-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sig-map-scale-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 11px;
  font-weight: 600;
}

.sig-map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 10px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-1);
}

.sig-map-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  min-width: 0;
}

.sig-map-crumb {
  min-height: 32px;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-secondary);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--dur-press) var(--ease-out), color var(--dur-press) var(--ease-out);
}

.sig-map-crumb:hover {
  background: var(--row-hover);
  color: var(--ink-primary);
}

.sig-map-crumb.is-current {
  background: var(--accent-soft);
  color: var(--accent-text);
  border-color: var(--accent-border);
}

.sig-map-crumb-sep {
  color: var(--ink-muted);
  font-size: 12px;
}

.sig-map-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.sig-map-layers-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.sig-map-grid-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 12px;
  align-items: stretch;
}

.sig-map-grid-wrap.is-wide {
  grid-template-columns: minmax(0, 1fr);
}

.sig-map-stage {
  position: relative;
  width: 100%;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: var(--map-ocean);
  touch-action: none;
}

.sig-map-canvas {
  position: relative;
  width: 100%;
  aspect-ratio: 960 / 460;
  min-height: 290px;
}

.sig-map-svg {
  display: block;
  width: 100%;
  height: 100%;
  user-select: none;
}

.sm-ocean { fill: var(--map-ocean); }
.sm-grid-line { stroke: var(--map-grid); stroke-width: 1; vector-effect: non-scaling-stroke; }
.sm-land-muted { fill: var(--map-land-muted); stroke: var(--map-land-muted-stroke); stroke-width: 0.9; vector-effect: non-scaling-stroke; }
.sm-land-focus { fill: var(--map-land-focus); stroke: var(--map-land-focus-stroke); stroke-width: 1.25; vector-effect: non-scaling-stroke; }
.sm-land-ua { fill: var(--map-land-ua); stroke: var(--map-land-ua-stroke); stroke-width: 1.8; vector-effect: non-scaling-stroke; }
.sm-river { fill: none; stroke: var(--map-river); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; opacity: 0.88; }
.sm-city-water { fill: var(--map-river); stroke: var(--map-land-focus-stroke); stroke-width: 1; opacity: 0.85; }
.sm-city-park { fill: var(--map-park); stroke: var(--map-park-stroke); stroke-width: 1; }
.sm-city-block { fill: var(--map-block); stroke: var(--map-land-muted-stroke); stroke-width: 0.75; }
.sm-road-casing { fill: none; stroke: var(--map-road-major-casing); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.sm-road-major { fill: none; stroke: var(--map-road-major); stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; }
.sm-road-minor { fill: none; stroke: var(--map-road-minor); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sm-floor-bg { fill: var(--map-floor-bg); }
.sm-floor-grid { stroke: var(--map-floor-grid); stroke-width: 1; }
.sm-wall-outer { fill: none; stroke: var(--map-wall-outer); stroke-width: 7; stroke-linecap: square; stroke-linejoin: miter; }
.sm-wall-inner { fill: none; stroke: var(--map-wall-inner); stroke-width: 3.5; stroke-linecap: square; }
.sm-glass { fill: var(--map-glass-fill); stroke: var(--map-glass-line); stroke-width: 2; }
.sm-door-arc { fill: none; stroke: var(--map-door-arc); stroke-width: 1.5; stroke-dasharray: 4 3; }
.sm-door-leaf { stroke: var(--map-wall-outer); stroke-width: 2.5; }
.sm-fixture { fill: var(--map-fixture-fill); stroke: var(--map-fixture-stroke); stroke-width: 1.5; }
.sm-label-sea { fill: var(--map-label-sea); font-family: var(--font-mono); font-size: 10.5px; font-style: italic; letter-spacing: 0.14em; pointer-events: none; }
.sm-label-country { fill: var(--map-label-country); font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: 0.08em; pointer-events: none; }
.sm-label-country.is-ua { fill: var(--map-label-ua); font-size: 12.5px; }
.sm-label-city { fill: var(--map-label-city); font-size: 11.5px; font-weight: 700; pointer-events: none; }
.sm-label-zone { fill: var(--ink-muted); font-family: var(--font-mono); font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; pointer-events: none; }
.sm-compass-line { stroke: var(--ink-secondary); stroke-width: 1.4; }
.sm-compass-fill { fill: var(--accent-primary); }
.sm-scale-bar { fill: none; stroke: var(--ink-primary); stroke-width: 1.8; }
.sm-scale-txt { fill: var(--ink-secondary); font-family: var(--font-mono); font-size: 10px; font-weight: 600; }

.sm-fov { fill: var(--map-fov-ok); stroke: var(--ok-dot); stroke-width: 1; stroke-opacity: 0.55; pointer-events: none; }
.sm-fov.is-warn { fill: var(--map-fov-warn); stroke: var(--warn-dot); }
.sm-fov.is-bad { fill: var(--map-fov-bad); stroke: var(--bad-dot); }

.sm-node-group { cursor: pointer; }
.sm-node-group:focus-visible { outline: 2px solid var(--accent-ring); }
.sm-cluster-pill { fill: var(--map-cluster-bg); stroke: var(--border-strong); stroke-width: 1.5; }
.sm-node-group.is-selected .sm-cluster-pill { stroke: var(--accent-primary); stroke-width: 2.4; }
.sm-ring-track { fill: none; stroke: var(--map-cluster-ring-bg); stroke-width: 3.5; }
.sm-ring-ok { fill: none; stroke: var(--ok-dot); stroke-width: 3.5; }
.sm-ring-warn { fill: none; stroke: var(--warn-dot); stroke-width: 3.5; }
.sm-ring-bad { fill: none; stroke: var(--bad-dot); stroke-width: 3.5; }
.sm-badge-fill { fill: var(--ok-dot); }
.sm-badge-fill.is-warn { fill: var(--warn-dot); }
.sm-badge-fill.is-bad { fill: var(--bad-dot); }
.sm-node-num { fill: var(--ink-primary); font-family: var(--font-sans); font-size: 13.5px; font-weight: 800; text-anchor: middle; }
.sm-node-cap { fill: var(--ink-primary); font-size: 11.5px; font-weight: 700; }
.sm-node-sub { fill: var(--ink-secondary); font-family: var(--font-mono); font-size: 9.5px; }
.sm-screen-rect { fill: var(--map-screen-body); stroke: var(--map-screen-bezel); stroke-width: 2; }
.sm-screen-glow { fill: none; stroke: var(--ok-dot); stroke-width: 2.5; }
.sm-screen-glow.is-warn { stroke: var(--warn-dot); }
.sm-screen-glow.is-bad { stroke: var(--bad-dot); }
.sm-node-group.is-selected .sm-screen-glow { stroke: var(--accent-primary); stroke-width: 3.2; }
.sm-hit-target { fill: var(--map-ocean); opacity: 0; }

.sig-map-zoom-controls {
  position: absolute;
  right: 10px;
  top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 3;
}

.sig-map-zoom-btn {
  min-width: 36px;
  min-height: 36px;
  padding: 0 8px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface-1);
  color: var(--ink-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sig-map-zoom-btn:hover {
  border-color: var(--accent-primary);
  background: var(--accent-soft);
}

.sig-map-legend {
  position: absolute;
  left: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-1);
  font-size: 11px;
  color: var(--ink-secondary);
  z-index: 3;
}

.sig-map-leg-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
  background: var(--ok-dot);
}
.sig-map-leg-dot.is-warn { background: var(--warn-dot); }
.sig-map-leg-dot.is-bad { background: var(--bad-dot); }

.sig-map-side-card {
  padding: 12px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.sig-map-mini-tv {
  border-radius: var(--r-md);
  border: 2px solid var(--code-border);
  background: var(--toc-black-bg);
  padding: 3px;
  overflow: hidden;
}

.sig-map-mini-tv .sig-tv-viewport {
  pointer-events: none;
  border-radius: var(--r-xs);
}

.sig-map-side-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.sig-map-side-actions .ua-btn--primary {
  grid-column: 1 / -1;
}

.sig-map-store-chips {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sig-map-store-row {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  color: var(--ink-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font: inherit;
  cursor: pointer;
}

.sig-map-store-row:hover {
  border-color: var(--accent-primary);
}

.sig-wall-geo-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 12px;
  align-items: start;
}
.sig-wall-geo-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sig-tile-crops {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.sig-sched-sim {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(160px, 0.7fr) minmax(0, 1fr);
  gap: 12px;
  align-items: end;
}
.sig-hardening-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.sig-dpad-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

@media (max-width: 1024px) {
  .sig-map-grid-wrap {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 767px) {
  .sig-wall-geo-grid,
  .sig-sched-sim,
  .sig-hardening-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .sig-map-zoom-btn {
    min-width: 44px;
    min-height: 44px;
  }
  .sig-map-crumb {
    min-height: 44px;
    padding: 6px 10px;
  }
  .sig-map-canvas {
    min-height: 220px;
  }
  .sig-map-legend {
    display: none;
  }
}

/* ==========================================================================
   v6.0 Commercial TV Display Canvas, Inspector Pickers & Fullscreen TV Player
   (100% Tokenized: Zero #hex, Zero rgb/rgba, Zero gradients, Zero ease-in, Zero infinite)
   ========================================================================== */

.sig-tv-frame {
  background: var(--toc-black-bg);
  border: 2px solid var(--code-border);
  border-radius: var(--r-lg);
  padding: 6px;
  width: 100%;
  max-width: 720px;
  margin-inline: auto;
  min-width: 0;
  box-shadow: var(--shadow-card);
}

.sig-tv-frame.fmt-9x16 {
  max-width: 292px;
}

.sig-tv-stage-stack {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: var(--r-sm);
  background: var(--tv-stage-well, var(--toc-black-bg));
  perspective: 1400px;
}

.sig-tv-stage-stack.fmt-16x9,
.sig-tv-stage-stack.fmt-2x2 {
  aspect-ratio: 16 / 9;
}

.sig-tv-stage-stack.fmt-9x16 {
  aspect-ratio: 9 / 16;
}

.sig-tv-slide-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  will-change: transform, opacity;
  backface-visibility: hidden;
}

.sig-tv-slide-layer .sig-tv-viewport {
  width: 100%;
  height: 100%;
  border-radius: 0;
}

.sig-tv-slide-layer.is-outgoing {
  z-index: 1;
  pointer-events: none;
}

.sig-tv-slide-layer.is-incoming {
  z-index: 2;
}

.sig-tv-progress-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0.45cqi;
  min-height: 3px;
  z-index: 6;
  background: var(--tv-progress-track);
  pointer-events: none;
  overflow: hidden;
}

.sig-tv-progress-fill {
  width: 100%;
  height: 100%;
  background: var(--tv-progress-fill, var(--tv-accent));
  transform-origin: left center;
  transform: scaleX(0);
  animation: sigDwellFill var(--sig-dwell-ms, 10000ms) linear forwards;
}

.sig-tv-progress-fill.is-paused {
  animation-play-state: paused;
}

.sig-tv-viewport {
  position: relative;
  width: 100%;
  container-type: inline-size;
  overflow: hidden;
  border-radius: var(--r-sm);
  background: var(--tv-bg);
  color: var(--tv-ink);
  font-family: var(--tv-font-body);
}

.sig-tv-viewport.fmt-16x9,
.sig-tv-viewport.fmt-2x2 {
  aspect-ratio: 16 / 9;
}

.sig-tv-viewport.fmt-9x16 {
  aspect-ratio: 9 / 16;
}

.sig-tv-bg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.sig-tv-bg-tint {
  position: absolute;
  inset: 0;
  background: var(--tv-backdrop-tint);
  pointer-events: none;
}

.sig-tv-layer {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 3.1cqi 3.6cqi 2.5cqi;
  gap: 1.9cqi;
  min-width: 0;
  min-height: 0;
}

.sig-tv-viewport.fmt-9x16 .sig-tv-layer {
  padding: 4.5cqi 4.2cqi 3.6cqi;
  gap: 2.6cqi;
}

.sig-tv-brandbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 2cqi;
  border-bottom: 1px solid var(--tv-border);
  padding-bottom: 1.2cqi;
  flex: 0 0 auto;
  min-width: 0;
}

.sig-tv-wordmark {
  font-family: var(--tv-font-display);
  font-size: 2.75cqi;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tv-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sig-tv-headline {
  font-size: 1.6cqi;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tv-ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sig-tv-viewport.fmt-9x16 .sig-tv-brandbar {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.6cqi;
}

.sig-tv-viewport.fmt-9x16 .sig-tv-wordmark {
  font-size: 4.5cqi;
  max-width: 100%;
}

.sig-tv-viewport.fmt-9x16 .sig-tv-headline {
  font-size: 2.35cqi;
  max-width: 100%;
}

.sig-tv-zone {
  position: relative;
  text-align: left;
  border: 1px solid var(--tv-border);
  background: var(--tv-scrim);
  color: var(--tv-ink);
  border-radius: 1.1cqi;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  font: inherit;
  min-width: 0;
  min-height: 0;
  transition: border-color var(--dur-press) var(--ease-out), background-color var(--dur-press) var(--ease-out);
}

.sig-tv-zone.is-selected {
  border-color: var(--tv-accent);
  outline: 2px solid var(--tv-accent);
  outline-offset: -2px;
}

.sig-tv-zone.is-dimmed {
  opacity: 0.56;
}

.sig-tv-viewport.is-player-mode .sig-tv-zone {
  cursor: default;
  outline: none;
  border-color: var(--tv-border);
}

.sig-tv-photo-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sig-tv-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.45cqi 1.1cqi;
  border-radius: 0.6cqi;
  background: var(--tv-accent);
  color: var(--tv-accent-ink);
  font-size: 1.45cqi;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sig-tv-pill.is-soft {
  background: var(--tv-surface-elev);
  color: var(--tv-ink);
  border: 1px solid var(--tv-border);
}

.sig-tv-viewport.fmt-9x16 .sig-tv-pill {
  font-size: 2.6cqi;
  padding: 0.9cqi 2.1cqi;
  border-radius: 1cqi;
}

.sig-tv-price-row {
  display: flex;
  align-items: baseline;
  gap: 1.2cqi;
  flex-wrap: wrap;
}

/* Retail Impact Price Tag System & Kopecks */
.sig-kop {
  font-size: 0.56em;
  font-weight: 800;
  vertical-align: super;
  line-height: 0;
  margin-left: 0.06em;
}

/* Keeping typography alignment crisp inside TV zones */

.sig-tv-price.is-promo {
  color: var(--tv-price-promo);
}

.sig-tv-old-price {
  font-family: var(--tv-font-price);
  font-size: 2cqi;
  color: var(--tv-ink-muted);
  text-decoration: line-through;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sig-tv-qr-card {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45cqi;
  padding: 0.7cqi;
  border-radius: 0.9cqi;
  background: var(--tv-qr-bg);
  color: var(--tv-qr-ink);
  flex: 0 0 auto;
}

.sig-tv-qr-card svg {
  width: 5.2cqi;
  height: 5.2cqi;
  display: block;
}

.sig-tv-qr-lbl {
  font-size: 1.1cqi;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.sig-tv-viewport.fmt-9x16 .sig-tv-qr-card {
  padding: 1.4cqi;
  border-radius: 1.4cqi;
}

.sig-tv-viewport.fmt-9x16 .sig-tv-qr-card svg {
  width: 12cqi;
  height: 12cqi;
}

.sig-tv-viewport.fmt-9x16 .sig-tv-qr-lbl {
  font-size: 2.1cqi;
}

/* Template 1: Hero Split + Bottom Strip */
.sig-tpl-hero-split {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 1.8cqi;
}

.sig-hs-copy {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2.4cqi;
  gap: 1.2cqi;
  background: var(--tv-scrim-strong);
}

.sig-hs-title {
  font-family: var(--tv-font-display);
  font-size: 3.7cqi;
  font-weight: 700;
  line-height: 1.08;
  color: var(--tv-ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sig-hs-sub {
  font-size: 1.8cqi;
  color: var(--tv-ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sig-hs-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.4cqi;
}

.sig-hs-bottom .sig-tv-price {
  font-size: 4.5cqi;
}

.sig-hs-media {
  position: relative;
  border-radius: 1.1cqi;
  overflow: hidden;
  border: 1px solid var(--tv-border);
  background: var(--tv-surface);
  min-height: 0;
}

.sig-hs-strip {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.4cqi;
}

.sig-hs-mini {
  display: grid;
  grid-template-columns: 7.4cqi minmax(0, 1fr);
  align-items: center;
  gap: 1.2cqi;
  padding: 1cqi;
}

.sig-hs-mini-thumb {
  width: 7.4cqi;
  height: 7.4cqi;
  border-radius: 0.75cqi;
  overflow: hidden;
  background: var(--tv-surface);
  flex: 0 0 auto;
}

.sig-hs-mini-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4cqi;
}

.sig-hs-mini-title {
  font-size: 1.75cqi;
  font-weight: 600;
  color: var(--tv-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sig-hs-mini-sub {
  font-size: 1.35cqi;
  color: var(--tv-ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sig-hs-mini-info .sig-tv-price {
  font-size: 2.35cqi;
}

/* Template 2: Editorial 2x2 Showcase Grid */
.sig-tpl-editorial-grid {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 1.8cqi;
}

.sig-eg-card {
  display: grid;
  grid-template-columns: 38% minmax(0, 1fr);
  min-height: 0;
}

.sig-eg-media {
  position: relative;
  background: var(--tv-surface);
  min-height: 0;
  overflow: hidden;
}

.sig-eg-media .sig-tv-xray-chip {
  top: 0.7cqi;
  left: 0.7cqi;
  right: auto;
  max-width: 90%;
}

.sig-eg-body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.8cqi 2cqi;
  gap: 0.8cqi;
  min-width: 0;
}

.sig-eg-title {
  font-family: var(--tv-font-display);
  font-size: 2.4cqi;
  font-weight: 700;
  line-height: 1.12;
  color: var(--tv-ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sig-eg-sub {
  font-size: 1.45cqi;
  color: var(--tv-ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sig-eg-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1cqi;
}

.sig-eg-foot .sig-tv-price {
  font-size: 2.95cqi;
}

/* Template 3: Cafe QSR Menu Board */
.sig-tpl-cafe-board {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 1.8cqi;
}

.sig-cafe-hero {
  display: grid;
  grid-template-rows: 58% 42%;
  min-height: 0;
}

.sig-cafe-hero-media {
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.sig-cafe-hero-body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.6cqi 2cqi;
  background: var(--tv-scrim-strong);
}

.sig-cafe-hero-title {
  font-family: var(--tv-font-display);
  font-size: 3cqi;
  font-weight: 700;
  line-height: 1.05;
  text-transform: uppercase;
  color: var(--tv-ink);
}

.sig-cafe-hero-body .sig-tv-price {
  font-size: 4cqi;
}

.sig-cafe-list {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.2cqi;
  min-height: 0;
}

.sig-cafe-row {
  flex: 1 1 0;
  display: grid;
  grid-template-columns: 8cqi minmax(0, 1fr) auto;
  align-items: center;
  gap: 1.5cqi;
  padding: 1.1cqi 1.6cqi;
  background: var(--tv-scrim-strong);
}

.sig-cafe-row-thumb {
  width: 8cqi;
  height: 8cqi;
  border-radius: 0.9cqi;
  overflow: hidden;
  background: var(--tv-surface);
}

.sig-cafe-row-title {
  font-family: var(--tv-font-display);
  font-size: 2.35cqi;
  font-weight: 700;
  line-height: 1.1;
  color: var(--tv-ink);
}

.sig-cafe-row-sub {
  font-size: 1.45cqi;
  color: var(--tv-ink-muted);
  margin-top: 0.35cqi;
}

.sig-cafe-row .sig-tv-price {
  font-size: 3.1cqi;
}

.sig-cafe-mods {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2cqi;
  padding: 1.15cqi 1.8cqi;
  border-radius: 0.8cqi;
  background: var(--tv-surface-elev);
  border: 1px solid var(--tv-border);
  font-size: 1.6cqi;
  font-weight: 500;
  color: var(--tv-ink);
}

/* Template 4: Vertical Window Totem 9:16 */
.sig-tpl-totem {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 2cqi;
}

.sig-totem-hero {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 52% 48%;
}

.sig-totem-media {
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.sig-totem-body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2.5cqi 2.8cqi;
  background: var(--tv-scrim-strong);
  gap: 1.2cqi;
}

.sig-totem-title {
  font-family: var(--tv-font-display);
  font-size: 5.4cqi;
  font-weight: 700;
  line-height: 1.06;
  color: var(--tv-ink);
}

.sig-totem-sub {
  font-size: 2.75cqi;
  color: var(--tv-ink-muted);
}

.sig-totem-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.8cqi;
}

.sig-totem-foot .sig-tv-price {
  font-size: 6.8cqi;
}

.sig-totem-companion {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 12.5cqi minmax(0, 1fr) auto;
  align-items: center;
  gap: 2cqi;
  padding: 1.9cqi 2.2cqi;
  background: var(--tv-scrim-strong);
}

.sig-totem-comp-thumb {
  width: 12.5cqi;
  height: 12.5cqi;
  border-radius: 1.2cqi;
  overflow: hidden;
  background: var(--tv-surface);
}

.sig-totem-comp-title {
  font-family: var(--tv-font-display);
  font-size: 3.3cqi;
  font-weight: 700;
  line-height: 1.1;
  color: var(--tv-ink);
}

.sig-totem-companion .sig-tv-price {
  font-size: 3.9cqi;
}

/* Template 5: Bezel-Aware 2x2 Panoramic Video Wall */
.sig-tpl-wall {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 0.9cqi;
  background: var(--toc-black-bg);
  padding: 0.4cqi;
  border-radius: 0.8cqi;
}

.sig-wall-tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2cqi 2.2cqi;
  background: var(--tv-scrim-strong);
  border-radius: 0.6cqi;
  min-height: 0;
}

.sig-wall-tile--photo {
  position: relative;
  padding: 0;
  background: var(--tv-surface);
}

.sig-wall-photo-cap {
  position: absolute;
  left: 1.6cqi;
  right: 1.6cqi;
  bottom: 1.4cqi;
  padding: 1.2cqi 1.5cqi;
  border-radius: 0.8cqi;
  background: var(--tv-scrim-strong);
  display: flex;
  flex-direction: column;
  gap: 0.45cqi;
}

.sig-wall-title {
  font-family: var(--tv-font-display);
  font-size: 2.35cqi;
  font-weight: 700;
  line-height: 1.1;
  color: var(--tv-ink);
}

.sig-wall-sub {
  font-size: 1.45cqi;
  color: var(--tv-ink-muted);
}

.sig-wall-tile .sig-tv-price {
  font-size: 3.1cqi;
}

.sig-ral-strip {
  display: flex;
  align-items: center;
  gap: 0.9cqi;
  margin-top: 0.6cqi;
}

.sig-ral-chip {
  width: 3.2cqi;
  height: 3.2cqi;
  border-radius: 0.5cqi;
  border: 1px solid var(--tv-border);
  flex: 0 0 auto;
}

.sig-ral-chip.is-ral-8017 { background: var(--ral-8017); }
.sig-ral-chip.is-ral-7024 { background: var(--ral-7024); }
.sig-ral-chip.is-ral-3005 { background: var(--ral-3005); }
.sig-ral-chip.is-ral-6005 { background: var(--ral-6005); }
.sig-ral-chip.is-ral-9003 { background: var(--ral-9003); }

/* Template 6: Live CRM Queue TV + Impulse Showcase */
.sig-tpl-queue {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: 1.52fr 0.88fr;
  gap: 1.8cqi;
}

.sig-queue-board {
  display: grid;
  grid-template-columns: 0.88fr 1.12fr;
  gap: 1.5cqi;
  padding: 1.8cqi;
  background: var(--tv-scrim-strong);
}

.sig-tv-qcol {
  display: flex;
  flex-direction: column;
  gap: 1.1cqi;
  min-width: 0;
}

.sig-tv-qcol-title {
  font-size: 1.65cqi;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tv-ink-muted);
}

.sig-tv-qcol-title.is-ready {
  color: var(--tv-accent);
}

.sig-tv-qchips {
  display: flex;
  flex-direction: column;
  gap: 0.9cqi;
}

.sig-tv-qchip {
  padding: 1cqi 1.4cqi;
  border-radius: 0.8cqi;
  font-family: var(--font-mono);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.sig-tv-qchip.is-prep {
  background: var(--tv-prep-bg);
  color: var(--tv-prep-ink);
  font-size: 2.7cqi;
}

.sig-tv-qchip.is-ready {
  background: var(--tv-ready-bg);
  color: var(--tv-ready-ink);
  font-size: 4.3cqi;
  padding: 1.3cqi 1.6cqi;
}

.sig-queue-rail {
  display: flex;
  flex-direction: column;
  gap: 1.5cqi;
  min-height: 0;
}

.sig-queue-promo {
  flex: 1 1 0;
  display: grid;
  grid-template-columns: 11cqi minmax(0, 1fr);
  gap: 1.4cqi;
  padding: 1.2cqi;
  background: var(--tv-scrim-strong);
  align-items: center;
}

.sig-queue-promo-thumb {
  width: 11cqi;
  height: 100%;
  max-height: 12cqi;
  border-radius: 0.8cqi;
  overflow: hidden;
  background: var(--tv-surface);
}

.sig-queue-promo-title {
  font-family: var(--tv-font-display);
  font-size: 2cqi;
  font-weight: 700;
  line-height: 1.12;
  color: var(--tv-ink);
}

.sig-queue-promo .sig-tv-price {
  font-size: 2.75cqi;
}

/* Operator X-Ray Telemetry Overlay (Strictly OFF in Customer View) */
.sig-tv-xray-chip {
  position: absolute;
  top: 0.9cqi;
  right: 0.9cqi;
  z-index: 4;
  padding: 0.3cqi 0.8cqi;
  border-radius: 0.5cqi;
  background: var(--toc-black-bg);
  color: var(--syn-num);
  border: 1px solid var(--accent-primary);
  font-family: var(--font-mono);
  font-size: 1.35cqi;
  font-weight: 600;
  pointer-events: none;
  max-width: 85%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sig-tv-viewport.fmt-9x16 .sig-tv-xray-chip {
  font-size: 2.4cqi;
  padding: 0.5cqi 1.1cqi;
}

.sig-tv-viewport.is-hide-xray .sig-tv-xray-chip {
  display: none;
}

/* Mobile Zone Selector Rail */
.sig-zone-rail {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-top: 8px;
}

.sig-zone-rail::-webkit-scrollbar {
  display: none;
}

.sig-zone-rail-btn {
  min-height: 46px;
  flex: 0 0 auto;
  padding: 6px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-1);
  color: var(--ink-secondary);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.sig-zone-rail-btn.is-active {
  border-color: var(--accent-primary);
  background: var(--accent-soft);
  color: var(--accent-text);
}

/* Studio Inspector Pickers (2-Tab Clean UI) */
.sig-insp-seg {
  margin-bottom: 4px;
}

.sig-tpl-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.sig-tpl-btn,
.sig-font-btn {
  min-height: 44px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  color: var(--ink-primary);
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  transition: border-color var(--dur-press) var(--ease-out), background-color var(--dur-press) var(--ease-out);
}

.sig-tpl-btn b,
.sig-font-btn b {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
}

.sig-tpl-btn span,
.sig-font-btn span {
  font-size: 10.5px;
  color: var(--ink-muted);
}

.sig-tpl-btn.is-active,
.sig-font-btn.is-active {
  border-color: var(--accent-primary);
  background: var(--accent-soft);
}

.sig-theme-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.sig-theme-btn {
  min-height: 44px;
  padding: 6px 4px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  color: var(--ink-primary);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: border-color var(--dur-press) var(--ease-out);
}

.sig-theme-btn.is-active {
  border-color: var(--accent-primary);
  outline: 2px solid var(--accent-ring);
  outline-offset: -2px;
}

.sig-theme-swatches {
  display: flex;
  align-items: center;
  gap: 3px;
}

.sig-sw-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
}

.sig-sw-dot.is-bg { background: var(--tv-bg); }
.sig-sw-dot.is-acc { background: var(--tv-accent); }
.sig-sw-dot.is-ink { background: var(--tv-ink); }

.sig-theme-name {
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.sig-photo-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.sig-photo-btn {
  aspect-ratio: 1 / 1;
  min-height: 44px;
  padding: 0;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--dur-press) var(--ease-out);
}

.sig-photo-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sig-photo-btn.is-active {
  border-color: var(--accent-primary);
  outline: 2px solid var(--accent-ring);
  outline-offset: -2px;
}

.sig-photo-btn.is-none {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-secondary);
  padding: 4px;
  text-align: center;
}

.sig-backdrop-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.sig-backdrop-btn {
  aspect-ratio: 16 / 9;
  min-height: 36px;
  padding: 0;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  color: var(--ink-secondary);
  font-size: 10.5px;
  font-weight: 600;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sig-backdrop-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sig-backdrop-btn.is-active {
  border-color: var(--accent-primary);
  outline: 2px solid var(--accent-ring);
  outline-offset: -2px;
}

.sig-file-inp-hidden {
  display: none;
  font-size: 16px;
}

.sig-upload-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.sig-xray-summary {
  padding: 8px 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  font-size: 11.5px;
  color: var(--ink-secondary);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* Fullscreen TV Player Preview Modal */
.sheet-panel.sheet-panel--tv-player {
  position: fixed;
  inset: 0;
  z-index: 170;
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  border-radius: 0;
  border: 0;
  background: var(--cinema-bg);
  color: var(--cinema-ink);
  box-shadow: none;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
  opacity: 0;
  transform: translate3d(0, 12px, 0);
}

.sheet-panel.sheet-panel--tv-player.open {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

html:has(.sheet-panel--tv-player.open) .toast-stack {
  display: none;
}

.sig-player-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  min-width: 0;
}

.sig-player-hud-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  min-width: 0;
}

.sig-player-meta {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sig-player-meta .ord-id {
  color: var(--cinema-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sig-player-meta .sub-txt {
  color: var(--cinema-ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sig-player-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.sig-cinema-btn {
  min-height: 44px;
  padding: 0 13px;
  border-radius: var(--r-pill);
  border: 1px solid var(--cinema-border);
  background: var(--cinema-surface);
  color: var(--cinema-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
  transition: border-color var(--dur-press) var(--ease-out), background-color var(--dur-press) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .sig-cinema-btn:hover {
    background: var(--cinema-surface-hover);
  }
}

.sig-cinema-btn.is-icon-only {
  width: 44px;
  padding: 0;
}

.sig-cinema-btn.is-active {
  background: var(--cinema-surface-active);
  border-color: var(--cinema-border-active);
  color: var(--cinema-accent);
}

.sig-cinema-btn svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.sig-cinema-tx-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--cinema-border);
  background: var(--cinema-surface);
  color: var(--cinema-ink-muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.sig-player-stage {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.sig-player-stage .sig-tv-stage-stack.fmt-16x9,
.sig-player-stage .sig-tv-stage-stack.fmt-2x2,
.sig-player-stage .sig-tv-viewport.fmt-16x9,
.sig-player-stage .sig-tv-viewport.fmt-2x2 {
  width: min(94vw, calc((100dvh - 156px) * 16 / 9));
  max-width: 1280px;
}

.sig-player-stage .sig-tv-stage-stack.fmt-9x16,
.sig-player-stage .sig-tv-viewport.fmt-9x16 {
  width: min(86vw, calc((100dvh - 156px) * 9 / 16));
  max-width: 440px;
}

.sig-player-center-ctrl {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.sig-player-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sig-player-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--cinema-dot-border);
  background: var(--cinema-dot-bg);
  cursor: pointer;
  padding: 0;
  transition: width var(--dur-press) var(--ease-out), background-color var(--dur-press) var(--ease-out);
}

.sig-player-dot.is-active {
  width: 22px;
  background: var(--cinema-accent);
  border-color: var(--cinema-accent);
}

@media (max-width: 520px) {
  .sig-cinema-btn-lbl-mobile-hide {
    display: none;
  }
  .sig-cinema-tx-pill {
    display: none;
  }
}

/* ==========================================================================
   v8.0 Broadcast Motion Graphics Layers & Progress Track
   (WAAPI + Canvas2D driven; Zero #hex, Zero rgb/rgba, Zero gradients, Zero infinite)
   ========================================================================== */

.sig-tv-fx-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  display: block;
}

.sig-fx-bridge {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  overflow: hidden;
}

.sig-fx-prism-beam {
  position: absolute;
  top: -15%;
  bottom: -15%;
  width: 44%;
  background: var(--tv-fx-prism-grad);
  transform: translate3d(-120%, 0, 0) skewX(-18deg);
  will-change: transform, opacity;
}

.sig-fx-shutter-blade {
  position: absolute;
  top: -12%;
  bottom: -12%;
  width: 42%;
  background: var(--tv-fx-shutter-bg);
  border-left: 2px solid var(--tv-fx-seam-glow);
  will-change: transform, opacity;
}

.sig-fx-curtain-seam {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--tv-fx-seam-glow);
  will-change: transform, opacity;
}

.sig-fx-impact-flash {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 36%;
  background: var(--tv-fx-impact-bar);
  will-change: transform, opacity;
}

.sig-fx-aperture-ring {
  position: absolute;
  width: 72cqi;
  height: 72cqi;
  left: 72%;
  top: 48%;
  margin-left: -36cqi;
  margin-top: -36cqi;
  border-radius: 50%;
  border: 2px solid var(--tv-fx-seam-glow);
  will-change: transform, opacity;
}

.sig-fx-sheen-target {
  position: relative;
  overflow: hidden;
}

.sig-fx-sheen-sweep {
  position: absolute;
  top: -20%;
  bottom: -20%;
  width: 55%;
  background: var(--tv-fx-sheen-grad);
  pointer-events: none;
  transform: translate3d(-160%, 0, 0) skewX(-20deg);
  will-change: transform, opacity;
}

@keyframes sigDwellFill {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

.sig-tv-price-tag {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: baseline;
  gap: 0.35cqi;
  padding: 0.55cqi 1.15cqi;
  border-radius: 0.55cqi;
  background: var(--tv-tag-reg-bg);
  color: var(--tv-tag-reg-ink);
  font-family: var(--tv-font-price);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
  box-shadow: var(--shadow-card);
}

.sig-tv-price {
  position: relative;
  font-family: var(--tv-font-price);
  font-weight: 700;
  color: var(--tv-price);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  line-height: 1;
}

.sig-tv-price-tag.is-promo {
  background: var(--tv-tag-promo-bg);
  color: var(--tv-tag-promo-ink);
}

.sig-tv-unit-lbl {
  font-size: 0.34em;
  font-weight: 700;
  opacity: 0.88;
  margin-left: 0.2cqi;
  white-space: nowrap;
}

.sig-tv-old-tag {
  display: inline-flex;
  align-items: baseline;
  padding: 0.25cqi 0.65cqi;
  border-radius: 0.38cqi;
  background: var(--tv-old-tag-bg);
  color: var(--tv-old-tag-ink);
  font-family: var(--tv-font-price);
  font-size: 1.55cqi;
  font-weight: 800;
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sig-tv-promo-dates {
  font-size: 1.1cqi;
  font-weight: 600;
  color: var(--tv-promo-date-ink);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.sig-tv-stamp {
  display: inline-flex;
  align-items: center;
  padding: 0.45cqi 1.2cqi;
  border-radius: 0.55cqi;
  border: 2px solid var(--tv-stamp-border);
  background: var(--tv-stamp-bg);
  color: var(--tv-stamp-ink);
  font-family: var(--tv-font-display);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.sig-tv-price-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4cqi;
  min-width: 0;
}

/* Template 7: Full-Bleed Food Billboard */
.sig-tpl-billboard {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  border-radius: 1.1cqi;
  overflow: hidden;
  border: 1px solid var(--tv-border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.sig-bb-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sig-bb-scrim {
  position: absolute;
  inset: 0;
  background: var(--tv-billboard-scrim);
  pointer-events: none;
}

.sig-bb-main {
  position: relative;
  z-index: 2;
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: 0.96fr 1.04fr;
  padding: 2.2cqi 2.6cqi;
  gap: 2cqi;
  align-items: stretch;
}

.sig-bb-hero-col {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.9cqi;
  padding: 1.35cqi 1.55cqi;
  border-radius: 1cqi;
  min-width: 0;
}

.sig-bb-stamp-row {
  display: flex;
  align-items: center;
  gap: 1cqi;
  flex-wrap: wrap;
}

.sig-bb-hero-col .sig-tv-stamp {
  font-size: 3.1cqi;
  padding: 0.5cqi 1.5cqi;
}

.sig-bb-title {
  font-family: var(--tv-font-display);
  font-size: 4.1cqi;
  font-weight: 800;
  line-height: 1.03;
  color: var(--tv-ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sig-bb-sub {
  font-size: 1.75cqi;
  font-weight: 500;
  color: var(--tv-ink-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sig-bb-hero-col .sig-tv-price-tag,
.sig-bb-hero-col .sig-tv-price {
  font-size: 4.85cqi;
  padding: 0.55cqi 1.15cqi;
}

.sig-bb-hero-col .sig-tv-old-tag {
  font-size: 1.75cqi;
}

.sig-bb-hero-col .sig-tv-promo-dates {
  font-size: 1.35cqi;
}

.sig-bb-right-rail {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-end;
  gap: 1cqi;
  min-width: 0;
}

.sig-bb-mini-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1cqi;
}

.sig-bb-mini-card {
  display: grid;
  grid-template-columns: 6.2cqi minmax(0, 1fr);
  align-items: center;
  gap: 0.9cqi;
  padding: 0.85cqi;
  background: var(--tv-scrim-strong);
}

.sig-bb-mini-thumb {
  width: 6.2cqi;
  height: 6.2cqi;
  border-radius: 0.65cqi;
  overflow: hidden;
  background: var(--tv-surface);
}

.sig-bb-mini-title {
  font-size: 1.45cqi;
  font-weight: 700;
  color: var(--tv-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sig-bb-mini-card .sig-tv-price-tag,
.sig-bb-mini-card .sig-tv-price {
  font-size: 2.15cqi;
  padding: 0.35cqi 0.7cqi;
}

/* Template 8: Draft Beverage 6-Tap Board */
.sig-tpl-taps {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 1.1cqi;
}

.sig-taps-grid {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 1.2cqi;
}

.sig-tap-card {
  display: grid;
  grid-template-columns: 35% minmax(0, 1fr);
  gap: 0.85cqi;
  padding: 0.75cqi 0.9cqi;
  background: var(--tv-scrim-strong);
  min-height: 0;
  align-items: stretch;
}

.sig-tap-media {
  position: relative;
  border-radius: 0.75cqi;
  overflow: hidden;
  background: var(--tv-surface);
  min-height: 0;
}

.sig-tap-info {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.35cqi;
  min-width: 0;
}

.sig-tap-title-box {
  padding: 0.35cqi 0.65cqi;
  border-radius: 0.45cqi;
  border: 1px solid var(--tv-chip-border);
  background: var(--tv-surface);
  display: flex;
  flex-direction: column;
  gap: 0.1cqi;
}

.sig-tap-name {
  font-family: var(--tv-font-display);
  font-size: 1.56cqi;
  font-weight: 800;
  line-height: 1.05;
  text-transform: uppercase;
  color: var(--tv-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sig-tap-style {
  font-size: 1.05cqi;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--tv-ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sig-tap-specs {
  font-size: 1.08cqi;
  line-height: 1.18;
  color: var(--tv-ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sig-tap-price-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2cqi;
}

.sig-tap-price-wrap .sig-tv-price-tag {
  font-size: 2.35cqi;
  padding: 0.35cqi 0.72cqi;
}

.sig-tap-price-wrap .sig-tv-old-tag {
  font-size: 1.25cqi;
  padding: 0.18cqi 0.5cqi;
}

.sig-tap-price-wrap .sig-tv-promo-dates {
  font-size: 0.98cqi;
}

.sig-tap-price-wrap .sig-tv-price {
  font-size: 2.4cqi;
}

.sig-tap-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.4cqi;
  padding: 0.75cqi 1.5cqi;
  border-radius: 0.7cqi;
  border: 1px solid var(--tv-border);
  background: var(--tv-strip-bg);
}

.sig-tap-footer-title {
  font-family: var(--tv-font-display);
  font-size: 1.95cqi;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tv-strip-accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sig-tap-footer-note {
  font-size: 1.25cqi;
  font-weight: 600;
  color: var(--tv-ink-muted);
  white-space: nowrap;
}

/* 9:16 Totem Grid + PET Bottle Tare Strip Mode */
.sig-totem-tare-shell {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 1.25cqi;
}

.sig-totem-tare-strip {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(4, auto);
  align-items: center;
  gap: 0.9cqi;
  padding: 1.15cqi 1.4cqi;
  border-radius: 1cqi;
  border: 1px solid var(--tv-border);
  background: var(--tv-strip-bg);
}

.sig-totem-tare-lbl {
  font-size: 2.1cqi;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--tv-strip-accent);
}

.sig-tare-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.6cqi 1.05cqi;
  border-radius: 0.7cqi;
  background: var(--tv-tag-reg-bg);
  color: var(--tv-tag-reg-ink);
  font-family: var(--tv-font-price);
  line-height: 1.05;
}

.sig-tare-chip b { font-size: 1.75cqi; font-weight: 700; }
.sig-tare-chip span { font-size: 2.4cqi; font-weight: 900; font-variant-numeric: tabular-nums; }

.sig-totem-tap-grid {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 1.25cqi;
}

.sig-totem-tap-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.15cqi;
  gap: 0.6cqi;
  background: var(--tv-scrim-strong);
  min-height: 0;
}

.sig-totem-tap-top {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: 42% minmax(0, 1fr);
  gap: 1cqi;
  align-items: center;
}

.sig-totem-tap-img {
  width: 100%;
  height: 100%;
  border-radius: 0.9cqi;
  overflow: hidden;
  background: var(--tv-surface);
}

.sig-totem-tap-title {
  font-family: var(--tv-font-display);
  font-size: 2.55cqi;
  font-weight: 800;
  line-height: 1.06;
  text-transform: uppercase;
  color: var(--tv-ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sig-totem-tap-sub {
  font-size: 1.8cqi;
  color: var(--tv-ink-muted);
  margin-top: 0.35cqi;
}

.sig-totem-tap-card .sig-tv-price-tag {
  font-size: 3.45cqi;
  padding: 0.5cqi 1.1cqi;
}

.sig-totem-tap-card .sig-tv-old-tag {
  font-size: 1.95cqi;
  padding: 0.22cqi 0.7cqi;
}

.sig-totem-tap-card .sig-tv-promo-dates {
  font-size: 1.55cqi;
}

/* Template 9: Fashion Lookbook Split */
.sig-tpl-lookbook {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: 0.94fr 1.06fr;
  gap: 1.8cqi;
}

.sig-lb-photo-col {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 0;
}

.sig-lb-photo-scrim {
  position: absolute;
  inset: 0;
  background: var(--tv-lookbook-scrim);
  pointer-events: none;
}

.sig-lb-photo-cap {
  position: relative;
  z-index: 2;
  margin: 1.25cqi;
  padding: 1.45cqi 1.7cqi;
  border-radius: 0.9cqi;
  border: 1px solid var(--tv-border);
  background: var(--tv-scrim-strong);
  display: flex;
  flex-direction: column;
  gap: 0.55cqi;
}

.sig-lb-photo-cap .sig-hs-title {
  font-size: 2.85cqi;
}

.sig-lb-right-col {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.3cqi;
  min-width: 0;
  min-height: 0;
}

.sig-lb-details-card {
  padding: 1.8cqi 2cqi;
  background: var(--tv-scrim-strong);
  display: flex;
  flex-direction: column;
  gap: 1.1cqi;
}

.sig-lb-size-row {
  display: flex;
  align-items: center;
  gap: 0.65cqi;
  flex-wrap: wrap;
}

.sig-lb-size-chip {
  padding: 0.4cqi 0.95cqi;
  border-radius: 0.5cqi;
  border: 1px solid var(--tv-chip-border);
  background: var(--tv-chip-bg);
  color: var(--tv-ink);
  font-size: 1.25cqi;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.sig-lb-details-card .sig-tv-price,
.sig-lb-details-card .sig-tv-price-tag {
  font-size: 3.8cqi;
}

.sig-lb-pair-grid {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 1.2cqi;
}

.sig-lb-pair-card {
  display: grid;
  grid-template-columns: 9.5cqi minmax(0, 1fr) auto;
  align-items: center;
  gap: 1.15cqi;
  padding: 0.95cqi 1.15cqi;
  background: var(--tv-scrim-strong);
}

.sig-lb-pair-thumb {
  width: 9.5cqi;
  height: 100%;
  border-radius: 0.8cqi;
  overflow: hidden;
  background: var(--tv-surface);
}

.sig-lb-pair-card .sig-eg-title {
  font-size: 2cqi;
}

.sig-lb-pair-card .sig-tv-price,
.sig-lb-pair-card .sig-tv-price-tag {
  font-size: 2.25cqi;
}

/* Template 10: Electronics Tech Spec Hero */
.sig-tpl-tech {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: 1.32fr 0.68fr;
  gap: 1.6cqi;
}

.sig-tech-hero {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  background: var(--tv-scrim-strong);
}

.sig-tech-hero-top {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 1.6cqi;
  padding: 2cqi 2.2cqi;
  min-height: 0;
}

.sig-tech-info {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1cqi;
  min-width: 0;
}

.sig-tech-title {
  font-family: var(--tv-font-display);
  font-size: 3.1cqi;
  font-weight: 700;
  line-height: 1.08;
  color: var(--tv-ink);
}

.sig-tech-specs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65cqi;
}

.sig-tech-spec-chip {
  padding: 0.55cqi 0.85cqi;
  border-radius: 0.55cqi;
  border: 1px solid var(--tv-chip-border);
  background: var(--tv-chip-bg);
  color: var(--tv-ink);
  font-family: var(--font-mono);
  font-size: 1.25cqi;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sig-tech-media {
  position: relative;
  border-radius: 1cqi;
  overflow: hidden;
  border: 1px solid var(--tv-border);
  background: var(--tv-surface);
  min-height: 0;
}

.sig-tech-hero-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2cqi;
  padding: 1.3cqi 2.2cqi;
  border-top: 1px solid var(--tv-border);
  background: var(--tv-surface-ghost);
}

.sig-tech-hero-foot .sig-tv-price,
.sig-tech-hero-foot .sig-tv-price-tag {
  font-size: 4cqi;
}

.sig-tech-installment {
  display: inline-flex;
  align-items: center;
  padding: 0.45cqi 0.95cqi;
  border-radius: 0.55cqi;
  border: 1px solid var(--tv-installment-border);
  background: var(--tv-installment-bg);
  color: var(--tv-installment-ink);
  font-size: 1.3cqi;
  font-weight: 700;
  white-space: nowrap;
}

.sig-tech-rail {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.3cqi;
  min-height: 0;
}

.sig-tech-mini {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.2cqi;
  gap: 0.8cqi;
  background: var(--tv-scrim-strong);
  min-height: 0;
}

.sig-tech-mini-media {
  flex: 1 1 0;
  min-height: 0;
  border-radius: 0.75cqi;
  overflow: hidden;
  background: var(--tv-surface);
}

.sig-tech-mini-title {
  font-family: var(--tv-font-display);
  font-size: 1.85cqi;
  font-weight: 700;
  color: var(--tv-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sig-tech-mini .sig-tv-price,
.sig-tech-mini .sig-tv-price-tag {
  font-size: 2.35cqi;
}

/* Studio Inspector Transition & Speed Pickers */
.sig-tx-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.sig-speed-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

/* ==========================================================================
   v8.1 Screen Inspector Drawer Live TV Preview, Scroll Stability & Fleet Cards
   ========================================================================== */

.sig-shell,
#sigMapHost,
#sigStudioInspectorHost,
#sigWallGeoBody {
  overflow-anchor: none;
}

.sig-drawer-tv-card {
  padding: 10px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sig-drawer-tv-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--ink-muted);
}

.sig-drawer-layout-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sig-drawer-quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.sig-drawer-quick-grid .quiet-btn {
  width: 100%;
  min-height: 44px;
  justify-content: center;
}

.sig-drawer-slot-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sig-sc-layout-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  font-size: 12px;
  color: var(--ink-secondary);
}

.sig-sc-layout-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 420px) {
  .sig-drawer-quick-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ==========================================================================
   Signage v9.0 Pro Layout Constructor, Interactive Canvas, Timeline & Widgets
   ========================================================================== */

.sig-studio-shell.is-pro-canvas {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr) 304px;
  grid-template-areas:
    "left stage right"
    "timeline timeline timeline";
  gap: var(--sp-2);
  align-items: start;
  overflow-anchor: none;
  position: relative;
  isolation: isolate;
  z-index: 1;
}

.sig-studio-shell.is-pro-canvas .sig-layers-card {
  grid-area: left;
  max-height: 620px;
  overflow-y: auto;
  overflow-anchor: none;
}

.sig-studio-shell.is-pro-canvas .sig-layers-card > *,
.sig-studio-shell.is-pro-canvas .sig-inspector-card > * {
  flex-shrink: 0;
}

.sig-studio-shell.is-pro-canvas .sig-stage-mat {
  grid-area: stage;
}

.sig-studio-shell.is-pro-canvas .sig-inspector-card {
  grid-area: right;
  position: static;
  max-height: 620px;
  overflow-y: auto;
  overflow-anchor: none;
}

.sig-studio-mobtabs {
  display: none;
  grid-area: mobtabs;
}

.sig-wall-calc-card {
  margin-top: var(--sp-4);
}

.sig-pro-canvas-mount {
  position: relative;
  width: 100%;
}

.sig-canvas-stage {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
}

.sig-tv-frame.is-pro-frame {
  width: 100%;
  max-width: 100%;
}

.sig-tv-frame.is-pro-frame.fmt-9x16 {
  max-width: 310px;
}

.sig-tv-viewport.is-interactive-canvas {
  touch-action: pan-y pinch-zoom;
  user-select: none;
  -webkit-user-select: none;
  overflow: visible;
  isolation: isolate;
  z-index: 1;
}

.sig-tv-viewport.is-player-mode.is-canvas-scene {
  overflow: hidden;
}

.sig-tv-viewport.is-drop-over {
  outline: 2px dashed var(--sig-sel-stroke);
  outline-offset: -3px;
}

.sig-grid-svg,
.sig-snap-svg,
.sig-safe-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
}

.sig-grid-svg line {
  stroke: var(--sig-grid-stroke);
  stroke-width: 0.3;
}

.sig-safe-svg rect {
  stroke: var(--sig-safe-stroke);
  stroke-width: 0.45;
}

.sig-safe-badge {
  position: absolute;
  top: 5.5%;
  left: 5.5%;
  z-index: 5;
  font-size: 9px;
  padding: 2px 6px;
  border-radius: var(--r-xs);
  background: var(--sig-safe-lbl-bg);
  color: var(--sig-safe-lbl-ink);
  pointer-events: none;
}

.sig-snap-guide {
  stroke: var(--sig-snap-line);
  stroke-width: 0.45;
  stroke-dasharray: 1.5 1.2;
}

.sig-region-frame {
  position: absolute;
  transform-origin: center center;
  touch-action: pan-y;
  cursor: move;
}

.sig-region-frame.is-selected {
  touch-action: none;
}

.sig-region-frame.is-locked {
  cursor: not-allowed;
}

.sig-region-frame.is-drop-target .sig-region-clip {
  outline: 2px dashed var(--sig-sel-stroke);
}

.sig-region-clip {
  position: relative;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  overflow: hidden;
  border-radius: inherit;
  container-type: size;
  isolation: isolate;
  transform: translateZ(0);
  background: var(--tv-surface);
}

.sig-region-frame.is-eff-outline .sig-region-clip {
  border: 1px solid var(--tv-border);
}

.sig-region-frame.is-eff-glow .sig-region-clip {
  border: 1.5px solid var(--tv-accent);
}

.sig-region-frame.is-eff-elevated .sig-region-clip {
  background: var(--tv-surface-elev);
  border: 1px solid var(--tv-border);
}

.sig-region-stack {
  position: relative;
  width: 100%;
  height: 100%;
}

.sig-clip-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  overflow: hidden;
}

.sig-active-overlay {
  position: absolute;
  z-index: 60;
  transform-origin: center center;
  pointer-events: none;
}

.sig-active-overlay .sig-sel-outline {
  inset: -1px;
  border-color: var(--sig-sel-stroke);
  background: var(--sig-sel-fill);
}

.sig-active-overlay .sig-reg-tag,
.sig-active-overlay .sig-rot-readout {
  display: inline-block;
}

.sig-active-overlay:not(.is-locked) .sig-resize-handle,
.sig-active-overlay:not(.is-locked) .sig-rot-handle {
  display: block;
}

.sig-sel-outline {
  position: absolute;
  inset: -1px;
  pointer-events: none;
  border: 1.5px solid transparent;
  border-radius: inherit;
  z-index: 30;
}

.sig-region-frame.is-selected .sig-sel-outline {
  border-color: var(--sig-sel-stroke);
  background: var(--sig-sel-fill);
}

.sig-reg-tag,
.sig-reg-chain-pill,
.sig-rot-readout {
  display: none;
  position: absolute;
  font-size: 10px;
  line-height: 1.1;
  padding: 2px 6px;
  border-radius: var(--r-xs);
  pointer-events: none;
  white-space: nowrap;
}

.sig-reg-tag {
  top: -18px;
  left: 0;
  background: var(--sig-sel-badge-bg);
  color: var(--sig-sel-badge-ink);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sig-reg-chain-pill {
  top: 4px;
  right: 4px;
  z-index: 8;
  background: var(--sig-chain-bg);
  color: var(--sig-chain-ink);
  border: 1px solid var(--sig-chain-border);
}

.sig-rot-readout {
  top: -36px;
  left: 50%;
  transform: translateX(14px);
  background: var(--sig-rot-bg);
  color: var(--sig-rot-ink);
  border: 1px solid var(--sig-rot-border);
}

.sig-region-frame .sig-reg-chain-pill {
  display: inline-block;
}

.sig-resize-handle,
.sig-rot-handle {
  display: none;
  pointer-events: auto;
  touch-action: none;
}

.sig-region-frame.is-selected:not(.is-locked) .sig-resize-handle,
.sig-region-frame.is-selected:not(.is-locked) .sig-rot-handle {
  display: block;
}

.sig-resize-handle {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--sig-handle-bg);
  border: 1.5px solid var(--sig-handle-border);
}

.sig-resize-handle::before,
.sig-rot-handle::before {
  content: "";
  position: absolute;
  inset: -10px;
}

.sig-resize-handle.is-nw { top: -5px; left: -5px; cursor: nwse-resize; }
.sig-resize-handle.is-n  { top: -5px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.sig-resize-handle.is-ne { top: -5px; right: -5px; cursor: nesw-resize; }
.sig-resize-handle.is-e  { top: 50%; right: -5px; transform: translateY(-50%); cursor: ew-resize; }
.sig-resize-handle.is-se { bottom: -5px; right: -5px; cursor: nwse-resize; }
.sig-resize-handle.is-s  { bottom: -5px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.sig-resize-handle.is-sw { bottom: -5px; left: -5px; cursor: nesw-resize; }
.sig-resize-handle.is-w  { top: 50%; left: -5px; transform: translateY(-50%); cursor: ew-resize; }

.sig-rot-handle {
  position: absolute;
  top: -22px;
  left: 50%;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  border-radius: 999px;
  background: var(--sig-rot-bg);
  border: 2px solid var(--sig-rot-border);
  cursor: grab;
  padding: 0;
}

/* Left Panel Widgets, Media, Layers */
.sig-left-seg {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.sig-ed-widget-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sig-ed-widget-card {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 7px 9px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  color: var(--ink-primary);
  text-align: left;
  cursor: pointer;
}

.sig-ed-widget-card:hover {
  border-color: var(--accent-primary);
}

.sig-ed-w-ico {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  background: var(--bg-surface-1);
  border: 1px solid var(--border-subtle);
  color: var(--accent-primary);
}

.sig-ed-w-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sig-ed-w-copy b {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
}

.sig-ed-w-copy span {
  font-size: 11px;
  color: var(--ink-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sig-ed-preset-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
}

.sig-ed-preset-grid .quiet-btn {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  white-space: normal;
  min-height: 36px;
}

.sig-ed-grid-btns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.sig-ed-grid-btns .quiet-btn {
  white-space: normal;
  text-align: center;
  justify-content: center;
  padding: 5px 4px;
  min-height: 38px;
  line-height: 1.15;
}

.sig-ed-media-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.sig-ed-media-thumb {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  color: var(--ink-secondary);
  font-size: 11px;
  text-align: left;
  cursor: pointer;
}

.sig-ed-media-thumb img {
  width: 100%;
  height: 54px;
  object-fit: cover;
  border-radius: var(--r-xs);
}

.sig-ed-media-thumb span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sig-icon-mini {
  min-width: 28px;
  min-height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--r-xs);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-1);
  color: var(--ink-secondary);
  cursor: pointer;
}

.sig-layer-row.is-hidden-reg {
  opacity: 0.55;
}

/* Right Inspector Controls */
.sig-snap-pills,
.sig-clip-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.sig-geom-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.sig-rot-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  margin-top: 6px;
}

.sig-rot-steppers {
  display: flex;
  gap: 4px;
}

.sig-check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.sig-check-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-primary);
  min-height: 32px;
  cursor: pointer;
}

.sig-reg-actions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sig-clip-insp-box {
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sig-chain-pick-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  max-height: 112px;
  overflow-y: auto;
  padding: 6px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
}

.sig-chain-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 8px;
  border-radius: var(--r-md);
  border: 1px solid var(--sig-chain-border);
  background: var(--sig-chain-bg);
  color: var(--sig-chain-ink);
  font-size: 12px;
}

/* Bottom Multi-Region Timeline */
.sig-timeline-dock {
  grid-area: timeline;
  background: var(--sig-tl-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-card);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-anchor: none;
}

.sig-timeline-dock[data-collapsed="true"] .sig-tl-body {
  display: none;
}

.sig-tl-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.sig-tl-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-x: auto;
  overflow-anchor: none;
}

.sig-tl-ruler-row,
.sig-tl-lane {
  display: grid;
  grid-template-columns: 156px minmax(420px, 1fr);
  gap: 8px;
  align-items: stretch;
  min-width: 580px;
}

.sig-tl-lane-lbl {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  background: var(--sig-tl-ruler-bg);
  font-size: 11px;
  color: var(--ink-secondary);
  min-width: 0;
}

.sig-tl-reg-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--ink-primary);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.sig-tl-reg-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sig-tl-chain-tag,
.sig-tl-pin-tag {
  font-size: 9px;
  padding: 1px 4px;
  border-radius: var(--r-xs);
  flex: 0 0 auto;
}

.sig-tl-chain-tag {
  background: var(--sig-chain-bg);
  color: var(--sig-chain-ink);
  border: 1px solid var(--sig-chain-border);
}

.sig-tl-pin-tag {
  background: var(--sig-clip-widget-bg);
  color: var(--sig-clip-widget-ink);
}

.sig-tl-plus-btn {
  flex: 0 0 24px;
  height: 24px;
  border-radius: var(--r-xs);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-1);
  color: var(--ink-primary);
  cursor: pointer;
}

.sig-tl-ruler-track {
  position: relative;
  height: 24px;
  background: var(--sig-tl-ruler-bg);
  border-radius: var(--r-sm);
  cursor: ew-resize;
  touch-action: none;
}

.sig-tl-ruler-svg {
  width: 100%;
  height: 22px;
  display: block;
}

.sig-tl-ruler-svg line {
  stroke: var(--sig-tl-tick);
  stroke-width: 1;
}

.sig-tl-ruler-svg line.is-major {
  stroke: var(--sig-tl-tick-major);
  stroke-width: 1.25;
}

.sig-tl-ruler-svg text {
  fill: var(--sig-tl-tick-major);
  font-size: 10px;
  font-family: var(--font-mono);
}

.sig-tl-playhead {
  position: absolute;
  top: 0;
  bottom: -240px;
  width: 2px;
  background: var(--sig-playhead);
  pointer-events: none;
  z-index: 12;
}

.sig-tl-ph-cap {
  position: absolute;
  top: -1px;
  left: -4px;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--sig-playhead);
}

.sig-tl-lanes {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 184px;
  overflow-y: auto;
  overflow-anchor: none;
}

.sig-tl-lane {
  min-height: 36px;
}

.sig-tl-lane.is-selected .sig-tl-lane-lbl {
  border: 1px solid var(--sig-sel-stroke);
}

.sig-tl-track-bars {
  display: flex;
  gap: 3px;
  align-items: stretch;
  background: var(--sig-tl-lane-bg);
  border-radius: var(--r-sm);
  padding: 3px;
  overflow: hidden;
}

.sig-tl-lane.is-alt .sig-tl-track-bars {
  background: var(--sig-tl-lane-alt);
}

.sig-tl-clip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-width: 0;
  padding: 4px 6px;
  border-radius: var(--r-xs);
  border: 1px solid var(--sig-clip-sku-border);
  border-left-width: 3px;
  background: var(--sig-clip-sku-bg);
  color: var(--sig-clip-sku-ink);
  font-size: 11px;
  cursor: pointer;
}

.sig-tl-clip.cat-media { border-color: var(--sig-clip-media-border); border-left-color: var(--sig-clip-media-bar); background: var(--sig-clip-media-bg); color: var(--sig-clip-media-ink); }
.sig-tl-clip.cat-sku   { border-color: var(--sig-clip-sku-border);   border-left-color: var(--sig-clip-sku-bar);   background: var(--sig-clip-sku-bg);   color: var(--sig-clip-sku-ink); }
.sig-tl-clip.cat-queue { border-color: var(--sig-clip-queue-border); border-left-color: var(--sig-clip-queue-bar); background: var(--sig-clip-queue-bg); color: var(--sig-clip-queue-ink); }
.sig-tl-clip.cat-widget{ border-color: var(--sig-clip-widget-border);border-left-color: var(--sig-clip-widget-bar);background: var(--sig-clip-widget-bg);color: var(--sig-clip-widget-ink); }
.sig-tl-clip.cat-ticker{ border-color: var(--sig-clip-ticker-border);border-left-color: var(--sig-clip-ticker-bar);background: var(--sig-clip-ticker-bg);color: var(--sig-clip-ticker-ink); }

.sig-tl-clip.is-repeat {
  opacity: 0.55;
}

.sig-tl-clip.is-selected,
.sig-tl-clip.is-live {
  outline: 1.5px solid var(--sig-sel-stroke);
}

.sig-tl-clip-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.sig-tl-clip-dur {
  flex: 0 0 auto;
  font-size: 10px;
}

/* ==========================================================================
   8 Modular Canvas Widgets (Container-Aware Inside Any Region Size)
   ========================================================================== */

.sig-w-sku {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  padding: min(4cqi, 5cqh);
  gap: min(3cqi, 3cqh);
  background: var(--tv-surface);
  color: var(--tv-ink);
  position: relative;
  overflow: hidden;
}

.sig-w-sku.var-editorial {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: min(4cqi, 5cqh);
  align-items: stretch;
}

.sig-w-sku.var-compact {
  display: grid;
  grid-template-columns: 32% minmax(0, 1fr);
  gap: min(4cqi, 5cqh);
  align-items: center;
}

.sig-w-sku-media {
  position: relative;
  flex: 1 1 48%;
  min-height: 0;
  border-radius: min(4cqi, 5cqh);
  overflow: hidden;
  background: var(--tv-stage-well);
}

.sig-w-sku.var-editorial .sig-w-sku-media,
.sig-w-sku.var-compact .sig-w-sku-media {
  height: 100%;
}

.sig-w-badge {
  position: absolute;
  top: 4%;
  left: 4%;
  font-size: clamp(7px, min(5cqi, 8cqh), 11px);
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--tv-tag-promo-bg);
  color: var(--tv-tag-promo-ink);
  letter-spacing: 0.03em;
}

.sig-w-badge.is-swap {
  background: var(--tv-ready-bg);
  color: var(--tv-ready-ink);
}

.sig-w-sku-body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: min(2cqi, 3cqh);
  min-width: 0;
  min-height: 0;
}

.sig-w-sku-title {
  font-family: var(--tv-font-display);
  font-weight: 700;
  font-size: clamp(10px, min(7.6cqi, 13cqh), 22px);
  line-height: 1.12;
  color: var(--tv-ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sig-w-sku.var-editorial .sig-w-sku-title {
  font-size: clamp(12px, min(5.4cqi, 12cqh), 26px);
}

.sig-w-sku-sub {
  font-size: clamp(8px, min(5.2cqi, 8.5cqh), 13px);
  color: var(--tv-ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sig-w-sku-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}

.sig-w-sku-price {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
}

.sig-w-price-tag {
  display: inline-flex;
  align-items: baseline;
  white-space: nowrap;
  padding: 3px 7px;
  border-radius: 5px;
  background: var(--tv-tag-reg-bg);
  color: var(--tv-tag-reg-ink);
  font-weight: 800;
  font-size: clamp(11px, min(9.5cqi, 15cqh), 24px);
  line-height: 1;
}

.sig-w-price-tag.is-promo {
  background: var(--tv-tag-promo-bg);
  color: var(--tv-tag-promo-ink);
}

.sig-w-old-tag {
  white-space: nowrap;
  font-size: clamp(8px, min(6cqi, 9.5cqh), 14px);
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--tv-old-tag-bg);
  color: var(--tv-old-tag-ink);
  text-decoration: line-through;
  font-weight: 700;
}

.sig-w-price-editorial {
  white-space: nowrap;
  font-family: var(--tv-font-price);
  font-weight: 800;
  font-size: clamp(12px, min(8.2cqi, 14cqh), 26px);
  color: var(--tv-price);
}

.sig-w-price-editorial.is-promo {
  color: var(--tv-price-promo);
}

.sig-w-old-editorial {
  white-space: nowrap;
  font-size: clamp(9px, min(5.5cqi, 9cqh), 14px);
  color: var(--tv-ink-muted);
  text-decoration: line-through;
}

.sig-w-unit {
  font-size: 0.56em;
  font-weight: 500;
  opacity: 0.85;
  margin-left: 2px;
}

.sig-w-mini-qr {
  flex: 0 0 auto;
  width: clamp(28px, 18cqi, 56px);
  padding: 2px;
  border-radius: 4px;
  background: var(--tv-qr-bg);
  color: var(--tv-qr-ink);
}

.sig-w-img {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--tv-stage-well);
}

.sig-w-img-el {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sig-w-img.is-contain .sig-w-img-el {
  object-fit: contain;
}

.sig-w-img-scrim {
  position: absolute;
  inset: 0;
  background: var(--tv-lookbook-scrim);
}

.sig-w-img-cap {
  position: absolute;
  left: 5cqi;
  right: 5cqi;
  bottom: 4cqi;
  color: var(--tv-ink);
  font-weight: 600;
  font-size: clamp(10px, 6.2cqi, 20px);
}

.sig-w-clock,
.sig-w-weather {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: min(3cqi, 10cqh) min(4cqi, 14cqh);
  background: var(--tv-surface);
  color: var(--tv-ink);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: min(1.5cqi, 6cqh);
  overflow: hidden;
}

.sig-w-clock-time {
  font-size: clamp(11px, min(18cqi, 46cqh), 32px);
  font-weight: 700;
  line-height: 1;
  color: var(--tv-accent);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sig-w-clock-meta {
  display: flex;
  gap: 6px;
  font-size: clamp(8px, min(7.5cqi, 24cqh), 12px);
  color: var(--tv-ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sig-w-wx-main {
  display: flex;
  align-items: center;
  gap: min(3.5cqi, 10cqh);
  min-width: 0;
}

.sig-w-wx-ico {
  flex: 0 0 auto;
  width: clamp(16px, min(14cqi, 46cqh), 30px);
  color: var(--tv-accent);
  display: inline-flex;
}

.sig-wx-svg {
  width: 100%;
  height: auto;
}

.sig-w-wx-temp {
  font-size: clamp(12px, min(14cqi, 46cqh), 26px);
  font-weight: 700;
  line-height: 1;
  color: var(--tv-ink);
  white-space: nowrap;
}

.sig-w-wx-info {
  min-width: 0;
}

.sig-w-wx-city {
  font-size: clamp(9px, min(6.5cqi, 26cqh), 14px);
  font-weight: 600;
  color: var(--tv-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sig-w-wx-cond,
.sig-w-wx-hourly {
  font-size: clamp(8px, min(5cqi, 20cqh), 11px);
  color: var(--tv-ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sig-w-wx-hourly {
  display: flex;
  gap: 6px;
  padding-top: 2px;
  border-top: 1px solid var(--tv-border);
}

.sig-w-text {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: min(2.5cqi, 10cqh) min(3.5cqi, 16cqh);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: min(1cqi, 5cqh);
  color: var(--tv-ink);
  background: var(--tv-surface);
  overflow: hidden;
}

.sig-w-text.is-surf-tinted { background: var(--tv-scrim); }
.sig-w-text.is-surf-outline { background: transparent; border: 1px solid var(--tv-border); }
.sig-w-text.is-align-center { text-align: center; align-items: center; }
.sig-w-text.is-align-right  { text-align: right;  align-items: flex-end; }

.sig-w-pill {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--tv-accent);
  color: var(--tv-accent-ink);
  font-size: clamp(7px, min(4cqi, 18cqh), 11px);
  font-weight: 700;
  width: fit-content;
}

.sig-w-text-head {
  font-family: var(--tv-font-display);
  font-weight: 700;
  font-size: clamp(10px, min(5cqi, 32cqh), 22px);
  line-height: 1.12;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sig-w-text-sub {
  font-size: clamp(8px, min(3.2cqi, 22cqh), 13px);
  color: var(--tv-ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@container (max-height: 68px) {
  .sig-w-text {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 4px 10px;
  }
  .sig-w-text.is-align-center {
    justify-content: center;
  }
  .sig-w-text.is-align-right {
    justify-content: flex-end;
  }
  .sig-w-text .sig-w-pill {
    flex: 0 0 auto;
    font-size: 9px;
    padding: 2px 7px;
  }
  .sig-w-text-head {
    font-size: clamp(10px, 38cqh, 16px);
    flex: 0 1 auto;
  }
  .sig-w-text-sub {
    font-size: clamp(9px, 28cqh, 12px);
    flex: 0 1 auto;
    min-width: 0;
  }
}

@container (max-height: 52px) {
  .sig-w-text-sub {
    display: none;
  }
  .sig-w-sku.var-compact .sig-w-sku-title {
    -webkit-line-clamp: 1;
  }
  .sig-w-sku.var-compact .sig-w-sku-sub {
    display: none;
  }
}

.sig-w-ticker {
  width: 100%;
  height: 100%;
  background: var(--tv-strip-bg);
  color: var(--tv-ink);
  display: flex;
  align-items: center;
  overflow: hidden;
  border-top: 1px solid var(--tv-border);
}

.sig-w-ticker-track {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  will-change: transform;
}

.sig-w-ticker-seg {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  padding-right: 16px;
  font-size: clamp(11px, 2.2cqi, 18px);
  font-weight: 600;
}

.sig-w-tkr-sep {
  color: var(--tv-accent);
}

.sig-w-qr,
.sig-w-queue {
  box-sizing: border-box;
}

.sig-w-qr {
  width: 100%;
  height: 100%;
  padding: min(4cqi, 6cqh);
  background: var(--tv-surface);
  color: var(--tv-ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5cqi;
}

.sig-w-qr-code {
  flex: 0 0 42%;
  max-width: clamp(44px, 38cqh, 108px);
  padding: 4px;
  border-radius: var(--r-sm);
  background: var(--tv-qr-bg);
  color: var(--tv-qr-ink);
}

.sig-w-qr-code svg {
  width: 100%;
  height: auto;
  display: block;
}

.sig-w-qr-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3cqi;
}

.sig-w-qr-lbl {
  font-size: clamp(10px, 7.5cqi, 18px);
  font-weight: 600;
  line-height: 1.25;
}

.sig-w-queue {
  width: 100%;
  height: 100%;
  padding: 5cqi;
  background: var(--tv-surface);
  color: var(--tv-ink);
  display: flex;
  flex-direction: column;
  gap: 4cqi;
}

.sig-w-q-head {
  font-size: clamp(11px, 6cqi, 18px);
  font-weight: 700;
}

.sig-w-q-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4cqi;
  flex: 1 1 auto;
}

.sig-w-q-col {
  display: flex;
  flex-direction: column;
  gap: 3cqi;
}

.sig-w-q-lbl {
  font-size: clamp(9px, 4.5cqi, 13px);
  font-weight: 600;
  color: var(--tv-prep-ink);
}

.sig-w-q-lbl.is-ready {
  color: var(--tv-ready-ink);
}

.sig-w-q-chips {
  display: flex;
  flex-direction: column;
  gap: 2.5cqi;
}

.sig-w-q-chip {
  padding: 2.5cqi 4cqi;
  border-radius: var(--r-sm);
  font-weight: 700;
  font-size: clamp(11px, 7cqi, 20px);
}

.sig-w-q-chip.is-prep  { background: var(--tv-prep-bg);  color: var(--tv-prep-ink); }
.sig-w-q-chip.is-ready { background: var(--tv-ready-bg); color: var(--tv-ready-ink); }

.sig-player-scrub {
  width: 100%;
  accent-color: var(--cinema-accent);
  cursor: pointer;
}

/* Tablet & Mobile Responsive Layout Constructor */
@container workspace (max-width: 1119px) and (min-width: 720px) {
  .sig-studio-shell.is-pro-canvas {
    grid-template-columns: minmax(250px, 0.9fr) minmax(0, 1.1fr);
    grid-template-areas:
      "stage stage"
      "timeline timeline"
      "left right";
  }
  .sig-studio-shell.is-pro-canvas .sig-layers-card,
  .sig-studio-shell.is-pro-canvas .sig-inspector-card {
    max-height: 520px;
  }
}

@container workspace (max-width: 719px) {
  .sig-studio-shell.is-pro-canvas {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "stage"
      "mobtabs"
      "inspector";
  }
  .sig-studio-mobtabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }
  .sig-studio-mobtabs .ua-pill {
    min-height: 44px;
  }
  .sig-studio-shell.is-pro-canvas [data-sig-pane] {
    display: none;
    grid-area: inspector;
    max-height: none;
  }
  .sig-studio-shell.is-pro-canvas[data-mobile-tab="inspector"] [data-sig-pane="inspector"],
  .sig-studio-shell.is-pro-canvas[data-mobile-tab="library"] [data-sig-pane="library"],
  .sig-studio-shell.is-pro-canvas[data-mobile-tab="timeline"] [data-sig-pane="timeline"] {
    display: flex;
  }
  .sig-geom-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .sig-tl-ruler-row,
  .sig-tl-lane {
    grid-template-columns: 118px minmax(280px, 1fr);
    min-width: 406px;
  }
  .sig-rot-steppers .quiet-btn,
  .sig-snap-pills .quiet-btn,
  .sig-reg-actions-bar .quiet-btn {
    min-height: 44px;
  }
}

/* ==========================================================================
   UA Pro CRM v9.1: Product Catalog CRUD + Pro Real-mm Visual Label Designer
   ========================================================================== */

.cat-shell {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-anchor: none;
}

.cat-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.cat-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.cat-item-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.cat-thumb {
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  object-fit: cover;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  flex-shrink: 0;
}

.cat-name-link {
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  font: inherit;
  font-weight: 700;
  color: var(--ink-primary);
  cursor: pointer;
}
.cat-name-link:hover {
  color: var(--accent-text);
  text-decoration: underline;
}

.cat-row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
}
.cat-row-actions .quiet-btn.sm {
  padding: 6px 7px;
  min-height: 32px;
}

.desktop-orders-card .crm-table.cat-table {
  min-width: 820px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 640px) {
  .form-grid-3 {
    grid-template-columns: minmax(0, 1fr);
  }
}

.cat-modal-photo-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cat-modal-preview {
  width: 56px;
  height: 56px;
  border-radius: var(--r-md);
  object-fit: cover;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface-2);
  flex-shrink: 0;
}

.cat-photo-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  flex: 1;
  min-width: 0;
}

.cat-photo-chip {
  width: 44px;
  height: 44px;
  padding: 2px;
  border-radius: var(--r-sm);
  border: 2px solid var(--border-subtle);
  background: var(--bg-surface-1);
  cursor: pointer;
  flex-shrink: 0;
  overflow: hidden;
}
.cat-photo-chip.is-active {
  border-color: var(--accent-primary);
}
.cat-photo-chip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--r-xs);
  display: block;
}

/* Pro Real-mm Label Studio Layout */
.lbl-studio {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr) 316px;
  gap: 14px;
  align-items: start;
  overflow-anchor: none;
}

.lbl-palette-col,
.lbl-insp-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 760px;
  overflow-y: auto;
}

.lbl-col-block,
.lbl-insp-group,
.lbl-insp-head {
  flex-shrink: 0;
}

.lbl-tpl-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.lbl-tpl-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  color: var(--ink-primary);
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.lbl-tpl-pill.is-active {
  border-color: var(--accent-primary);
  background: var(--accent-soft);
  color: var(--accent-text);
}
.lbl-tpl-pill .sub-txt {
  flex-shrink: 0;
  white-space: nowrap;
}

.lbl-add-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.lbl-add-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 8px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-1);
  color: var(--ink-primary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  min-width: 0;
  text-align: left;
}
.lbl-add-chip:hover {
  border-color: var(--accent-border);
  background: var(--bg-surface-2);
}
.lbl-add-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lbl-layers-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lbl-layer-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: var(--bg-surface-2);
  color: var(--ink-primary);
  font-size: 12px;
  cursor: pointer;
  width: 100%;
  text-align: left;
}
.lbl-layer-row.is-active {
  border-color: var(--accent-primary);
  background: var(--accent-soft);
  color: var(--accent-text);
}
.lbl-layer-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.lbl-stage-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.lbl-toolbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lbl-tool-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.lbl-dim-group,
.lbl-tool-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.lbl-dim-group .crm-select {
  width: auto;
  max-width: 210px;
}

.lbl-mm-pair {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.lbl-mm-pair .crm-input {
  width: 66px;
  text-align: center;
  padding-inline: 6px;
}

.lbl-tool-actions .crm-select {
  width: auto;
}

.lbl-canvas-stage {
  position: relative;
  isolation: isolate;
  z-index: 1;
  background: var(--lbl-stage-well);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-card);
  padding: 18px;
  min-height: 290px;
  display: grid;
  place-items: center;
  overflow: auto;
}

.lbl-ruler-grid {
  display: grid;
  grid-template-columns: 20px auto;
  grid-template-rows: 20px auto;
  gap: 0;
}

.lbl-ruler-corner {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: var(--lbl-ruler-ink);
  background: var(--lbl-ruler-bg);
  border-top-left-radius: var(--r-xs);
  border-right: 1px solid var(--lbl-ruler-tick);
  border-bottom: 1px solid var(--lbl-ruler-tick);
}

.lbl-ruler-top,
.lbl-ruler-left {
  background: var(--lbl-ruler-bg);
  line-height: 0;
}

.lbl-ruler-top {
  border-bottom: 1px solid var(--lbl-ruler-tick);
}

.lbl-ruler-left {
  border-right: 1px solid var(--lbl-ruler-tick);
}

.lbl-ruler-svg line {
  stroke: var(--lbl-ruler-tick);
  stroke-width: 1;
}

.lbl-ruler-svg text {
  fill: var(--lbl-ruler-ink);
  font-family: var(--font-mono);
  font-size: 8.5px;
}

.lbl-paper-box {
  position: relative;
  flex-shrink: 0;
}

.lbl-paper {
  position: relative;
  background: var(--lbl-paper-bg);
  color: var(--lbl-paper-ink);
  border: 1px solid var(--lbl-paper-border);
  box-shadow: var(--lbl-paper-shadow);
  overflow: hidden;
  user-select: none;
  box-sizing: border-box;
}

.lbl-paper.is-mono .lbl-img-el {
  filter: grayscale(100%) contrast(155%);
}

.lbl-grid-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}
.lbl-grid-svg line.is-minor {
  stroke: var(--lbl-grid-minor);
  stroke-width: 0.6;
}
.lbl-grid-svg line.is-major {
  stroke: var(--lbl-grid-major);
  stroke-width: 0.9;
}

.lbl-safe-guide {
  position: absolute;
  border: 1px dashed var(--lbl-safe-stroke);
  pointer-events: none;
  z-index: 0;
}

.lbl-el {
  position: absolute;
  box-sizing: border-box;
  cursor: move;
  touch-action: none;
  color: var(--lbl-paper-ink);
}
.lbl-el.is-locked {
  cursor: default;
}

.lbl-el-rot {
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  box-sizing: border-box;
}

.lbl-text-box {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: 0 2px;
  color: var(--lbl-paper-ink);
  box-sizing: border-box;
  word-break: break-word;
}
.lbl-text-box.is-inverted {
  background: var(--lbl-badge-inv-bg);
  color: var(--lbl-badge-inv-ink);
  padding: 0 4px;
}

.lbl-shape-line {
  width: 100%;
  height: 100%;
  background: var(--lbl-paper-ink);
}

.lbl-barcode-box {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--lbl-paper-ink);
}

.lbl-barcode-svg {
  width: 100%;
  height: 100%;
  display: block;
}
.lbl-barcode-svg.is-square {
  object-fit: contain;
}

.lbl-image-box {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.lbl-image-box.is-bw .lbl-img-el {
  filter: grayscale(100%) contrast(155%);
}

.lbl-img-el {
  width: 100%;
  height: 100%;
  display: block;
}
.lbl-img-el.is-cover {
  object-fit: cover;
}
.lbl-img-el.is-contain {
  object-fit: contain;
}

.lbl-emblem-box {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--lbl-paper-ink);
}
.lbl-emblem-box svg {
  width: 92%;
  height: 92%;
  display: block;
}

.lbl-selection-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 40;
}

.lbl-selection-box {
  position: absolute;
  border: 1.5px solid var(--lbl-sel-stroke);
  background: var(--lbl-sel-fill);
  box-sizing: border-box;
  pointer-events: none;
}

.lbl-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--lbl-handle-bg);
  border: 1.5px solid var(--lbl-handle-border);
  pointer-events: auto;
  touch-action: none;
  box-sizing: border-box;
}
.lbl-handle--nw { left: -5px; top: -5px; cursor: nwse-resize; }
.lbl-handle--n  { left: calc(50% - 5px); top: -5px; cursor: ns-resize; }
.lbl-handle--ne { right: -5px; top: -5px; cursor: nesw-resize; }
.lbl-handle--e  { right: -5px; top: calc(50% - 5px); cursor: ew-resize; }
.lbl-handle--se { right: -5px; bottom: -5px; cursor: nwse-resize; }
.lbl-handle--s  { left: calc(50% - 5px); bottom: -5px; cursor: ns-resize; }
.lbl-handle--sw { left: -5px; bottom: -5px; cursor: nesw-resize; }
.lbl-handle--w  { left: -5px; top: calc(50% - 5px); cursor: ew-resize; }

.lbl-rot-pill {
  position: absolute;
  left: 0;
  bottom: calc(100% + 4px);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 6px;
  border-radius: var(--r-xs);
  background: var(--lbl-sel-stroke);
  color: var(--accent-on);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: auto;
}

.lbl-rot-btn {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 4px;
  border-radius: var(--r-xs);
  background: var(--lbl-paper-bg);
  color: var(--lbl-sel-stroke);
  cursor: pointer;
}
.lbl-rot-btn svg {
  width: 11px;
  height: 11px;
}

.lbl-stage-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.lbl-insp-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.lbl-insp-kind {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 13.5px;
}

.lbl-insp-group {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}
.lbl-insp-group:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.lbl-insp-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.lbl-geom-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}
.lbl-geom-grid label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  color: var(--ink-muted);
}
.lbl-geom-grid .crm-input {
  padding-inline: 5px;
  text-align: center;
  font-size: 12px;
}

.lbl-seg-fit {
  display: flex;
  width: 100%;
}
.lbl-seg-fit .ua-pill {
  flex: 1;
  justify-content: center;
}

.lbl-pt-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.lbl-pt-row .crm-input {
  width: 72px;
  text-align: center;
}

.lbl-style-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}

.lbl-emblem-picker {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}
.lbl-emblem-chip {
  height: 40px;
  padding: 6px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-2);
  color: var(--ink-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lbl-emblem-chip.is-active {
  border-color: var(--accent-primary);
  background: var(--accent-soft);
  color: var(--accent-text);
}
.lbl-emblem-chip svg {
  width: 22px;
  height: 22px;
}

.lbl-print-controls {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.lbl-print-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  align-items: start;
}

.lbl-print-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px;
  border-radius: var(--r-md);
  background: var(--lbl-stage-well);
  border: 1px solid var(--border-subtle);
}

.lbl-code-pre {
  background: var(--lbl-code-bg);
  color: var(--lbl-code-ink);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  padding: 12px;
  font-size: 12px;
  line-height: 1.5;
  overflow-x: auto;
  margin: 0;
}

.lbl-mobile-tabs {
  display: none;
}

#uaPrintLabelsMount {
  display: none;
}

@media (max-width: 1180px) {
  .lbl-studio {
    grid-template-columns: 240px minmax(0, 1fr);
  }
  .lbl-insp-col {
    grid-column: 1 / -1;
    max-height: none;
  }
}

@media (max-width: 960px) {
  .lbl-studio {
    grid-template-columns: minmax(0, 1fr);
  }
  .lbl-stage-col {
    order: 1;
  }
  .lbl-canvas-stage {
    order: 1;
  }
  .lbl-stage-footer {
    order: 2;
  }
  .lbl-toolbar {
    order: 3;
    display: none;
  }
  .lbl-mobile-tabs {
    order: 2;
    display: flex;
    flex-shrink: 0;
  }
  .lbl-mobile-tabs .ua-pill {
    flex: 1;
    justify-content: center;
  }
  .lbl-palette-col {
    order: 3;
    max-height: none;
    display: none;
  }
  .lbl-insp-col {
    order: 4;
    max-height: none;
    display: none;
  }
  .lbl-studio[data-mobile-tab="add"] .lbl-palette-col,
  .lbl-studio[data-mobile-tab="element"] .lbl-insp-col {
    display: flex;
  }
  .lbl-studio[data-mobile-tab="size"] .lbl-toolbar {
    display: flex;
  }
}

@media (max-width: 767px) {
  .cat-top-bar .seg-pills {
    flex-wrap: wrap;
    width: 100%;
  }
  .cat-top-bar .seg-pills .ua-pill {
    flex: 1 1 auto;
    justify-content: center;
  }
  .lbl-canvas-stage {
    padding: 12px;
    min-height: 210px;
  }
  .lbl-geom-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .lbl-studio .crm-input,
  .lbl-studio .crm-select {
    font-size: 16px;
    min-height: 44px;
  }
  .lbl-studio button,
  .cat-shell button,
  .lbl-studio .ua-pill,
  .cat-shell .ua-pill {
    min-height: 44px;
  }
  .lbl-rot-pill .lbl-rot-btn {
    min-height: 26px;
    padding: 2px 6px;
  }
}

@media print {
  body > *:not(#uaPrintLabelsMount) {
    display: none !important;
  }
  #uaPrintLabelsMount {
    display: block !important;
  }
  .lbl-print-page {
    page-break-after: always;
    break-after: page;
  }
  .lbl-print-page .lbl-paper {
    border: 0 !important;
    box-shadow: none !important;
  }
}

/* ==========================================================================
   Reduced Motion Accessibility Override (Must Remain Last)
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .reveal-item,
  .wave-tab-item,
  .msg-bubble.msg-enter,
  .bar-rise,
  .chart-avg-line,
  .chart-line,
  .chart-area,
  .chart-dot,
  .donut-seg,
  .fill-bar__inner,
  .repeat-tick.is-filled,
  .ready-ring-fill,
  .gantt-bar,
  .ua-popover,
  .ua-confirm-target.is-confirmed::before,
  .ua-confirm-target.is-confirmed::after,
  tr.is-confirmed td {
    animation: uaReducedFade 180ms ease both !important;
    animation-delay: 0ms !important;
    transform: none !important;
    clip-path: none !important;
    stroke-dashoffset: 0 !important;
  }
  .sheet-panel,
  .sheet-backdrop,
  .ua-btn__fill,
  .ua-pill::before,
  .bar-fill,
  .bar-col,
  .bar-cap,
  .chart-crosshair,
  .chart-guide-group,
  .chart-dot-group,
  .chart-tooltip,
  .pos-sku-card,
  .finmap-acc-card,
  .funnel-stage-card,
  .sig-screen-card,
  .sig-slot,
  .sig-bezel,
  .sig-tv-zone,
  .sig-theme-btn,
  .sig-tpl-btn,
  .sig-photo-btn,
  .sig-canary-stage,
  .sig-daypart-block,
  .sig-preset-card,
  .sig-map-crumb,
  .sig-map-card,
  .sig-cinema-btn,
  .sig-player-dot,
  .sig-timeline-dock,
  .sig-ed-widget-card,
  .sig-tl-clip,
  .sig-region-frame {
    transition-duration: 120ms !important;
  }
  .sig-tv-fx-canvas,
  .sig-fx-bridge,
  .sig-fx-sheen-sweep {
    display: none !important;
  }
  .sig-tv-slide-layer.is-outgoing {
    animation: uaReducedFadeOut 180ms ease both !important;
    transform: none !important;
    clip-path: none !important;
  }
  .sig-tv-slide-layer.is-incoming,
  .sig-tv-viewport.is-entering [data-tx-beat] {
    animation: uaReducedFade 180ms ease both !important;
    animation-delay: 0ms !important;
    transform: none !important;
    clip-path: none !important;
  }
  .sig-tv-progress-fill {
    animation: none !important;
    transform: scaleX(1) !important;
  }
  .kanban-card.is-dragging { transform: none !important; }
  .cmd-progress-bar { transition: none !important; }
  .odo-reel { transition-duration: 0ms !important; }
  html.ua-theme-vt::view-transition-new(root) { animation: none; clip-path: none; }
}

@keyframes uaReducedFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes uaReducedFadeOut { from { opacity: 1; } to { opacity: 0; } }
