/* UMS Distribution — modern dynamic UI, glass, mobile-safe */

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

:root {
  --text: #0c1222;
  --muted: #5c6578;
  --accent: #3b5bfd;
  --accent-dark: #2d4ae8;
  --accent-glow: rgba(59, 91, 253, 0.45);
  --accent-soft: rgba(59, 91, 253, 0.12);
  --success: #0d9f6e;
  --success-soft: rgba(13, 159, 110, 0.12);
  --surface: rgba(255, 255, 255, 0.78);
  --surface-2: rgba(248, 250, 252, 0.95);
  --glass: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.88);
  --ring: 0 0 0 3px rgba(59, 91, 253, 0.15);
  --shadow: 0 8px 32px rgba(12, 18, 34, 0.07), 0 2px 8px rgba(12, 18, 34, 0.04);
  --shadow-lg: 0 24px 64px rgba(12, 18, 34, 0.12), 0 8px 24px rgba(12, 18, 34, 0.06);
  --shadow-float: 0 20px 50px rgba(59, 91, 253, 0.15);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --tap: 44px;
  --radius: 22px;
  --radius-sm: 14px;
  --danger: #e11d48;
  --ease-spring: cubic-bezier(0.34, 1.3, 0.64, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --sidebar-w: 0px;
}

html {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overscroll-behavior-x: none;
}

body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  max-width: 100vw;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(ellipse 120% 80% at 0% 0%, rgba(147, 197, 253, 0.35), transparent 50%),
    radial-gradient(ellipse 100% 60% at 100% 10%, rgba(196, 181, 253, 0.22), transparent 45%),
    radial-gradient(ellipse 80% 50% at 50% 100%, rgba(165, 243, 252, 0.18), transparent 50%),
    linear-gradient(168deg, #eef2ff 0%, #e8f0fe 38%, #f0f4fb 100%);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-x: none;
}

.gate {
  min-height: 100vh;
  min-height: 100dvh;
  min-height: 100svh;
  min-height: -webkit-fill-available;
  display: grid;
  place-items: center;
  padding: max(1rem, var(--safe-top)) max(1rem, var(--safe-right)) max(1rem, var(--safe-bottom))
    max(1rem, var(--safe-left));
  color: var(--muted);
  font-size: 0.95rem;
}

.dist-sync-banner {
  box-sizing: border-box;
  margin: 0.65rem auto 0;
  max-width: min(1120px, calc(100vw - 2rem));
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  background: rgba(254, 243, 199, 0.92);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #78350f;
  font-size: 0.8125rem;
  line-height: 1.45;
  text-align: center;
}

.dist-sync-banner.hidden {
  display: none !important;
}

.hidden {
  display: none !important;
}

.app {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  min-height: 100svh;
  min-height: -webkit-fill-available;
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 100% 70% at 15% 10%, rgba(147, 197, 253, 0.5), transparent 55%),
    radial-gradient(ellipse 80% 60% at 90% 30%, rgba(196, 181, 253, 0.32), transparent 50%),
    radial-gradient(ellipse 60% 40% at 50% 90%, rgba(165, 243, 252, 0.25), transparent 55%);
  animation: ambient-shift 22s var(--ease-out) infinite alternate;
}

.ambient-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.45) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.45) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 30%, black 15%, transparent 65%);
  opacity: 0.5;
}

@keyframes ambient-shift {
  0% {
    opacity: 1;
    transform: scale(1) translate(0, 0);
  }
  100% {
    opacity: 0.92;
    transform: scale(1.03) translate(-1%, 1%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ambient {
    animation: none;
  }
}

.site-header {
  position: relative;
  z-index: 200;
  flex-shrink: 0;
  padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px
    max(12px, env(safe-area-inset-left));
}

.site-nav {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
  text-decoration: none;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

.nav-brand:hover {
  color: var(--accent);
}

.nav-brand-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

.nav-page-title {
  font-size: clamp(1rem, 3.5vw, 1.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.nav-page-sub {
  margin: 2px 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(52vw, 260px);
}

.badge {
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.14);
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 10px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: color 0.2s, background 0.2s;
  -webkit-tap-highlight-color: transparent;
}

@media (min-width: 420px) {
  .nav-link {
    padding: 0 12px;
    font-size: 0.88rem;
  }
}

.nav-link:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.nav-link[aria-current="page"] {
  color: var(--accent);
  background: rgba(37, 99, 235, 0.14);
}

.nav-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.nav-link-text--short {
  display: none;
}

@media (max-width: 400px) {
  .nav-link-text--full {
    display: none;
  }

  .nav-link-text--short {
    display: inline;
  }
}

.nav-user-wrap {
  display: flex;
  align-items: center;
  max-width: 140px;
}

.user {
  display: none;
  font-size: 0.78rem;
  color: var(--muted);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 520px) {
  .user {
    display: block;
  }
}

.nav-signout {
  flex-shrink: 0;
  min-height: 40px;
  padding: 0 14px;
  font: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.98);
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s, box-shadow 0.2s;
}

.nav-signout:hover {
  background: rgba(255, 255, 255, 0.95);
}

.nav-signout:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 420px) {
  .nav-page-sub {
    display: none;
  }
}

/* —— Desktop: left sidebar nav —— */
@media (min-width: 1024px) {
  :root {
    --sidebar-w: clamp(268px, 22vw, 320px);
  }

  .app {
    flex-direction: row;
    align-items: stretch;
    min-height: 100dvh;
  }

  .ambient,
  .ambient-grid {
    left: var(--sidebar-w);
  }

  .site-header {
    order: -1;
    flex: 0 0 var(--sidebar-w);
    width: var(--sidebar-w);
    max-width: var(--sidebar-w);
    min-height: 100dvh;
    align-self: stretch;
    padding: max(12px, var(--safe-top)) 10px max(16px, var(--safe-bottom)) max(10px, var(--safe-left));
    border-right: 1px solid rgba(148, 163, 184, 0.22);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.5) 0%, rgba(248, 250, 252, 0.35) 100%);
    display: flex;
    flex-direction: column;
  }

  .site-nav {
    flex: 1;
    min-height: 0;
    flex-direction: column;
    align-items: stretch;
    max-width: none;
    width: 100%;
    padding: 16px 12px 20px;
    gap: 12px;
    border-radius: 0 var(--radius) var(--radius) 0;
    box-shadow: 4px 0 28px rgba(12, 18, 34, 0.05), var(--shadow);
  }

  .nav-brand {
    flex: 0 0 auto;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  }

  .nav-page-sub {
    white-space: normal;
    line-height: 1.35;
    max-width: none;
  }

  .nav-links {
    flex: 1 1 auto;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 4px;
    width: 100%;
  }

  .nav-links li {
    width: 100%;
  }

  .nav-links .nav-link {
    width: 100%;
    justify-content: flex-start;
    padding: 0 14px;
    min-height: 42px;
  }

  .nav-user-wrap {
    max-width: none;
    width: 100%;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
  }

  .nav-user-wrap .user {
    display: block;
    max-width: none;
    white-space: normal;
    word-break: break-word;
  }

  .nav-links .nav-signout {
    width: 100%;
    justify-content: center;
    margin-top: 4px;
  }

  .dist-main {
    flex: 1;
    min-width: 0;
    max-width: none;
    margin: 0;
    padding: 12px max(20px, var(--safe-right)) max(28px, var(--safe-bottom)) 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* —— Main —— */
.dist-main {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 8px max(12px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left));
  gap: 20px;
}

/* Hero */
.dist-hero {
  position: relative;
  padding: clamp(1.25rem, 4vw, 2rem);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92) 0%, rgba(248, 250, 252, 0.88) 100%);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.dist-hero-glow {
  position: absolute;
  top: -40%;
  right: -15%;
  width: min(420px, 90vw);
  height: min(420px, 90vw);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.12), transparent 68%);
  pointer-events: none;
}

.dist-hero-top {
  position: relative;
  z-index: 1;
}

.dist-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
}

.dist-eyebrow-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--accent), var(--accent-dark));
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.dist-title {
  margin: 12px 0 0;
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--text);
}

.dist-desc {
  margin: 10px 0 0;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--muted);
  max-width: 38rem;
}

.dist-stat-row {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 12px;
  margin-top: clamp(1.25rem, 3vw, 1.75rem);
}

.dist-stat {
  flex: 1;
  min-width: 120px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(226, 232, 240, 0.95);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.dist-stat--highlight {
  background: linear-gradient(145deg, rgba(37, 99, 235, 0.1), rgba(37, 99, 235, 0.04));
  border-color: rgba(37, 99, 235, 0.18);
}

.dist-stat-value {
  display: block;
  font-size: 1.65rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--text);
}

.dist-stat-label {
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

.dist-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 20px;
  align-self: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(145deg, var(--accent), var(--accent-dark));
  box-shadow: 0 10px 28px rgba(37, 99, 235, 0.38);
  transition: transform 0.15s ease, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.dist-cta:hover {
  box-shadow: 0 12px 32px rgba(37, 99, 235, 0.45);
}

.dist-cta:active {
  transform: scale(0.98);
}

.dist-cta:focus-visible {
  outline: 2px solid var(--accent-dark);
  outline-offset: 3px;
}

.dist-cta--secondary {
  color: var(--accent-dark);
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(37, 99, 235, 0.22);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
}

.dist-cta--secondary:hover {
  background: #fff;
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.12);
}

.dist-hero--layout-page .dist-stat-row {
  align-items: center;
}

/* Panel + table */
.dist-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  min-height: 0;
}

.dist-panel-head {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (min-width: 768px) {
  .dist-panel-head {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.dist-panel-title-wrap {
  min-width: 0;
}

.dist-panel-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.dist-panel-hint {
  margin: 4px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.dist-filter-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 400px;
  padding: 0 16px;
  min-height: var(--tap);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(226, 232, 240, 0.98);
  border-radius: 14px;
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.dist-filter-wrap:focus-within {
  border-color: rgba(37, 99, 235, 0.4);
  box-shadow: 0 4px 28px rgba(37, 99, 235, 0.12), 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.dist-filter-icon {
  color: var(--muted);
  flex-shrink: 0;
}

.dist-filter-wrap input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  outline: none;
}

.dist-filter-wrap input::placeholder {
  color: #94a3b8;
}

.dist-table-card {
  position: relative;
  flex: 1;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  overflow: hidden;
}

.dist-table-scroll {
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  max-height: min(62vh, calc(100dvh - 340px));
}

.dist-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.dist-table th,
.dist-table td {
  padding: 14px 16px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid rgba(226, 232, 240, 0.85);
}

.dist-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: linear-gradient(to bottom, rgba(248, 250, 252, 0.98), rgba(241, 245, 249, 0.95));
  backdrop-filter: blur(8px);
  white-space: nowrap;
  box-shadow: 0 1px 0 rgba(226, 232, 240, 0.9);
}

.dist-col-highlight {
  color: var(--accent);
}

.dist-table tbody tr {
  transition: background 0.15s ease;
}

.dist-table tbody tr:nth-child(even) {
  background: rgba(248, 250, 252, 0.45);
}

.dist-table tbody tr:hover {
  background: rgba(37, 99, 235, 0.06);
}

.dist-table td {
  word-break: break-word;
  max-width: 220px;
  line-height: 1.45;
}

.dist-no-match {
  text-align: center !important;
  padding: 2rem 1rem !important;
  font-size: 0.9rem;
  color: var(--muted);
  max-width: none !important;
  background: rgba(248, 250, 252, 0.6);
}

.dist-table tbody tr td:nth-child(4) {
  font-weight: 500;
  color: #1e40af;
}

.dist-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: clamp(2rem, 6vw, 3.5rem) 1.5rem;
  gap: 8px;
}

.dist-empty-icon {
  color: var(--muted);
  margin-bottom: 4px;
}

.dist-empty-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.dist-empty-text {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.5;
  max-width: 22rem;
}

.dist-empty-cta {
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 22px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(145deg, var(--accent), var(--accent-dark));
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.35);
}

.dist-empty-cta:hover {
  filter: brightness(1.05);
}

.dist-empty-cta:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.dist-table-card:has(.dist-empty:not(.hidden)) .dist-table-scroll {
  display: none;
}

@supports not selector(:has(*)) {
  .dist-table-card.dist-show-empty .dist-table-scroll {
    display: none;
  }
}

/* Electricity flow diagram */
.dist-flow-block {
  position: relative;
  z-index: 1;
  margin-top: clamp(1.25rem, 3vw, 1.75rem);
  padding: clamp(1rem, 3vw, 1.35rem);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.dist-flow-heading {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.dist-flow-lead {
  margin: 8px 0 0;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--muted);
  max-width: 40rem;
}

.dist-flow-diagram {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
}

@media (min-width: 900px) {
  .dist-flow-diagram {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: stretch;
    gap: 8px 12px;
  }
}

.dist-flow-node {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(226, 232, 240, 0.95);
  min-height: 100%;
}

.dist-flow-node--accent {
  border-color: rgba(37, 99, 235, 0.28);
  background: linear-gradient(160deg, rgba(37, 99, 235, 0.08), rgba(255, 255, 255, 0.9));
  box-shadow: 0 8px 28px rgba(37, 99, 235, 0.08);
}

.dist-flow-node-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(145deg, var(--accent), var(--accent-dark));
}

.dist-flow-node--accent .dist-flow-node-badge {
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.dist-flow-node-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.dist-flow-node-text {
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--muted);
}

.dist-flow-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  padding: 4px 0;
  opacity: 0.85;
}

@media (min-width: 900px) {
  .dist-flow-arrow {
    padding: 0;
    align-self: center;
  }
}

@media (max-width: 899px) {
  .dist-flow-arrow svg {
    transform: rotate(90deg);
  }
}

.dist-stat--boxes {
  background: linear-gradient(145deg, rgba(5, 150, 105, 0.08), rgba(255, 255, 255, 0.75));
  border-color: rgba(5, 150, 105, 0.2);
}

/* Distribution boxes panel */
.dist-panel--boxes {
  margin-top: 4px;
}

.dist-panel-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  width: 100%;
}

@media (min-width: 640px) {
  .dist-panel-actions {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    width: auto;
    max-width: 100%;
  }
}

.dist-filter-wrap--compact {
  max-width: 100%;
}

@media (min-width: 640px) {
  .dist-filter-wrap--compact {
    flex: 1;
    min-width: 200px;
    max-width: 320px;
  }
}

.dist-btn-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 18px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: linear-gradient(145deg, var(--success), #047857);
  box-shadow: 0 8px 22px rgba(5, 150, 105, 0.35);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease, box-shadow 0.2s;
}

.dist-btn-add:hover {
  filter: brightness(1.05);
}

.dist-btn-add:active {
  transform: scale(0.98);
}

.dist-btn-add:focus-visible {
  outline: 2px solid var(--success);
  outline-offset: 3px;
}

.dist-table--boxes .dist-col-highlight {
  min-width: 10rem;
}

.dist-table--boxes tbody tr.dist-box-row {
  box-shadow: inset 4px 0 0 var(--dist-feeder-color, rgba(148, 163, 184, 0.5));
}

.dist-feeder-cell {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 280px;
}

.dist-feeder-swatch {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  margin-top: 4px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.12);
}

.dist-feeder-name {
  min-width: 0;
}

.dist-box-name-cell {
  line-height: 1.35;
}

.dist-box-name-main {
  font-weight: 600;
}

.dist-box-name-alt {
  margin-top: 4px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.3;
}

.dist-col-actions {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

.dist-actions-cell {
  text-align: right;
  vertical-align: middle;
}

.dist-action-btn {
  display: inline-block;
  margin: 2px 0 2px 8px;
  padding: 6px 12px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 10px;
  cursor: pointer;
  min-height: 40px;
  -webkit-tap-highlight-color: transparent;
}

.dist-action-btn--danger {
  color: #b91c1c;
  background: rgba(220, 38, 38, 0.08);
  border-color: rgba(220, 38, 38, 0.25);
}

.dist-action-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.dist-map-link {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}

.dist-map-link:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.dist-empty-cta--btn {
  border: none;
  cursor: pointer;
  font: inherit;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ——— Distribution box modal · studio (canvas) ——— */
.dist-dialog.dbx {
  max-width: min(1180px, calc(100vw - 12px));
  width: calc(100vw - 12px);
  max-height: min(96dvh, 980px);
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.dbx-surface {
  display: flex;
  flex-direction: column;
  max-height: min(96dvh, 980px);
  border-radius: calc(var(--radius) + 6px);
  overflow: hidden;
  background: linear-gradient(165deg, #ffffff 0%, #f8fafc 42%, #f1f5f9 100%);
  border: 1px solid rgba(226, 232, 240, 0.98);
  box-shadow:
    0 28px 90px rgba(15, 23, 42, 0.1),
    0 0 0 1px rgba(255, 255, 255, 0.95) inset;
}

.dbx-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.92) 100%);
  border-bottom: 1px solid rgba(226, 232, 240, 0.95);
}

.dbx-kicker {
  margin: 0 0 6px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-dark, #2563eb);
}

.dbx-title {
  margin: 0;
  font-size: clamp(1.2rem, 2.5vw, 1.45rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text, #0c1222);
}

.dbx-lead {
  margin: 8px 0 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--muted, #64748b);
  max-width: 36rem;
}

.dbx-close {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(226, 232, 240, 0.98);
  border-radius: 12px;
  color: #64748b;
  background: rgba(255, 255, 255, 0.95);
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.dbx-close:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.dbx-form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

.dbx-box-form-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0 16px 12px;
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.dbx-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

@media (min-width: 920px) {
  .dbx-layout {
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  }
}

.dbx-rail {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 16px 18px;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border-bottom: 1px solid rgba(226, 232, 240, 0.95);
  max-height: min(52vh, 480px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 920px) {
  .dbx-rail {
    max-height: none;
    border-bottom: none;
    border-right: 1px solid rgba(226, 232, 240, 0.95);
  }
}

.dbx-card {
  padding: 14px 14px 16px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid rgba(226, 232, 240, 0.98);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.dbx-card--grow {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.dbx-card-title {
  margin: 0 0 10px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #475569;
}

.dbx-card-hint {
  margin: 0 0 12px;
  font-size: 0.78rem;
  line-height: 1.45;
  color: #64748b;
}

.dbx-link {
  color: var(--accent-dark, #2563eb);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid rgba(37, 99, 235, 0.35);
}

.dbx-link:hover {
  border-bottom-color: var(--accent-dark, #2563eb);
}

.dbx-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dbx-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.dbx-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #475569;
}

.dbx-input {
  width: 100%;
  padding: 11px 12px;
  font: inherit;
  font-size: 16px;
  color: var(--text, #0c1222);
  border-radius: 10px;
  border: 1px solid rgba(203, 213, 225, 0.95);
  background: #ffffff;
  outline: none;
  box-sizing: border-box;
}

.dbx-input::placeholder {
  color: #94a3b8;
}

.dbx-input:focus {
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.dbx-textarea {
  min-height: 64px;
  resize: vertical;
}

.dbx-search-wrap {
  display: block;
  margin: 0 0 10px;
}

.dbx-search {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  font-size: 16px;
  border-radius: 10px;
  border: 1px solid rgba(203, 213, 225, 0.95);
  background: #ffffff;
  color: var(--text, #0c1222);
  box-sizing: border-box;
}

.dbx-search:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.dbx-template-scroll {
  position: relative;
  flex: 1;
  min-height: 160px;
  max-height: 240px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  border-radius: 12px;
  border: 1px solid rgba(226, 232, 240, 0.98);
  background: #ffffff;
}

.dbx-template-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  padding: 10px;
}

.dbx-tcard {
  margin: 0;
  padding: 0;
  border: 2px solid rgba(226, 232, 240, 0.98);
  border-radius: 12px;
  background: #ffffff;
  cursor: pointer;
  text-align: left;
  font: inherit;
  overflow: hidden;
  touch-action: manipulation;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.dbx-tcard:hover {
  border-color: rgba(37, 99, 235, 0.35);
}

.dbx-tcard:focus-visible {
  outline: none;
  border-color: var(--accent-dark, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.dbx-tcard--on {
  border-color: var(--accent-dark, #2563eb);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.12);
}

.dbx-tcard-thumb {
  aspect-ratio: 4 / 3;
  width: 100%;
  display: block;
  object-fit: cover;
  background: #f1f5f9;
  pointer-events: none;
}

.dbx-tcard-thumb--blank {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
  background: linear-gradient(145deg, #f8fafc, #e2e8f0);
  pointer-events: none;
}

.dbx-tcard-body {
  padding: 8px 8px 10px;
  pointer-events: none;
}

.dbx-tcard-title {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.25;
  color: #0f172a;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dbx-tcard-meta {
  margin: 4px 0 0;
  font-size: 0.65rem;
  color: #64748b;
}

.dbx-template-empty {
  padding: 24px 16px;
  text-align: center;
}

.dbx-empty-title {
  margin: 0 0 6px;
  font-weight: 700;
  color: #334155;
  font-size: 0.9rem;
}

.dbx-empty-text {
  margin: 0 0 14px;
  font-size: 0.8rem;
  color: #64748b;
  line-height: 1.4;
}

.dbx-empty-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.dbx-picked {
  margin: 10px 0 0;
  min-height: 1.2rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-dark, #2563eb);
}

.dbx-picked:empty {
  display: none;
}

.dbx-details {
  margin-top: 4px;
  border-radius: 12px;
  border: 1px solid rgba(226, 232, 240, 0.98);
  background: #ffffff;
  padding: 0 10px 10px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.dbx-details-sum {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.8rem;
  color: #334155;
  padding: 10px 4px;
}

.dbx-stage {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.dbx-stage-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

.dbx-stage-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.dbx-stage-hint {
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: #64748b;
  max-width: 28rem;
}

.dbx-stage-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.dbx-slot-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.45);
  color: #334155;
}

.dbx-canvas-shell {
  position: relative;
  flex: 1;
  min-height: min(48vh, 480px);
  margin: 12px 16px 16px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: #fff;
  box-shadow:
    0 20px 50px rgba(15, 23, 42, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.dbx-canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 280px;
  cursor: crosshair;
  touch-action: manipulation;
}

.dbx-canvas.dbx-canvas--idle {
  cursor: default;
  pointer-events: none;
  opacity: 0;
}

.dbx-canvas-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  z-index: 1;
  background: linear-gradient(145deg, #f8fafc, #f1f5f9);
}

.dbx-canvas-empty.dbx-canvas-empty--hidden {
  display: none;
}

.dbx-canvas-empty-inner {
  max-width: 20rem;
}

.dbx-canvas-empty-icon {
  display: block;
  font-size: 2rem;
  margin-bottom: 8px;
  opacity: 0.35;
}

.dbx-canvas-empty-title {
  margin: 0 0 6px;
  font-weight: 800;
  font-size: 1rem;
  color: #334155;
}

.dbx-canvas-empty-text {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.45;
  color: #64748b;
}

.dbx-img-decode {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.dbx-footer {
  padding: 12px 18px 18px;
  background: #ffffff;
  border-top: 1px solid rgba(226, 232, 240, 0.95);
}

.dbx-error {
  margin: 0 0 10px;
}

.dbx-footer-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.dbx-btn {
  min-height: 44px;
  padding: 0 18px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.dbx-btn--ghost {
  color: #334155;
  background: #f1f5f9;
  border: 1px solid rgba(226, 232, 240, 0.98);
}

.dbx-btn--ghost:hover {
  background: #e2e8f0;
}

.dbx-btn--primary {
  color: #fff;
  background: linear-gradient(145deg, var(--accent, #3b5bfd), var(--accent-dark, #2563eb));
  box-shadow: 0 8px 22px rgba(37, 99, 235, 0.3);
}

.dbx-btn--primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 919px) {
  .dbx-stage-head {
    flex-direction: column;
    align-items: stretch;
  }
  .dbx-stage-actions {
    justify-content: flex-start;
  }
}

/* Add / edit distribution box dialog */
.dist-dialog {
  width: calc(100vw - 2rem);
  max-width: min(520px, calc(100vw - 24px));
  max-height: min(92dvh, 900px);
  padding: 0;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  box-shadow: none;
}

.dist-dialog--wide {
  max-width: min(1120px, calc(100vw - 16px));
  width: calc(100vw - 16px);
  max-height: min(94dvh, 960px);
}

.dist-dialog--wide .dist-dialog-surface {
  max-height: min(94dvh, 960px);
}

.dist-dialog-surface--modern {
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.99) 0%, rgba(248, 250, 252, 0.98) 100%);
  border: 1px solid rgba(226, 232, 240, 0.95);
  box-shadow:
    0 24px 80px rgba(15, 23, 42, 0.12),
    0 0 0 1px rgba(255, 255, 255, 0.8) inset;
}

.dist-dialog-head--modern {
  align-items: flex-start;
  padding: 20px 22px 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(248, 250, 252, 0.5) 100%);
}

.dist-dialog-head-text {
  min-width: 0;
}

.dist-dialog-eyebrow {
  margin: 0 0 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-dark);
  opacity: 0.85;
}

.dist-dialog-sub {
  margin: 8px 0 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--muted);
  font-weight: 500;
  max-width: 42rem;
}

.dist-dialog-form--modern {
  padding: 0 22px 22px;
  gap: 0;
}

.dist-dialog-section-label {
  margin: 0 0 10px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.dist-dialog-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 22px;
}

@media (min-width: 900px) {
  .dist-dialog-grid {
    grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
  }
}

.dist-dialog-col--meta {
  padding: 18px;
  border-radius: calc(var(--radius) + 2px);
  border: 1px solid rgba(226, 232, 240, 0.95);
  background: rgba(255, 255, 255, 0.72);
}

.dist-dialog-col--templates {
  min-width: 0;
  padding: 18px;
  border-radius: calc(var(--radius) + 2px);
  border: 1px solid rgba(226, 232, 240, 0.95);
  background: linear-gradient(145deg, rgba(59, 91, 253, 0.04) 0%, rgba(255, 255, 255, 0.85) 60%);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dist-template-header {
  margin-bottom: 2px;
}

.dist-template-title {
  margin: 4px 0 6px;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.dist-template-lead {
  margin: 0;
}

.dist-inline-link {
  color: var(--accent-dark);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid rgba(37, 99, 235, 0.35);
}

.dist-inline-link:hover {
  border-bottom-color: var(--accent-dark);
}

.dist-template-search-wrap {
  display: block;
  margin: 0;
}

.dist-template-search {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  font-size: 16px;
  border-radius: 12px;
  border: 1px solid rgba(203, 213, 225, 0.95);
  background: rgba(255, 255, 255, 0.95);
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

.dist-template-search:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.dist-template-grid-wrap {
  position: relative;
  min-height: 220px;
  max-height: min(42vh, 420px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  border-radius: 14px;
  border: 1px solid rgba(226, 232, 240, 0.98);
  background: rgba(255, 255, 255, 0.55);
}

.dist-template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  padding: 12px;
}

@media (min-width: 600px) {
  .dist-template-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}

.dist-template-card {
  position: relative;
  margin: 0;
  padding: 0;
  border: 2px solid rgba(226, 232, 240, 0.98);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.95);
  cursor: pointer;
  text-align: left;
  font: inherit;
  overflow: hidden;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.dist-template-card:hover {
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

.dist-template-card:focus-visible {
  outline: none;
  border-color: var(--accent-dark);
  box-shadow: 0 0 0 3px rgba(59, 91, 253, 0.25);
}

.dist-template-card--selected {
  border-color: var(--accent-dark);
  box-shadow: 0 0 0 1px rgba(59, 91, 253, 0.2), 0 12px 32px rgba(37, 99, 235, 0.18);
}

.dist-template-card-thumb {
  aspect-ratio: 4 / 3;
  width: 100%;
  display: block;
  object-fit: cover;
  background: linear-gradient(145deg, #e2e8f0 0%, #f1f5f9 100%);
}

.dist-template-card-thumb--blank {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.dist-template-card-body {
  padding: 10px 10px 12px;
}

.dist-template-card-title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dist-template-card-meta {
  margin: 4px 0 0;
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 500;
}

.dist-template-empty {
  padding: 32px 20px;
  text-align: center;
}

.dist-template-empty-title {
  margin: 0 0 8px;
  font-weight: 700;
  font-size: 1rem;
}

.dist-template-empty-text {
  margin: 0 0 16px;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
}

.dist-template-empty-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.dist-template-selection {
  margin: 0;
  min-height: 1.25rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-dark);
}

.dist-template-selection:empty {
  display: none;
}

.dist-dialog-preview-block {
  padding: 20px;
  margin: 0 -22px 22px;
  border-top: 1px solid rgba(226, 232, 240, 0.9);
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
  background: rgba(248, 250, 252, 0.65);
}

.dist-dialog-preview-head {
  margin-bottom: 14px;
}

.dist-breaker-heading--inline {
  margin: 6px 0 8px;
  font-size: 1.05rem;
}

.dist-panel-interactive-card--elevated {
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.08);
  border-radius: calc(var(--radius) + 4px);
}

.dist-panel-blank {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  background: linear-gradient(165deg, #f8fafc 0%, #e2e8f0 55%, #f1f5f9 100%);
  border: 1px solid rgba(226, 232, 240, 0.95);
  pointer-events: none;
}

.dist-panel-interactive-view {
  position: relative;
}

.dist-panel-interactive-view .dist-panel-interactive-img {
  position: relative;
  z-index: 1;
}

.dist-panel-interactive-view .dist-panel-hotspots {
  z-index: 2;
}

.dist-dialog-actions--sticky {
  position: sticky;
  bottom: 0;
  margin-top: 8px;
  padding-top: 16px;
  padding-bottom: 4px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.92) 28%);
  border-top: 1px solid rgba(226, 232, 240, 0.85);
}

.dist-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.dist-dialog-surface {
  display: flex;
  flex-direction: column;
  max-height: min(92dvh, 900px);
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.dist-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.95);
}

.dist-dialog-head h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.dist-dialog-close {
  flex-shrink: 0;
  width: var(--tap);
  height: var(--tap);
  display: grid;
  place-items: center;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: rgba(15, 23, 42, 0.06);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.dist-dialog-close:hover {
  background: rgba(15, 23, 42, 0.1);
  color: var(--text);
}

.dist-dialog-form {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.dist-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dist-field-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

.dist-field input,
.dist-field textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 14px;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  border: 1px solid rgba(226, 232, 240, 0.98);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.95);
  outline: none;
}

.dist-field textarea {
  min-height: 72px;
  resize: vertical;
}

.dist-field input:focus,
.dist-field textarea:focus {
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.dist-dialog-error {
  margin: 0;
  min-height: 1.25rem;
  font-size: 0.85rem;
  color: var(--danger);
}

.dist-dialog-error:empty {
  display: none;
}

.dist-dialog-actions {
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  margin-top: 4px;
  padding-top: 8px;
}

@media (min-width: 420px) {
  .dist-dialog-actions {
    flex-direction: row;
    justify-content: flex-end;
  }
}

.dist-dialog-btn {
  min-height: var(--tap);
  padding: 0 20px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.dist-dialog-btn--ghost {
  color: var(--text);
  background: rgba(15, 23, 42, 0.06);
}

.dist-dialog-btn--primary {
  color: #fff;
  background: linear-gradient(145deg, var(--accent), var(--accent-dark));
  box-shadow: 0 8px 22px rgba(37, 99, 235, 0.35);
}

.dist-dialog-btn--primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.dist-field-hint {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--muted);
}

.dist-field-hint--small {
  font-size: 0.75rem;
}

.dist-field-hint code {
  font-size: 0.72rem;
  word-break: break-all;
}

.dist-field--image {
  position: relative;
}

.dist-field--image .dist-box-image-input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  max-width: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  flex: none;
}

.dist-box-image-dd-label {
  display: block;
  width: 100%;
  margin: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.dist-box-image-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.dist-box-image-input {
  flex: 1 1 200px;
  min-height: var(--tap);
  font: inherit;
  font-size: 0.9rem;
}

.dist-box-image-preview-wrap {
  margin-top: 10px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid rgba(226, 232, 240, 0.95);
  background: #f8fafc;
}

.dist-box-image-preview {
  display: block;
  width: 100%;
  max-height: 200px;
  object-fit: contain;
}

.dist-panel-interactive-card {
  margin: 12px 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(226, 232, 240, 0.98);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55) 0%, rgba(248, 250, 252, 0.9) 100%);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.dist-req {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.85em;
}

.dist-panel-interactive {
  position: relative;
  display: block;
  width: 100%;
  line-height: 0;
}

/* Only the empty placeholder needs min-height — do not stretch past the photo or % hotspots drift off the image. */
.dist-panel-interactive--empty {
  min-height: min(220px, 45vh);
  background: linear-gradient(165deg, #e2e8f0 0%, #cbd5e1 100%);
}

/* Image + overlay share this box so hotspot % match the rendered image exactly. */
.dist-panel-interactive-view {
  position: relative;
  display: block;
  width: 100%;
  line-height: 0;
}

.dist-panel-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 0;
  pointer-events: none;
}

.dist-panel-placeholder-text {
  margin: 0;
  max-width: 22rem;
  text-align: center;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--muted);
  font-weight: 500;
}

.dist-panel-interactive-img {
  display: block;
  width: 100%;
  height: auto;
  position: relative;
  z-index: 1;
  user-select: none;
  -webkit-user-drag: none;
}

.dist-panel-hotspots {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  box-sizing: border-box;
  z-index: 2;
}

.dist-panel-hotspot {
  position: absolute;
  pointer-events: auto;
  margin: 0;
  padding: 0;
  border: none;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.22);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
  transition:
    background 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.12s ease;
}

@media (hover: hover) and (pointer: fine) {
  .dist-panel-hotspot:hover {
    background: rgba(37, 99, 235, 0.28);
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.45),
      0 0 0 2px rgba(37, 99, 235, 0.35);
  }
}

.dist-panel-hotspot:focus {
  outline: none;
}

.dist-panel-hotspot:focus-visible {
  z-index: 2;
  box-shadow:
    inset 0 0 0 2px #fff,
    0 0 0 3px var(--accent);
}

.dist-panel-hotspot--on {
  background: rgba(37, 99, 235, 0.42);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.65),
    0 0 14px rgba(37, 99, 235, 0.55);
}

.dist-panel-hotspot--on .dist-panel-hotspot-label {
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
}

.dist-panel-hotspot-label {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: clamp(8px, 2.1vw, 12px);
  font-weight: 800;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  line-height: 1;
  max-width: 95%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dist-panel-interactive-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-top: 1px solid rgba(226, 232, 240, 0.95);
  background: rgba(255, 255, 255, 0.75);
}

.dist-panel-ocr-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding: 10px 12px 12px;
  border-top: 1px dashed rgba(226, 232, 240, 0.98);
  background: rgba(248, 250, 252, 0.9);
}

.dist-panel-ocr-row .dist-dialog-btn--primary {
  min-height: var(--tap);
  padding: 8px 14px;
  font-size: 0.88rem;
}

.dist-panel-ocr-row .dist-dialog-btn--ghost {
  min-height: var(--tap);
  padding: 8px 12px;
  font-size: 0.85rem;
}

.dist-ocr-status {
  flex: 1 1 180px;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.35;
}

.dist-ocr-status--error {
  color: var(--danger);
  font-weight: 600;
}

.dist-panel-count {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.dist-breaker-heading {
  margin: 0 0 6px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

/* —— Default box layout builder (distribution-layout.html) —— */
.lb-page .dist-hero--layout-page .dist-stat-row {
  flex-wrap: wrap;
  gap: 12px;
}

.lb-hero-actions {
  margin-top: 4px;
}

.lb-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(16px, 2.5vw, 28px);
  align-items: start;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 0 max(12px, var(--safe-right), env(safe-area-inset-right))
    max(24px, var(--safe-bottom), env(safe-area-inset-bottom))
    max(12px, var(--safe-left), env(safe-area-inset-left));
  box-sizing: border-box;
}

@media (min-width: 960px) {
  .lb-grid {
    grid-template-columns: minmax(0, 1fr) minmax(260px, min(22vw, 380px));
    gap: clamp(18px, 2.2vw, 36px);
  }
}

.lb-workspace-head {
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
}

.lb-workspace-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-left: auto;
}

.lb-fields {
  display: grid;
  gap: 14px;
  margin-bottom: 8px;
}

.lb-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin: 12px 0 8px;
}

.lb-tools-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.lb-tools-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lb-hotkeys-hint {
  margin: 8px 0 0;
  max-width: 52rem;
  line-height: 1.45;
}

.lb-hotkeys-hint .lb-kbd {
  display: inline-block;
  padding: 0.1em 0.35em;
  font-size: 0.78em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  vertical-align: baseline;
  border: 1px solid rgba(226, 232, 240, 0.98);
  border-radius: 4px;
  background: rgba(248, 250, 252, 0.95);
  color: var(--text);
}

.lb-kbd-plus {
  margin: 0 0.12em;
  font-size: 0.85em;
  color: var(--muted);
  user-select: none;
}

.lb-status {
  margin: 0 0 10px;
  font-size: 0.88rem;
  color: var(--muted);
  min-height: 1.4em;
}

.lb-canvas-card {
  margin-top: 4px;
}

.lb-image-actions {
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.lb-canvas-wrap {
  position: relative;
  width: 100%;
  max-width: none;
  margin: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: rgba(248, 250, 252, 0.6);
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.lb-canvas-wrap--empty .lb-canvas-view {
  display: none !important;
}

.lb-canvas-wrap:not(.lb-canvas-wrap--empty) .lb-placeholder {
  display: none !important;
}

.lb-canvas-view {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  line-height: 0;
}

/* Keep a visible area while the panel image decodes (img height can be 0 before load).
   Do not use max-height: % here — parent height is often indefinite in flex layouts, which collapses the view. */
.lb-canvas-wrap:not(.lb-canvas-wrap--empty) .lb-canvas-view {
  flex: 1 1 auto;
  min-height: clamp(240px, 48vh, 680px);
  max-height: none;
  background: rgba(248, 250, 252, 0.65);
}

/* Neutral drawing surface only — no framed “default region” look; regions come from Draw tool only. */
.lb-blank-surface {
  position: relative;
  z-index: 0;
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  min-height: clamp(240px, 48vh, 680px);
  border-radius: inherit;
  background: rgba(248, 250, 252, 0.98);
  border: 1px solid rgba(226, 232, 240, 0.95);
  box-shadow: none;
}

.lb-blank-surface::after {
  content: none;
}

.lb-panel-img {
  position: relative;
  z-index: 0;
  width: 100%;
  height: auto;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.lb-panel-img[hidden] {
  display: none !important;
}

.lb-hotspots-layer,
.lb-capture-layer,
.lb-rubber {
  position: absolute;
  inset: 0;
  width: auto;
  height: auto;
  box-sizing: border-box;
}

.lb-hotspots-layer {
  z-index: 2;
}

.lb-hotspots-layer--draw {
  pointer-events: none;
}

.lb-hotspots-layer--select {
  pointer-events: auto;
}

.lb-capture-layer {
  z-index: 3;
  touch-action: none;
  background: transparent;
  cursor: crosshair;
  pointer-events: none;
}

.lb-capture-layer.lb-capture-layer--active {
  pointer-events: auto;
}

.lb-sidebar .lb-capture-layer {
  cursor: default;
}

.lb-rubber {
  z-index: 4;
  pointer-events: none;
  border: 2px dashed var(--accent-dark);
  border-radius: 4px;
  background: rgba(59, 91, 253, 0.12);
  box-sizing: border-box;
}

.lb-hotspot {
  position: absolute;
  margin: 0;
  padding: 0;
  border: 2px solid rgba(37, 99, 235, 0.55);
  border-radius: 6px;
  background: rgba(59, 91, 253, 0.14);
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 4px;
  min-width: 28px;
  min-height: 28px;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.lb-hotspot:hover {
  border-color: var(--accent-dark);
  background: rgba(59, 91, 253, 0.22);
}

.lb-hotspot:focus-visible {
  outline: 2px solid var(--accent-dark);
  outline-offset: 2px;
}

.lb-hotspot--selected {
  border-color: var(--accent-dark);
  background: rgba(59, 91, 253, 0.32);
  box-shadow: 0 0 0 2px rgba(59, 91, 253, 0.35);
}

.lb-hotspot.lb-hotspot--symbol {
  padding: 0;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.35);
  min-width: 0;
  min-height: 0;
}

.lb-hotspot-symbol-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.lb-hotspot-label {
  font-size: clamp(0.62rem, 2vw, 0.75rem);
  font-weight: 800;
  color: var(--accent-dark);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
  pointer-events: none;
  line-height: 1.1;
}

.lb-hotspot-label--on-symbol {
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  max-width: calc(100% - 8px);
  text-align: center;
  text-shadow: 0 0 6px #fff, 0 0 2px #fff, 0 1px 0 rgba(255, 255, 255, 0.95);
}

.lb-hotspots-layer--select .lb-hotspot {
  cursor: grab;
}

.lb-hotspots-layer--select .lb-hotspot:active {
  cursor: grabbing;
}

.lb-hotspot-handles {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.lb-hotspot-handle {
  position: absolute;
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  border-radius: 4px;
  background: #fff;
  border: 2px solid var(--accent-dark);
  box-shadow: 0 1px 5px rgba(15, 23, 42, 0.22);
  pointer-events: auto;
  touch-action: none;
  box-sizing: border-box;
}

/* Corners on top so they stay easy to grab where they meet edges */
.lb-hotspot-handle--nw,
.lb-hotspot-handle--ne,
.lb-hotspot-handle--sw,
.lb-hotspot-handle--se {
  z-index: 2;
}

.lb-hotspot-handle--n,
.lb-hotspot-handle--s,
.lb-hotspot-handle--e,
.lb-hotspot-handle--w {
  z-index: 1;
}

.lb-hotspot-handle--nw {
  top: -8px;
  left: -8px;
  cursor: nwse-resize;
}

.lb-hotspot-handle--ne {
  top: -8px;
  right: -8px;
  cursor: nesw-resize;
}

.lb-hotspot-handle--sw {
  bottom: -8px;
  left: -8px;
  cursor: nesw-resize;
}

.lb-hotspot-handle--se {
  bottom: -8px;
  right: -8px;
  cursor: nwse-resize;
}

/* Edges: resize one dimension only */
.lb-hotspot-handle--n {
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  cursor: ns-resize;
}

.lb-hotspot-handle--s {
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  cursor: ns-resize;
}

.lb-hotspot-handle--e {
  right: -8px;
  top: 50%;
  transform: translateY(-50%);
  cursor: ew-resize;
}

.lb-hotspot-handle--w {
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  cursor: ew-resize;
}

.lb-canvas-view.lb-canvas-view--transforming {
  touch-action: none;
}

.lb-hotspot-list-wrap {
  margin-top: 18px;
}

.lb-hotspot-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lb-hotspot-list-empty {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.lb-hotspot-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(226, 232, 240, 0.98);
  background: rgba(255, 255, 255, 0.92);
}

.lb-hotspot-row--selected {
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: var(--ring);
}

.lb-hotspot-row-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lb-hotspot-row-input {
  min-width: 0;
  min-height: 40px;
  padding: 8px 10px;
  font: inherit;
  font-size: 0.9rem;
  border-radius: 8px;
  border: 1px solid rgba(226, 232, 240, 0.98);
}

.lb-hotspot-row-delete {
  min-height: var(--tap);
  padding: 0 12px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--danger);
  background: transparent;
  border: 1px solid rgba(225, 29, 72, 0.35);
  border-radius: 8px;
  cursor: pointer;
}

.lb-template-empty {
  margin: 0 0 12px;
  font-size: 0.9rem;
  color: var(--muted);
}

.lb-template-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lb-template-item {
  display: flex;
  align-items: stretch;
  gap: 6px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(226, 232, 240, 0.98);
  background: rgba(255, 255, 255, 0.88);
  overflow: hidden;
}

.lb-template-item--current {
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: var(--ring);
}

.lb-template-item-title {
  flex: 1;
  min-height: var(--tap);
  padding: 10px 12px;
  text-align: left;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  border: none;
  cursor: pointer;
}

.lb-template-item-delete {
  flex: 0 0 44px;
  min-height: var(--tap);
  font-size: 1.25rem;
  line-height: 1;
  color: var(--muted);
  background: rgba(248, 250, 252, 0.95);
  border: none;
  border-left: 1px solid rgba(226, 232, 240, 0.98);
  cursor: pointer;
}

.lb-template-item-delete:hover {
  color: var(--danger);
  background: rgba(255, 241, 242, 0.95);
}

.lb-sidebar {
  position: sticky;
  top: max(12px, var(--safe-top));
}

@media (max-width: 959px) {
  .lb-sidebar {
    position: static;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dist-panel-hotspot {
    transition: none;
  }

  .dist-cta:active {
    transform: none;
  }

  .dist-btn-add:active {
    transform: none;
  }

  .lb-hotspot {
    transition: none;
  }
}

/* Shared layout renderer (distribution box dialog + future viewers) */
.ums-layout-render-root {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.ums-layout-stage {
  pointer-events: auto;
}

.ums-layout-component {
  pointer-events: auto;
}

.ums-layout-component--active {
  outline: 2px solid var(--accent, #3b5bfd);
  outline-offset: 1px;
  border-radius: 4px;
}
