/* ============================================================
   PostPress — Modern Cartographic Postal Atelier Design System
   Light alabaster studio + Obsidian US Delivery Map contrast
   ============================================================ */

:root {
  --bg: #F6F7F9;
  --surface: #FFFFFF;
  --surface-subtle: #F1F3F6;
  --surface-tint: #F8FAFC;
  --ink: #0F172A;
  --ink-secondary: #334155;
  --muted: #64748B;
  --border: rgba(15, 23, 42, 0.09);
  --border-strong: rgba(15, 23, 42, 0.16);

  --accent: #D94426;
  --accent-hover: #BF371C;
  --accent-soft: #FEF2EF;
  --accent-ring: rgba(217, 68, 38, 0.18);

  --emerald: #0F9D68;
  --emerald-soft: #ECFDF5;
  --green: #0F9D68;
  --green-soft: #ECFDF5;
  --sky: #0284C7;
  --sky-soft: #F0F9FF;
  --amber: #B45309;
  --amber-soft: #FFFBEB;

  --map-bg: #0B1018;
  --map-surface: #111827;
  --map-border: rgba(148, 163, 184, 0.16);
  --map-ink: #F8FAFC;
  --map-muted: #94A3B8;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 22px;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05), 0 8px 24px -14px rgba(15, 23, 42, 0.1);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.06), 0 18px 40px -20px rgba(15, 23, 42, 0.16);
  --shadow-map: 0 22px 54px -22px rgba(2, 6, 23, 0.55), 0 0 0 1px rgba(15, 23, 42, 0.12);

  --font-display: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease-out: cubic-bezier(.23, 1, .32, 1);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; touch-action: manipulation; }
a:hover { text-decoration: underline; }
code, pre { font-family: var(--font-mono); }

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  color: var(--ink);
  text-wrap: balance;
  letter-spacing: -0.025em;
}
p { text-wrap: pretty; }

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

/* --- Topbar --- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1380px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  flex-shrink: 0;
}
.brand:hover { text-decoration: none; }
.postmark-mark { display: inline-flex; align-items: center; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong {
  font-family: var(--font-display);
  font-size: 16.5px;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.brand-sub {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 3px;
  background: var(--surface-subtle);
  padding: 4px;
  border-radius: 11px;
  border: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.main-nav::-webkit-scrollbar { display: none; }

.nav-btn {
  border: 0;
  background: transparent;
  color: var(--ink-secondary);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 550;
  padding: 6.5px 11px;
  border-radius: 7.5px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  touch-action: manipulation;
  transition: background 150ms var(--ease-out), color 150ms var(--ease-out), box-shadow 150ms var(--ease-out);
}
.nav-btn:hover { color: var(--ink); background: rgba(255, 255, 255, 0.65); }
.nav-btn.active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 650;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.nav-count {
  font-family: var(--font-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  background: rgba(15, 23, 42, 0.07);
  color: var(--ink-secondary);
  padding: 1px 6px;
  border-radius: 99px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 99px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
  box-shadow: var(--shadow-xs);
  transition: border-color 150ms var(--ease-out), transform 150ms var(--ease-out);
}
.status-pill:hover { border-color: var(--ink); transform: translateY(-1px); }

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #D97706;
  flex-shrink: 0;
}
.status-dot.connected {
  background: #10B981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.22);
}

/* --- Main Shell --- */
.shell {
  max-width: 1380px;
  margin: 0 auto;
  padding: 28px 24px 68px;
}

.toast {
  position: fixed;
  top: 74px;
  right: 24px;
  z-index: 60;
  background: #0F172A;
  color: #F8FAFC;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: 0 18px 40px -12px rgba(2, 6, 23, 0.45);
  max-width: 440px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.toast.error { background: #991B1B; }
.toast.ok { background: #065F46; }

/* --- Flagship Hero with Embedded Interactive Delivery Map --- */
.hero-band {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 1.18fr);
  gap: 28px;
  align-items: stretch;
  margin-bottom: 40px;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px 4px 8px 0;
}

.eyebrow-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  padding: 5px 12px;
  border-radius: 99px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-secondary);
  margin-bottom: 16px;
}
.eyebrow-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.hero-copy h1 {
  font-size: clamp(32px, 3.6vw, 48px);
  font-weight: 800;
  line-height: 1.06;
  letter-spacing: -0.038em;
  color: var(--ink);
  margin-bottom: 16px;
}

.hero-copy .lead {
  color: var(--ink-secondary);
  font-size: 15.5px;
  line-height: 1.62;
  max-width: 56ch;
  margin: 0 0 22px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}

/* Compact verified USPS postage strip */
.rate-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}
.rate-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  box-shadow: var(--shadow-xs);
}
.rate-chip-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rate-chip-val {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

/* --- Hero Interactive Obsidian Delivery Map Card --- */
.hero-map-card {
  background: var(--map-bg);
  color: var(--map-ink);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(148, 163, 184, 0.16);
  box-shadow: var(--shadow-map);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.map-card-head {
  padding: 16px 18px 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.11);
}

.map-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #38BDF8;
  margin-bottom: 3px;
}
.map-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22C58B;
  box-shadow: 0 0 0 3px rgba(34, 197, 139, 0.25);
}
.map-card-title-group h2 {
  font-size: 16.5px;
  font-weight: 700;
  color: #F8FAFC;
  letter-spacing: -0.02em;
}

.map-expand-btn {
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(255, 255, 255, 0.05);
  color: #E2E8F0;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
  transition: background 150ms var(--ease-out), border-color 150ms var(--ease-out);
}
.map-expand-btn:hover { background: rgba(255, 255, 255, 0.11); border-color: rgba(255, 255, 255, 0.4); }

.hero-route-controls {
  padding: 11px 18px;
  background: rgba(15, 23, 42, 0.72);
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.route-input-pair {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.route-zip-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 96px;
}
.route-zip-field span {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--map-muted);
}
.hero-map-card .route-zip-field input[type="text"] {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.26);
  border-radius: 8px;
  color: #F8FAFC;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 10px;
  width: 100%;
  height: 34px;
}
.hero-map-card .route-zip-field input[type="text"]::placeholder { color: #64748B; }
.hero-map-card .route-zip-field input[type="text"]:focus {
  outline: none;
  border-color: #FF6B4A;
  box-shadow: 0 0 0 3px rgba(255, 107, 74, 0.24);
}

.route-arrow {
  color: #64748B;
  font-family: var(--font-mono);
  padding-bottom: 7px;
  font-weight: 700;
}

.btn-map-go {
  background: #FF5B37;
  color: #FFFFFF;
  border: 0;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
  height: 32px;
  touch-action: manipulation;
  transition: background 150ms var(--ease-out);
}
.btn-map-go:hover { background: #E44926; }

.route-preset-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.preset-pill {
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(255, 255, 255, 0.04);
  color: #CBD5E1;
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 3.5px 9px;
  border-radius: 99px;
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
  transition: background 140ms var(--ease-out), border-color 140ms var(--ease-out), color 140ms var(--ease-out);
}
.preset-pill:hover, .preset-pill.active {
  background: rgba(255, 91, 55, 0.18);
  border-color: rgba(255, 107, 74, 0.55);
  color: #FFFFFF;
}

.map-canvas-wrap {
  position: relative;
  width: 100%;
  background: var(--map-bg);
}
.hero-map-canvas {
  aspect-ratio: 975 / 540;
  min-height: 280px;
}
.full-map-canvas {
  aspect-ratio: 975 / 575;
  min-height: 430px;
}
.studio-map-canvas {
  aspect-ratio: 975 / 530;
  min-height: 185px;
}
.detail-map-canvas {
  aspect-ratio: 975 / 520;
  min-height: 170px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.18);
  margin: 10px 0 12px;
}

.map-telemetry-bar {
  padding: 12px 18px;
  background: rgba(15, 23, 42, 0.92);
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: center;
}
.telemetry-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.telemetry-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--map-muted);
}
.telemetry-val {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: #F8FAFC;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.telemetry-val.is-emerald { color: #34D399; }

.btn-map-send {
  background: #FFFFFF;
  color: #0F172A;
  border: 0;
  border-radius: 8px;
  padding: 8px 13px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
  transition: transform 140ms var(--ease-out), background 140ms var(--ease-out);
}
.btn-map-send:hover { background: #F1F5F9; transform: translateY(-1px); }

/* --- SVG Cartography Styles (deliveryMap.js) --- */
.pm-stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  user-select: none;
}
.pm-svg {
  width: 100%;
  height: 100%;
  display: block;
}
.pm-state {
  fill: #1A2538;
  stroke: rgba(148, 163, 184, 0.3);
  stroke-width: 0.95;
  stroke-linejoin: round;
  transition: fill 150ms var(--ease-out), stroke 150ms var(--ease-out);
}
.pm-state:hover {
  fill: #243450;
  stroke: rgba(248, 250, 252, 0.52);
}
.pm-state.is-clickable { cursor: pointer; }
.pm-state.is-active {
  fill: #22324D;
  stroke: rgba(255, 107, 74, 0.65);
  stroke-width: 1.2;
}

.pm-backbone {
  stroke: rgba(56, 189, 248, 0.12);
  stroke-width: 1;
  stroke-dasharray: 3 5;
}

.pm-hub { cursor: pointer; }
.pm-hub-ring {
  fill: none;
  stroke: rgba(56, 189, 248, 0.26);
  stroke-width: 1;
}
.pm-hub-dot {
  fill: #38BDF8;
  stroke: #0B1018;
  stroke-width: 1.5;
}
.pm-hub.is-hot .pm-hub-dot {
  fill: #22C58B;
}
.pm-hub.is-hot .pm-hub-ring {
  stroke: rgba(34, 197, 139, 0.5);
}
.pm-hub-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  fill: rgba(203, 213, 225, 0.72);
  pointer-events: none;
}
.pm-hub.is-hot .pm-hub-label { fill: #6EE7B7; font-weight: 700; }

.pm-pulse {
  fill: rgba(34, 197, 139, 0.16);
  stroke: rgba(34, 197, 139, 0.55);
  stroke-width: 1.2;
  transform-box: fill-box;
  transform-origin: center;
  animation: pmPulse 2.4s ease-out infinite;
}
.pm-pulse-dest {
  fill: none;
  stroke-width: 1.6;
  opacity: 0.6;
  transform-box: fill-box;
  transform-origin: center;
  animation: pmPulse 2.2s ease-out infinite;
}

@keyframes pmPulse {
  0% { transform: scale(0.55); opacity: 0.9; }
  100% { transform: scale(1.7); opacity: 0; }
}

.pm-arc-digital {
  fill: none;
  stroke: rgba(56, 189, 248, 0.52);
  stroke-width: 1.6;
  stroke-dasharray: 4 5;
  stroke-linecap: round;
  animation: pmDashFlow 18s linear infinite;
}
.pm-arc-glow {
  fill: none;
  stroke-width: 7;
  stroke-linecap: round;
  opacity: 0.16;
}
.pm-arc-main {
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
}
.pm-arc-draw {
  stroke-dasharray: 100;
  stroke-dashoffset: 0;
  animation: pmArcDraw 340ms cubic-bezier(.22, 1, .36, 1) forwards;
}
@keyframes pmArcDraw {
  from { stroke-dashoffset: 100; }
  to { stroke-dashoffset: 0; }
}
.eddm-map-wrap {
  aspect-ratio: 975 / 500;
  min-height: 210px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.16);
  margin: 12px 0 14px;
}
.sandbox-notice {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  color: #92400E;
  border-radius: var(--radius-md);
  padding: 10px 13px;
  font-size: 12.5px;
  line-height: 1.5;
  margin-bottom: 12px;
}
.sandbox-notice strong { color: #78350F; }
.pm-arc-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 14;
}
.pm-route.is-clickable { cursor: pointer; }
.pm-eddm-pin { cursor: pointer; }
.pm-packet { will-change: transform; }

@keyframes pmDashFlow {
  to { stroke-dashoffset: -180; }
}

.pm-tag-bg {
  fill: rgba(15, 23, 42, 0.92);
  stroke: rgba(148, 163, 184, 0.36);
  stroke-width: 1;
}
.pm-tag-bg.is-accent {
  fill: rgba(217, 68, 38, 0.92);
  stroke: rgba(255, 255, 255, 0.4);
}
.pm-tag-text {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  fill: #FFFFFF;
}

.pm-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.94);
  color: #F8FAFC;
  border: 1px solid rgba(148, 163, 184, 0.28);
  padding: 5px 10px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 10px 24px -6px rgba(2, 6, 23, 0.65);
  z-index: 12;
}

/* --- Full-Width Delivery Map Command Center (#view-map) --- */
.map-command-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  align-items: start;
}

.map-command-main {
  background: var(--map-bg);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(148, 163, 184, 0.16);
  box-shadow: var(--shadow-map);
  overflow: hidden;
}

.map-command-toolbar {
  padding: 14px 18px;
  background: rgba(15, 23, 42, 0.85);
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.map-toolbar-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr 1.35fr auto;
  gap: 10px;
  align-items: end;
}
.map-dark-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.map-dark-field span {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--map-muted);
}
.map-command-main .map-dark-field input[type="text"],
.map-command-main .map-dark-field select {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.26);
  border-radius: 8px;
  color: #F8FAFC;
  font-family: var(--font-sans);
  font-size: 13px;
  padding: 7px 10px;
  height: 36px;
}
.map-command-main .map-dark-field select option { background: #0F172A; color: #F8FAFC; }
.map-command-main .map-dark-field input[type="text"]:focus,
.map-command-main .map-dark-field select:focus {
  outline: none;
  border-color: #FF6B4A;
}

.map-toolbar-hint {
  font-size: 12px;
  color: #94A3B8;
}
.map-shipments-status {
  color: #E2E8F0;
  font-size: 13.5px;
  font-weight: 500;
}
#map-shipments-bar {
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}

.map-legend-bar {
  padding: 11px 18px;
  background: rgba(15, 23, 42, 0.92);
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 11.5px;
  color: #94A3B8;
}
.map-legend-item { display: inline-flex; align-items: center; gap: 7px; }
.lg-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.lg-hub { background: #38BDF8; }
.lg-delivered { background: #22C58B; }
.lg-transit { background: #38BDF8; }
.lg-line { width: 16px; height: 2px; display: inline-block; border-radius: 2px; }
.lg-digital { border-top: 2px dashed rgba(56, 189, 248, 0.7); }
.lg-postal { background: #E85D3F; }

.map-command-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.map-intel-card, .map-hubs-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.map-intel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.map-intel-kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}
.zone-pill {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  background: #0F172A;
  color: #F8FAFC;
  padding: 3px 10px;
  border-radius: 99px;
}
.map-intel-card h3 { font-size: 17px; font-weight: 750; margin-bottom: 6px; }
.map-intel-note { font-size: 13px; color: var(--muted); margin: 0 0 14px; }
.map-intel-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.intel-stat-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}
.intel-stat-row span { color: var(--muted); }
.intel-stat-row strong {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  text-align: right;
}

.map-hubs-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.map-hubs-head h4 { font-size: 14px; font-weight: 700; }
.map-hubs-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.hub-chip {
  border: 1px solid var(--border);
  background: var(--surface-tint);
  border-radius: 9px;
  padding: 7px 9px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 1px;
  touch-action: manipulation;
  transition: border-color 140ms var(--ease-out), background 140ms var(--ease-out);
}
.hub-chip:hover { border-color: var(--ink); background: var(--surface); }
.hub-chip.is-active { border-color: var(--emerald); background: var(--emerald-soft); }
.hub-chip strong { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink); }
.hub-chip span { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --- Compact Route Card in Mail Studio --- */
.studio-route-card {
  background: var(--map-bg);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(148, 163, 184, 0.16);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.studio-route-head {
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}
.studio-route-title {
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 700;
  color: #F8FAFC;
}
.studio-route-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: #34D399;
  white-space: nowrap;
}

/* --- Section Headings & KPIs --- */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.section-head.compact { margin-bottom: 12px; }
.section-head h2 { font-size: 25px; font-weight: 800; letter-spacing: -0.03em; }
.section-head h3 { font-size: 18px; font-weight: 750; }
.muted { color: var(--muted); margin: 4px 0 0; }
.mono-subtle { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }

.workspace-kpis {
  display: flex;
  gap: 10px;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  min-width: 102px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xs);
}
.kpi-val {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  color: var(--ink);
}
.kpi-label { font-size: 11.5px; font-weight: 500; color: var(--muted); margin-top: 2px; }

/* --- Product Catalog Grid (Symmetrical 3-up) --- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 36px;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform 160ms var(--ease-out), border-color 160ms var(--ease-out), box-shadow 160ms var(--ease-out);
}
.product-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  transition: background 160ms var(--ease-out);
}
.product-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}
.product-card:hover::before { background: var(--accent); }

.product-card-head-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.product-icon-badge {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  flex-shrink: 0;
  margin-bottom: 10px;
}

.product-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.product-card h3 { font-size: 18.5px; font-weight: 750; letter-spacing: -0.02em; }

.price-tag, .price-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 99px;
  white-space: nowrap;
}
.mono-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-secondary);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  padding: 2.5px 8px;
  border-radius: 6px;
  white-space: nowrap;
}
.product-card p { margin: 8px 0 0; color: var(--ink-secondary); font-size: 13.5px; line-height: 1.55; }

.sku-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.sku-chip {
  border: 1px solid var(--border);
  background: var(--surface-tint);
  color: var(--ink);
  font-size: 12px;
  font-weight: 550;
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 140ms var(--ease-out), border-color 140ms var(--ease-out), color 140ms var(--ease-out);
}
.sku-chip:hover { background: var(--ink); color: #FFFFFF; border-color: var(--ink); }

.product-card-foot, .card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* --- Tables --- */
.sku-table-wrap, .panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.table-scroll { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.data-table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: 0; }
.data-table th.num, .data-table td.num {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.data-table td.mono-subtle { white-space: nowrap; }
.data-table tbody tr { transition: background 120ms var(--ease-out); }
.data-table tbody tr:hover { background: var(--surface-tint); }
.data-table tbody tr.selectable,
.data-table tbody tr.clickable { cursor: pointer; }
.data-table tbody tr.selected { background: var(--accent-soft); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 10px;
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 650;
  padding: 9.5px 16px;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
  transition: background 150ms var(--ease-out), border-color 150ms var(--ease-out), transform 140ms var(--ease-out), box-shadow 150ms var(--ease-out);
}
.btn-lg { padding: 11px 18px; font-size: 14px; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  color: #FFFFFF;
  box-shadow: 0 1px 2px rgba(217, 68, 38, 0.25);
}
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); text-decoration: none; }
.btn-secondary {
  background: var(--ink);
  color: #FFFFFF;
}
.btn-secondary:hover { background: #1E293B; transform: translateY(-1px); text-decoration: none; }
.btn-ghost {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border-strong);
}
.btn-ghost:hover { background: var(--surface-subtle); border-color: var(--ink); text-decoration: none; }
.btn-danger {
  background: #FEF2F2;
  color: #B91C1C;
  border-color: #FECACA;
}
.btn-danger:hover { background: #FEE2E2; }
.btn-sm { padding: 7px 12px; font-size: 12.5px; border-radius: 8px; }
.btn-xs { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn-block { width: 100%; }
.file-btn { position: relative; overflow: hidden; }

/* --- Forms --- */
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.panel h2 { font-size: 18px; font-weight: 750; }
.panel h3 { font-size: 16.5px; font-weight: 750; margin-bottom: 10px; }

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}
.field > span {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="password"],
select,
textarea {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  padding: 9px 11px;
  transition: border-color 140ms var(--ease-out), box-shadow 140ms var(--ease-out);
}
textarea {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.5;
  resize: vertical;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.input-sm { width: auto; padding: 6.5px 10px; font-size: 12.5px; }

.form-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }

.toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.checkbox-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface-tint);
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
}
.checkbox-pill.compact { padding: 4.5px 9px; font-size: 12px; }
.checkbox-pill input { accent-color: var(--accent); margin: 0; }

.address-tabs, .filter-bar {
  display: inline-flex;
  gap: 3px;
  background: var(--surface-subtle);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-bottom: 14px;
}
.seg-btn {
  border: 0;
  background: transparent;
  padding: 6.5px 12px;
  border-radius: 7.5px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
  transition: background 140ms var(--ease-out), color 140ms var(--ease-out);
}
.seg-btn.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
}

.inline-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 6px; }
.sub-panel {
  margin-top: 12px;
  padding: 14px;
  background: var(--surface-tint);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.verify-banner {
  margin-top: 10px;
  padding: 10px 13px;
  border-radius: 10px;
  font-size: 13px;
  border: 1px solid var(--border);
  background: var(--surface-tint);
}
.verify-banner.ok { background: var(--emerald-soft); border-color: #A7F3D0; color: #065F46; }
.verify-banner.err { background: #FEF2F2; border-color: #FECACA; color: #991B1B; }

.merge-vars-box {
  margin-top: 12px;
  padding: 12px;
  background: var(--surface-tint);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
}
.merge-vars-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 650;
  margin-bottom: 10px;
}

/* --- Mail Studio Two-Column Layout & Tactile Print Proof --- */
.studio-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(390px, 0.94fr);
  gap: 22px;
  align-items: start;
}
.studio-controls { display: flex; flex-direction: column; gap: 18px; }
.studio-proof-col {
  position: sticky;
  top: 74px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.proof-stage {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.proof-toolbar {
  padding: 13px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}
.proof-toolbar > div:first-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.proof-toolbar-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; white-space: nowrap; }

.cutting-mat {
  padding: 24px 20px;
  background-color: #E7EAEE;
  background-image:
    linear-gradient(rgba(15, 23, 42, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.05) 1px, transparent 1px);
  background-size: 18px 18px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 360px;
}

.sheet-canvas {
  position: relative;
  width: 100%;
  background: #FFFFFF;
  color: #111827;
  box-shadow: 0 22px 44px -18px rgba(15, 23, 42, 0.34), 0 0 0 1px rgba(15, 23, 42, 0.08);
  overflow: hidden;
  font-family: 'Inter', sans-serif;
  transition: aspect-ratio 200ms var(--ease-out);
}
.sheet-canvas.letter { max-width: 410px; aspect-ratio: 8.5 / 11; padding: 24px; }
.sheet-canvas.legal { max-width: 390px; aspect-ratio: 8.5 / 14; padding: 22px; }
.sheet-canvas.postcard-4x6 { max-width: 440px; aspect-ratio: 6 / 4; padding: 0; }
.sheet-canvas.postcard-6x9 { max-width: 460px; aspect-ratio: 9 / 6; padding: 0; }
.sheet-canvas.postcard-6x11 { max-width: 470px; aspect-ratio: 11 / 6; padding: 0; }
.sheet-canvas.eddm { max-width: 460px; aspect-ratio: 9 / 6.25; padding: 0; }
.sheet-canvas.self-mailer { max-width: 450px; aspect-ratio: 8.5 / 11; padding: 0; }

.sheet-certified-bar, .proof-cert-bar {
  background: #065F46;
  color: #FFFFFF;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 5px 9px;
  margin-bottom: 10px;
  border-radius: 3px;
}
.sheet-window, .proof-window-ret, .proof-window-to {
  border: 1px dashed rgba(217, 68, 38, 0.65);
  background: rgba(254, 242, 239, 0.55);
  border-radius: 3px;
  padding: 5px 8px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  line-height: 1.35;
  margin-bottom: 9px;
}
.sheet-window.return-win, .proof-window-ret { width: 54%; color: #475569; border-color: rgba(15, 23, 42, 0.28); background: rgba(241, 245, 249, 0.72); }
.sheet-window.recipient-win, .proof-window-to { width: 66%; color: #0F172A; font-weight: 600; min-height: 50px; }
.sheet-canvas:not(.show-guides) .proof-window-ret,
.sheet-canvas:not(.show-guides) .proof-window-to {
  border-color: transparent;
  background: transparent;
}

.sheet-body-preview, .proof-letter-body {
  font-size: 11.5px;
  line-height: 1.5;
  color: #1E293B;
  word-break: break-word;
}
.proof-letter-body h1, .proof-letter-body h2, .proof-letter-body h3 {
  font-family: var(--font-display);
  margin: 0 0 6px;
  font-size: 15px;
}
.proof-letter-body p { margin: 0 0 8px; }

.proof-card-front {
  position: relative;
  height: 100%;
  padding: 20px;
  background: linear-gradient(145deg, #0F172A 0%, #1E293B 100%);
  color: #F8FAFC;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.proof-bleed-frame {
  position: absolute;
  inset: 10px;
  border: 1px dashed rgba(255, 107, 74, 0.6);
  pointer-events: none;
}
.proof-card-back {
  height: 100%;
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr 0.96fr;
  gap: 14px;
}
.proof-usps-zone {
  border-left: 1px solid #E2E8F0;
  padding-left: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.indicia-box {
  align-self: flex-end;
  border: 1px solid #065F46;
  color: #065F46;
  font-family: var(--font-mono);
  font-size: 7.5px;
  padding: 4px 6px;
  line-height: 1.25;
  text-align: center;
}
.imb-clear-label {
  border: 1px dashed rgba(217, 68, 38, 0.65);
  background: rgba(254, 242, 239, 0.6);
  font-family: var(--font-mono);
  font-size: 7.5px;
  text-align: center;
  color: var(--accent);
  padding: 5px 4px;
}
.fold-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px dashed rgba(2, 132, 199, 0.6);
  pointer-events: none;
}
.proof-check-box {
  border: 1.5px solid #0F172A;
  background: #F8FAFC;
  padding: 10px 12px;
  border-radius: 4px;
  margin-bottom: 10px;
  font-size: 10.5px;
}
.proof-check-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.proof-check-amt { font-family: var(--font-mono); font-weight: 700; font-size: 12px; }

.proof-legend {
  padding: 10px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 11.5px;
  color: var(--muted);
  border-top: 1px solid var(--border);
}
.swatch { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }
.swatch-red { background: rgba(217, 68, 38, 0.25); border: 1px dashed var(--accent); }
.swatch-green { background: #065F46; }

/* --- Itemized Receipt --- */
.receipt-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.receipt-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.receipt-head h3 { font-size: 16.5px; font-weight: 750; }
.receipt-lines {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 10px 0;
  border-top: 1px dashed var(--border-strong);
  border-bottom: 1px dashed var(--border-strong);
}
.receipt-row, .receipt-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  color: var(--ink-secondary);
}
.receipt-row .amt, .receipt-line strong { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); text-align: right; }
.receipt-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 12px 0 14px;
  font-weight: 650;
}
.receipt-total strong {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}
.studio-submit-actions { display: flex; flex-direction: column; gap: 9px; }
.split-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.result-box {
  margin-top: 14px;
  padding: 12px;
  border-radius: 10px;
  background: var(--emerald-soft);
  border: 1px solid #A7F3D0;
  font-size: 13px;
}

/* --- Two-column & Orders --- */
.two-col-wide {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
}
.orders-split {
  display: grid;
  grid-template-columns: minmax(0, 1.32fr) minmax(350px, 0.88fr);
  gap: 20px;
  align-items: start;
}
.detail-panel { position: sticky; top: 74px; }

.eddm-routes-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.eddm-route-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 8px;
  align-items: end;
}

/* --- Badges & Timeline --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 99px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 650;
  text-transform: capitalize;
  background: var(--surface-subtle);
  color: var(--ink-secondary);
  white-space: nowrap;
}
.badge.proofed { background: var(--sky-soft); color: #0369A1; }
.badge.paid, .badge.queued, .badge.in_production { background: var(--amber-soft); color: #B45309; }
.badge.mailed, .badge.in_transit { background: #EFF6FF; color: #1D4ED8; }
.badge.delivered { background: var(--emerald-soft); color: #047857; }
.badge.cancelled, .badge.failed, .badge.returned { background: #FEF2F2; color: #B91C1C; }

.timeline {
  list-style: none;
  margin: 14px 0 0;
  padding: 0 0 0 16px;
  border-left: 2px solid var(--border-strong);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.timeline li { position: relative; font-size: 13px; }
.timeline li::before {
  content: '';
  position: absolute;
  left: -22px;
  top: 5px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface);
}
.timeline .ev-type { font-family: var(--font-mono); font-size: 11.5px; font-weight: 650; color: var(--ink); }
.timeline .ev-time { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }

/* --- Templates, Agents, Providers --- */
.template-grid { display: flex; flex-direction: column; gap: 12px; }
.template-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-xs);
}
.template-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }

.code-block-group { margin-top: 14px; }
.code-label {
  font-size: 11.5px;
  font-weight: 650;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 5px;
}
.code-pre {
  margin: 0;
  padding: 13px 15px;
  border-radius: var(--radius-md);
  background: #0B1018;
  color: #E2E8F0;
  font-size: 12px;
  line-height: 1.55;
  overflow-x: auto;
  border: 1px solid rgba(148, 163, 184, 0.14);
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.tool-tile {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-tint);
}
.tool-tile code { font-size: 12.5px; font-weight: 650; color: var(--accent); }
.tool-tile p { margin: 4px 0 0; font-size: 12.5px; color: var(--ink-secondary); }

.tokens-list { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.token-row {
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-tint);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.provider-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.provider-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  box-shadow: var(--shadow-sm);
}
.provider-card code {
  word-break: break-all;
  overflow-wrap: anywhere;
  font-size: 11.5px;
  background: var(--surface-subtle);
  padding: 2px 6px;
  border-radius: 5px;
}

.empty-state { text-align: center; padding: 48px 24px; }
.empty-state h3 { font-size: 20px; font-weight: 750; margin-bottom: 8px; }
.empty-state p { color: var(--muted); max-width: 44ch; margin: 0 auto 18px; }
.empty-inline {
  padding: 18px;
  border-radius: 10px;
  background: var(--surface-tint);
  border: 1px dashed var(--border-strong);
  color: var(--muted);
  font-size: 13px;
  margin-top: 12px;
}

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 20px 24px;
  font-size: 12.5px;
  color: var(--muted);
}
.site-footer-inner {
  max-width: 1380px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; }
.footer-links a { color: var(--ink-secondary); font-weight: 550; }
.footer-links a:hover { color: var(--accent); }

/* --- Responsive --- */
@media (max-width: 1180px) {
  .hero-band { grid-template-columns: 1fr; }
  .map-command-shell { grid-template-columns: 1fr; }
  .studio-layout, .orders-split { grid-template-columns: 1fr; }
  .studio-proof-col, .detail-panel { position: static; }
  .product-grid, .provider-cards, .tools-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .topbar-inner { flex-wrap: wrap; padding: 10px 14px; }
  .shell { padding: 18px 14px 48px; }
  .rate-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .map-telemetry-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .map-toolbar-inputs { grid-template-columns: 1fr; }
  .product-grid, .two-col-wide, .provider-cards, .tools-grid, .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* MCPMails Topbar Bridge */
.topbar-right-group { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.topbar-link-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6.5px 11px;
  border-radius: 99px;
  border: 1px solid var(--border-strong);
  background: var(--surface-tint);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  touch-action: manipulation;
  transition: border-color 140ms var(--ease-out), background 140ms var(--ease-out);
}
.topbar-link-pill:hover { border-color: var(--ink); background: var(--surface); text-decoration: none; }
.auth-cta-banner {
  background: #0F172A;
  color: #F8FAFC;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
}
.auth-cta-banner strong { color: #FFFFFF; }
.auth-cta-banner a { color: #FFFFFF; }

/* --- Interactive Zoomable Multi-Select USPS EDDM Territory Map --- */
.eddm-workbench {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  box-shadow: 0 18px 40px -24px rgba(15, 23, 42, 0.22);
  overflow: hidden;
}
.eddm-wb-topbar {
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.eddm-wb-search-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.eddm-search-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 520px;
  flex-wrap: wrap;
}
.eddm-search-group input[type="text"] {
  flex: 1 1 250px;
  min-height: 40px;
  padding: 8px 13px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: #FFFFFF;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 500;
}
.eddm-search-group input[type="text"]:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}
.eddm-quick-metros {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.eddm-metro-pill,
.eddm-zip-chip {
  padding: 6px 10px;
  border-radius: 99px;
  border: 1px solid var(--border-strong);
  background: #FFFFFF;
  color: var(--ink-secondary);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 150ms cubic-bezier(.23, 1, .32, 1), color 150ms cubic-bezier(.23, 1, .32, 1), background 150ms cubic-bezier(.23, 1, .32, 1), transform 150ms cubic-bezier(.23, 1, .32, 1);
}
.eddm-metro-pill:hover,
.eddm-zip-chip:hover:not(:disabled) {
  border-color: var(--ink);
  color: var(--ink);
  transform: translateY(-1px);
}
.eddm-zip-chip.is-loaded {
  background: #ECFDF5;
  border-color: #A7F3D0;
  color: #065F46;
  cursor: default;
}
.eddm-wb-controls-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.eddm-mode-group {
  display: inline-flex;
  background: #F1F5F9;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
}
.eddm-tool-btn {
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-secondary);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 150ms cubic-bezier(.23, 1, .32, 1), color 150ms cubic-bezier(.23, 1, .32, 1), border-color 150ms cubic-bezier(.23, 1, .32, 1);
}
.eddm-tool-btn:hover { color: var(--ink); }
.eddm-tool-btn.active {
  background: #0F172A;
  color: #FFFFFF;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.16);
}
.eddm-tool-btn[data-eddm-tool="box-select"].active {
  background: #059669;
}
.eddm-tool-btn[data-eddm-tool="box-deselect"].active {
  background: #DC2626;
}
.eddm-filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.eddm-inline-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
}
.eddm-inline-select {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-secondary);
  white-space: nowrap;
}
.eddm-inline-select select {
  padding: 5px 8px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: #FFFFFF;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
}
.eddm-city-zips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.eddm-city-zips-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
}
.eddm-map-status {
  font-size: 12.5px;
  color: var(--ink-secondary);
  padding: 6px 10px;
  border-radius: 8px;
  background: #F1F5F9;
  border: 1px solid var(--border);
}
.eddm-map-status[data-tone="ok"] { background: #ECFDF5; border-color: #A7F3D0; color: #065F46; }
.eddm-map-status[data-tone="loading"] { background: #EFF6FF; border-color: #BFDBFE; color: #1E40AF; }
.eddm-map-status[data-tone="warn"] { background: #FFFBEB; border-color: #FDE68A; color: #92400E; }
.eddm-map-status[data-tone="err"] { background: #FEF2F2; border-color: #FECACA; color: #991B1B; }

.eddm-wb-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  min-height: 540px;
}
.eddm-map-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #E2E8F0;
  border-right: 1px solid var(--border);
}
.eddm-leaflet-canvas {
  width: 100%;
  height: 520px;
  position: relative;
  z-index: 1;
  user-select: none;
}
.eddm-leaflet-canvas.is-box-select { cursor: crosshair !important; }
.eddm-leaflet-canvas.is-box-deselect { cursor: crosshair !important; }
.eddm-leaflet-canvas.is-box-select .leaflet-interactive,
.eddm-leaflet-canvas.is-box-deselect .leaflet-interactive { cursor: crosshair !important; }

.eddm-map-float-controls {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.eddm-float-btn {
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, 0.16);
  background: rgba(255, 255, 255, 0.96);
  color: #0F172A;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
  cursor: pointer;
  touch-action: manipulation;
  transition: background 150ms cubic-bezier(.23, 1, .32, 1), transform 150ms cubic-bezier(.23, 1, .32, 1);
}
.eddm-float-btn:hover {
  background: #0F172A;
  color: #FFFFFF;
  transform: translateY(-1px);
}
.eddm-float-text {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.eddm-drag-marquee {
  position: absolute;
  z-index: 600;
  pointer-events: none;
  border: 2px dashed #059669;
  background: rgba(16, 185, 129, 0.16);
  border-radius: 4px;
}
.eddm-drag-marquee.is-deselect {
  border-color: #DC2626;
  background: rgba(220, 38, 38, 0.14);
}
.eddm-map-legend {
  padding: 10px 14px;
  background: #FFFFFF;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--ink-secondary);
}
.eddm-lg-swatch {
  display: inline-block;
  width: 14px;
  height: 4px;
  border-radius: 99px;
  vertical-align: middle;
  margin-right: 5px;
}
.eddm-lg-swatch.is-unselected { background: #2563EB; opacity: 0.7; }
.eddm-lg-swatch.is-selected { background: #059669; }
.eddm-lg-hint { margin-left: auto; color: var(--ink-secondary); }

.eddm-route-badge-wrap { background: transparent; border: none; }
.eddm-route-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 99px;
  background: #065F46;
  color: #FFFFFF;
  border: 1.5px solid #FFFFFF;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(6, 95, 70, 0.35);
  transform: translate(-50%, -50%);
}
.eddm-leaflet-tooltip {
  background: rgba(15, 23, 42, 0.96) !important;
  color: #F8FAFC !important;
  border: 1px solid rgba(148, 163, 184, 0.25) !important;
  border-radius: 10px !important;
  padding: 8px 11px !important;
  box-shadow: 0 12px 28px rgba(2, 6, 23, 0.38) !important;
}
.eddm-leaflet-tooltip::before { display: none !important; }
.eddm-tt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
  font-size: 12.5px;
}
.eddm-tt-pill {
  padding: 1px 6px;
  border-radius: 99px;
  font-size: 10.5px;
  font-weight: 700;
  background: rgba(59, 130, 246, 0.22);
  color: #BFDBFE;
}
.eddm-tt-pill.is-sel {
  background: rgba(16, 185, 129, 0.28);
  color: #A7F3D0;
}
.eddm-tt-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11.5px;
  color: #CBD5E1;
  font-variant-numeric: tabular-nums;
}

.eddm-route-drawer {
  display: flex;
  flex-direction: column;
  background: #FFFFFF;
  max-height: 562px;
}
.eddm-drawer-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.eddm-route-table {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.eddm-table-empty {
  padding: 20px 12px;
  font-size: 13px;
  color: var(--ink-secondary);
  line-height: 1.5;
}
.eddm-rt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #FFFFFF;
  transition: border-color 150ms cubic-bezier(.23, 1, .32, 1), background 150ms cubic-bezier(.23, 1, .32, 1);
}
.eddm-rt-row:hover {
  border-color: #93C5FD;
  background: #F8FAFC;
}
.eddm-rt-row.is-selected {
  border-color: #10B981;
  background: #ECFDF5;
}
.eddm-rt-check {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  flex: 1 1 auto;
  min-width: 0;
}
.eddm-rt-check input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: #059669;
  cursor: pointer;
  flex-shrink: 0;
}
.eddm-rt-id {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.eddm-rt-id strong {
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.eddm-rt-id small {
  font-size: 11px;
  color: var(--ink-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.eddm-rt-nums {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.eddm-rt-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
.eddm-rt-nums small {
  font-size: 11px;
  color: var(--ink-secondary);
}
.eddm-rt-zoom {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #FFFFFF;
  color: var(--ink-secondary);
  font-size: 15px;
  cursor: pointer;
  flex-shrink: 0;
  touch-action: manipulation;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
}
.eddm-rt-zoom:hover {
  border-color: var(--ink);
  color: var(--ink);
  background: #F1F5F9;
}

.eddm-wb-footer {
  padding: 14px 18px;
  background: #0F172A;
  color: #F8FAFC;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.eddm-sel-stats {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  font-variant-numeric: tabular-nums;
}
.eddm-sel-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.eddm-sel-stat span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94A3B8;
  font-weight: 600;
}
.eddm-sel-stat strong {
  font-size: 16px;
  font-weight: 700;
  color: #FFFFFF;
}

@media (max-width: 1080px) {
  .eddm-wb-grid { grid-template-columns: 1fr; }
  .eddm-map-stage { border-right: none; border-bottom: 1px solid var(--border); }
  .eddm-leaflet-canvas { height: 420px; }
  .eddm-route-drawer { max-height: 320px; }
}
@media (max-width: 760px) {
  .eddm-leaflet-canvas { height: 340px; }
  .eddm-lg-hint { margin-left: 0; }
}
