[hidden] { display: none !important; }

:root {
  color-scheme: light;
  --ink-950: #0b1220;
  --ink-900: #111c2f;
  --ink-800: #1c2a3d;
  --ink-700: #334155;
  --ink-600: #475569;
  --ink-500: #64748b;
  --ink-400: #94a3b8;
  --surface: #f3f6fa;
  --surface-2: #eaf0f6;
  --card: #ffffff;
  --border: #dce4ed;
  --border-strong: #c6d1dc;
  --blue-700: #175ea8;
  --blue-600: #1f73c9;
  --blue-500: #2e86de;
  --blue-100: #dceefe;
  --blue-50: #f0f7ff;
  --violet-600: #7557a8;
  --green-700: #23725b;
  --green-100: #dff4eb;
  --amber-700: #8b5a04;
  --amber-100: #fff1c7;
  --red-700: #a43743;
  --red-100: #fde7e9;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-md: 0 10px 30px rgba(15, 23, 42, .08);
  --shadow-lg: 0 24px 50px rgba(15, 23, 42, .12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  background: var(--surface);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink-900);
  background: var(--surface);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }

button, select, input[type="number"], input[type="range"] {
  accent-color: var(--blue-600);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(46, 134, 222, .24);
  outline-offset: 2px;
}

svg {
  display: block;
}

.product-shell {
  min-height: 100vh;
}

.product-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px 24px;
  color: #fff;
  background:
    radial-gradient(circle at 22% -100%, rgba(46, 134, 222, .42), transparent 45%),
    linear-gradient(110deg, #09111f 0%, #0f1d32 62%, #102641 100%);
  border-bottom: 1px solid rgba(255, 255, 255, .09);
  box-shadow: 0 8px 24px rgba(5, 12, 24, .18);
}

.brand-lockup,
.header-utility,
.live-status,
.primary-actions,
.map-toolbar-actions,
.map-footer,
.heat-legend,
.symbol-legend,
.workspace-badge {
  display: flex;
  align-items: center;
}

.brand-lockup { gap: 12px; }

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(46, 134, 222, .95), rgba(23, 94, 168, .92));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 8px 18px rgba(0, 0, 0, .18);
}

.brand-mark svg {
  width: 27px;
  height: 27px;
  fill: none;
  stroke: #fff;
  stroke-width: 1.8;
  stroke-linejoin: round;
}

.brand-name {
  font-size: 1rem;
  font-weight: 750;
  letter-spacing: -.01em;
}

.brand-context {
  margin-top: 2px;
  color: #9fb2c8;
  font-size: .76rem;
}

.header-utility {
  justify-content: flex-end;
  gap: 10px;
}

.live-status {
  gap: 9px;
}

.live-label {
  color: #91a6bd;
  font-size: .72rem;
}

.header-divider {
  width: 1px;
  height: 30px;
  margin: 0 4px;
  background: rgba(255, 255, 255, .12);
}

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 9px 13px;
  cursor: pointer;
  font-weight: 680;
  font-size: .82rem;
  transition: transform .15s ease, border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.button.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--blue-600), var(--blue-700));
  box-shadow: 0 8px 18px rgba(31, 115, 201, .22);
}

.button.primary:hover:not(:disabled) {
  box-shadow: 0 10px 24px rgba(31, 115, 201, .28);
}

.button.secondary {
  color: var(--blue-700);
  background: var(--blue-50);
  border-color: #c9e1f8;
}

.button.tertiary,
.button.map-button {
  color: var(--ink-700);
  background: #fff;
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.button.ghost {
  min-height: 36px;
  color: #d9e5f1;
  background: rgba(255, 255, 255, .045);
  border-color: rgba(255, 255, 255, .11);
}

.button.ghost:hover:not(:disabled) {
  color: #fff;
  background: rgba(255, 255, 255, .09);
}

.button.danger-text { color: #f2b6bd; }
.button.full-width, .full-width { width: 100%; }
.button:disabled { cursor: not-allowed; opacity: .55; transform: none; }

.app-layout {
  display: grid;
  grid-template-columns: 338px minmax(0, 1fr);
  align-items: start;
}

.control-rail {
  position: sticky;
  top: 72px;
  height: calc(100vh - 72px);
  overflow-y: auto;
  padding: 22px 20px 28px;
  background: #fff;
  border-right: 1px solid var(--border);
  scrollbar-width: thin;
  scrollbar-color: #c7d2df transparent;
}

.rail-intro {
  padding: 0 3px 20px;
  border-bottom: 1px solid var(--border);
}

.section-kicker {
  margin: 0 0 6px;
  color: var(--blue-700);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.rail-intro h1 {
  margin: 0;
  color: var(--ink-950);
  font-size: 1.3rem;
  line-height: 1.2;
  letter-spacing: -.025em;
}

.rail-intro p:last-child {
  margin: 8px 0 0;
  color: var(--ink-500);
  font-size: .8rem;
  line-height: 1.5;
}

.control-section {
  padding: 20px 3px;
  border-bottom: 1px solid var(--border);
}

.control-section-title {
  position: relative;
  display: grid;
  grid-template-columns: 31px minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  margin-bottom: 15px;
}

.step-number {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border: 1px solid #d2e4f4;
  border-radius: 8px;
  color: var(--blue-700);
  background: var(--blue-50);
  font-size: .68rem;
  font-weight: 800;
}

.control-section h2 {
  margin: 1px 0 0;
  color: var(--ink-900);
  font-size: .9rem;
  font-weight: 750;
  letter-spacing: -.01em;
}

.control-section-title p {
  margin: 3px 0 0;
  color: var(--ink-500);
  font-size: .7rem;
  line-height: 1.4;
}

.field {
  display: grid;
  gap: 6px;
  margin: 0 0 12px;
}

.field > span {
  color: var(--ink-700);
  font-size: .74rem;
  font-weight: 700;
}

.field select,
.field input[type="number"] {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  padding: 8px 10px;
  color: var(--ink-900);
  background: #fff;
  box-shadow: inset 0 1px 1px rgba(15, 23, 42, .025);
  transition: border-color .15s ease, box-shadow .15s ease;
}

.field select:hover,
.field input[type="number"]:hover {
  border-color: #9fb1c4;
}

.field select:focus,
.field input[type="number"]:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(46, 134, 222, .1);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.primary-actions {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  margin-top: 4px;
}

.helper-text {
  margin: 8px 0 0;
  color: var(--ink-500);
  font-size: .69rem;
  line-height: 1.45;
}

.toggle-row {
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin: 12px 0;
  cursor: pointer;
}

.toggle-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.toggle-control {
  position: relative;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: #cbd5e1;
  transition: background-color .18s ease;
}

.toggle-control::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  content: "";
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .3);
  transition: transform .18s ease;
}

.toggle-row input:checked + .toggle-control {
  background: var(--blue-600);
}

.toggle-row input:checked + .toggle-control::after {
  transform: translateX(16px);
}

.toggle-row input:focus-visible + .toggle-control {
  outline: 3px solid rgba(46, 134, 222, .22);
  outline-offset: 2px;
}

.toggle-row strong,
.toggle-row small {
  display: block;
}

.toggle-row strong {
  color: var(--ink-800);
  font-size: .76rem;
}

.toggle-row small {
  margin-top: 2px;
  color: var(--ink-500);
  font-size: .67rem;
  line-height: 1.35;
}

.toggle-row.compact {
  grid-template-columns: 32px minmax(0, 1fr);
  margin: 0;
  color: var(--ink-700);
  font-size: .72rem;
  font-weight: 650;
}

.toggle-row.compact .toggle-control {
  width: 32px;
  height: 18px;
}

.toggle-row.compact .toggle-control::after {
  width: 12px;
  height: 12px;
}

.toggle-row.compact input:checked + .toggle-control::after {
  transform: translateX(14px);
}

.layer-grid {
  display: grid;
  gap: 11px;
}

.weight-total {
  align-self: start;
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--blue-700);
  background: var(--blue-100);
  font-size: .68rem;
  font-weight: 800;
}

.weight-row {
  margin-bottom: 13px;
}

.weight-row:last-child { margin-bottom: 0; }

.weight-row label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 5px;
  color: var(--ink-700);
  font-size: .72rem;
  font-weight: 700;
}

.weight-row label span:last-child {
  color: var(--blue-700);
  font-variant-numeric: tabular-nums;
}

.weight-row input {
  width: 100%;
  height: 4px;
  cursor: pointer;
}

.model-disclosure {
  margin-top: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fafc;
}

.model-disclosure summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  cursor: pointer;
  list-style: none;
}

.model-disclosure summary::-webkit-details-marker { display: none; }

.model-disclosure summary strong,
.model-disclosure summary small {
  display: block;
}

.model-disclosure summary strong {
  color: var(--ink-800);
  font-size: .76rem;
}

.model-disclosure summary small {
  margin-top: 2px;
  color: var(--ink-500);
  font-size: .66rem;
}

.model-disclosure summary svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: var(--ink-500);
  stroke-width: 1.8;
  transition: transform .18s ease;
}

.model-disclosure[open] summary svg {
  transform: rotate(180deg);
}

.model-disclosure-body {
  padding: 0 14px 11px;
}

.model-disclosure-body p {
  margin: 0 0 7px;
  color: var(--ink-500);
  font-size: .67rem;
  line-height: 1.45;
}

.workspace {
  min-width: 0;
  padding: 28px;
}

.workspace-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.workspace-heading h2 {
  margin: 0;
  color: var(--ink-950);
  font-size: 1.55rem;
  line-height: 1.2;
  letter-spacing: -.03em;
}

.workspace-heading #statusText {
  max-width: 820px;
  margin: 7px 0 0;
  color: var(--ink-500);
  font-size: .8rem;
  line-height: 1.45;
}

.workspace-badge {
  flex: 0 0 auto;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--ink-600);
  background: #fff;
  font-size: .7rem;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.workspace-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blue-500);
  box-shadow: 0 0 0 4px rgba(46, 134, 222, .11);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.metric-icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
}

.metric-icon svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.metric-icon.warehouse-icon {
  color: var(--blue-700);
  background: var(--blue-100);
}

.metric-icon.plant-icon {
  color: var(--violet-600);
  background: #eee7f8;
}

.metric-icon.coverage-icon {
  color: var(--green-700);
  background: var(--green-100);
}

.metric-icon.route-icon {
  color: #b25b21;
  background: #fff0e3;
}

.metric span {
  display: block;
  overflow: hidden;
  margin-bottom: 4px;
  color: var(--ink-500);
  font-size: .68rem;
  line-height: 1.3;
  text-overflow: ellipsis;
}

.metric strong {
  color: var(--ink-950);
  font-size: 1.35rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.025em;
}

.map-panel,
.data-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-md);
}

.map-panel {
  overflow: hidden;
}

.map-toolbar {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
}

.map-toolbar h3,
.data-panel h3 {
  margin: 0;
  color: var(--ink-900);
  font-size: .94rem;
  letter-spacing: -.01em;
}

.map-toolbar p {
  margin: 4px 0 0;
  color: var(--ink-500);
  font-size: .7rem;
}

.map-toolbar-actions {
  gap: 12px;
}

.opacity-control {
  display: grid;
  min-width: 160px;
  gap: 5px;
  color: var(--ink-500);
  font-size: .66rem;
  font-weight: 700;
}

.opacity-control input { width: 100%; }

.map-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1000 / 720;
  overflow: hidden;
  touch-action: none;
  background:
    linear-gradient(rgba(255,255,255,.22), rgba(255,255,255,.22)),
    #e8f0f6;
  cursor: grab;
}

.map-stage:active { cursor: grabbing; }

.map-viewport {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
  will-change: transform;
}

.map-base,
#mapOverlay {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.map-base {
  filter: saturate(.7) contrast(.98) brightness(1.015);
}

#mapOverlay { overflow: visible; }

.map-error {
  position: absolute;
  z-index: 20;
  inset: 18px auto auto 18px;
  max-width: 420px;
  padding: 11px 13px;
  border: 1px solid #e2a9af;
  border-radius: 9px;
  color: var(--red-700);
  background: #fff4f5;
  font-size: .76rem;
  font-weight: 700;
  box-shadow: var(--shadow-md);
}

.map-tooltip {
  position: absolute;
  z-index: 30;
  max-width: 255px;
  padding: 9px 11px;
  pointer-events: none;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 9px;
  color: #fff;
  background: rgba(11, 18, 32, .95);
  font-size: .72rem;
  line-height: 1.5;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(8px);
}

.map-footer {
  justify-content: space-between;
  gap: 16px;
  padding: 11px 16px;
  border-top: 1px solid var(--border);
  background: #fbfcfe;
}

.heat-legend,
.symbol-legend {
  gap: 9px;
  color: var(--ink-500);
  font-size: .66rem;
}

.legend-gradient {
  width: clamp(110px, 18vw, 230px);
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, #fff5d9, #f9d780, #eea543, #d66b25, #8d321d);
}

.legend-key {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-key i {
  display: inline-block;
  width: 9px;
  height: 9px;
}

.warehouse-key {
  border-radius: 50%;
  background: var(--blue-500);
}

.plant-key {
  background: var(--violet-600);
  transform: rotate(45deg);
}

.route-attribution {
  color: var(--ink-400);
  font-size: .61rem;
}

.insight-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.data-panel {
  min-width: 0;
  padding: 18px;
}

.data-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 13px;
}

.data-panel-header .section-kicker {
  margin-bottom: 4px;
}

.count-chip {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 8px;
  color: var(--ink-600);
  background: #f8fafc;
  font-size: .65rem;
  font-weight: 750;
}

.ranking-list,
.selected-list {
  display: grid;
  gap: 8px;
}

.ranking-item,
.selected-item {
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 11px 12px;
  color: inherit;
  background: #fff;
}

.ranking-item {
  width: 100%;
  cursor: pointer;
  text-align: left;
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.ranking-item:hover {
  transform: translateY(-1px);
  border-color: #a9c7e2;
  background: var(--blue-50);
  box-shadow: 0 7px 18px rgba(15, 23, 42, .07);
}

.item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.item-title {
  color: var(--ink-900);
  font-size: .78rem;
  font-weight: 780;
}

.item-meta {
  margin-top: 4px;
  color: var(--ink-500);
  font-size: .67rem;
  line-height: 1.5;
}

.score {
  flex: 0 0 auto;
  min-width: 41px;
  border-radius: 999px;
  padding: 5px 7px;
  color: #fff;
  background: linear-gradient(135deg, var(--blue-600), var(--blue-700));
  font-size: .67rem;
  font-weight: 800;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.remove-button {
  border: 0;
  padding: 2px;
  cursor: pointer;
  color: var(--red-700);
  background: transparent;
  font-size: .65rem;
  font-weight: 750;
}

.empty {
  margin: 0;
  padding: 20px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  color: var(--ink-500);
  background: #fafbfd;
  font-size: .72rem;
  text-align: center;
}

.workspace-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 3px 0;
  color: var(--ink-400);
  font-size: .65rem;
}

/* Map marks */
.heat-node { fill: #1d6ead; }
.service-ring { fill: rgba(46, 134, 222, .035); stroke: #2e86de; stroke-width: 1.2; stroke-dasharray: 6 5; }
.plant-service-ring { fill: rgba(117, 87, 168, .03); stroke: #7557a8; stroke-width: 1.2; stroke-dasharray: 3 5; }
.assignment-line { stroke: #5d7387; stroke-width: .7; opacity: .16; }
.direct-assignment-line { stroke: #7557a8; stroke-width: 1; opacity: .28; }
.plant-lane { stroke: #7557a8; stroke-width: 1.8; opacity: .45; stroke-dasharray: 7 4; }
.demand-node { fill: #21669d; stroke: #fff; stroke-width: .7; opacity: .68; }
.candidate-node { fill: #fff; stroke: #1e669e; stroke-width: 1.25; cursor: pointer; }
.candidate-node:hover { stroke-width: 2.4; }
.warehouse-node { fill: #2e86de; stroke: #0e3f69; stroke-width: 2; filter: url(#softShadow); cursor: pointer; }
.plant-node { fill: #7557a8; stroke: #37284a; stroke-width: 2; filter: url(#softShadow); cursor: pointer; }
.map-label { font-size: 12px; font-weight: 800; fill: #173b57; paint-order: stroke; stroke: #fff; stroke-width: 3px; stroke-linejoin: round; pointer-events: none; }
.rank-label { font-size: 10px; font-weight: 900; fill: #173b57; text-anchor: middle; dominant-baseline: middle; pointer-events: none; }

.routing-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: .67rem;
  font-weight: 800;
}

.routing-status::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  content: "";
  background: currentColor;
  box-shadow: 0 0 0 3px currentColor;
  opacity: .75;
}

.routing-status.loading { color: #f3ce74; background: rgba(139, 90, 4, .23); }
.routing-status.ready { color: #8fe1c1; background: rgba(35, 114, 91, .24); }
.routing-status.fallback { color: #ffcc82; background: rgba(139, 90, 4, .23); }
.routing-status.error { color: #ff9da8; background: rgba(164, 55, 67, .24); }

@media (max-width: 1180px) {
  .app-layout { grid-template-columns: 310px minmax(0, 1fr); }
  .workspace { padding: 22px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .product-header {
    position: relative;
    align-items: flex-start;
    flex-direction: column;
  }

  .header-utility {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .header-divider { display: none; }

  .app-layout { grid-template-columns: 1fr; }

  .control-rail {
    position: relative;
    top: 0;
    width: 100%;
    height: auto;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .workspace { padding: 20px; }
  .insight-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .product-header { padding: 12px 16px; }
  .brand-context, .live-label { display: none; }
  .header-utility { gap: 7px; }
  .workspace { padding: 14px; }

  .workspace-heading,
  .map-toolbar,
  .map-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .workspace-badge { align-self: flex-start; }
  .metric-grid { grid-template-columns: 1fr; }

  .map-toolbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .opacity-control { min-width: 0; }
  .heat-legend, .symbol-legend { flex-wrap: wrap; }

  .field-grid { grid-template-columns: 1fr; }
  .workspace-footer { flex-direction: column; }
}

.preset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.preset-button {
  display: grid;
  gap: 3px;
  min-height: 58px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
  text-align: left;
  color: var(--ink-700);
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s ease, background-color .15s ease, transform .15s ease, box-shadow .15s ease;
}

.preset-button:hover {
  transform: translateY(-1px);
  border-color: #a8c6df;
  background: var(--blue-50);
  box-shadow: 0 6px 16px rgba(15, 23, 42, .06);
}

.preset-button.active {
  border-color: var(--blue-500);
  color: var(--blue-700);
  background: var(--blue-50);
  box-shadow: inset 0 0 0 1px rgba(46, 134, 222, .12);
}

.preset-title {
  font-size: .72rem;
  font-weight: 780;
  line-height: 1.25;
}

.preset-mix {
  color: var(--ink-500);
  font-size: .63rem;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}

.preset-button.active .preset-mix {
  color: var(--blue-700);
}

.custom-preset {
  border-style: dashed;
}

.custom-weight-panel {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 12px;
  background: #f8fafc;
}

.custom-weight-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
}

.compact-field {
  margin-bottom: 0;
}

.compact-field input[type="number"] {
  min-height: 36px;
}

.custom-weight-footer {
  display: grid;
  gap: 9px;
  margin-top: 11px;
}

.custom-weight-message {
  min-height: 18px;
  font-size: .67rem;
  font-weight: 700;
}

.custom-weight-message.valid {
  color: var(--green-700);
}

.custom-weight-message.invalid {
  color: var(--red-700);
}

.active-weight-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 10px;
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 11px;
  color: var(--ink-500);
  font-size: .65rem;
  font-variant-numeric: tabular-nums;
}

.active-weight-summary strong {
  color: var(--ink-700);
}

.weight-total.valid {
  color: var(--green-700);
  background: var(--green-100);
}

.weight-total.invalid {
  color: var(--red-700);
  background: var(--red-100);
}

@media (max-width: 430px) {
  .preset-grid,
  .custom-weight-grid,
  .active-weight-summary {
    grid-template-columns: 1fr;
  }
}

.industry-section {
  background: linear-gradient(180deg, #fbfdff, #ffffff);
}
.profile-card {
  border: 1px solid #d7e3ed;
  border-radius: 11px;
  padding: 11px 12px;
  background: linear-gradient(145deg, #f6faff, #ffffff);
  box-shadow: var(--shadow-sm);
}
.profile-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.profile-card-head > span:first-child {
  color: var(--ink-900);
  font-size: .74rem;
  font-weight: 800;
}
.confidence-chip {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 4px 7px;
  color: var(--green-700);
  background: var(--green-100);
  font-size: .59rem;
  font-weight: 800;
}
.profile-card p {
  margin: 0;
  color: var(--ink-500);
  font-size: .66rem;
  line-height: 1.45;
}
.profile-method {
  margin-top: 8px;
  border-top: 1px solid var(--border);
  padding-top: 7px;
  color: var(--blue-700);
  font-size: .62rem;
  font-weight: 700;
  line-height: 1.4;
}
.demand-legend-wrap {
  display: grid;
  gap: 4px;
}
.demand-legend-title {
  color: var(--ink-700);
  font-size: .65rem;
  font-weight: 800;
}
.legend-note {
  color: var(--ink-400);
  font-size: .58rem;
}
.demand-gradient {
  width: clamp(150px, 22vw, 270px);
}
.demand-heat-node {
  fill: #e7832f;
  pointer-events: none;
}
.demand-zone {
  cursor: pointer;
  stroke: rgba(126, 67, 24, .22);
  stroke-width: .55;
  transition: opacity .12s ease, stroke-width .12s ease;
}
.demand-zone:hover {
  stroke: #7c351d;
  stroke-width: 1.5;
  opacity: 1 !important;
}
.demand-zone.level-1 { fill: #fff1c4; }
.demand-zone.level-2 { fill: #f9d675; }
.demand-zone.level-3 { fill: #efa442; }
.demand-zone.level-4 { fill: #d86f2b; }
.demand-zone.level-5 { fill: #993c22; }
.demand-bubble {
  cursor: pointer;
  fill: rgba(218, 104, 37, .42);
  stroke: rgba(130, 53, 25, .88);
  stroke-width: 1.25;
  filter: url(#softShadow);
  transition: stroke-width .12s ease, fill .12s ease;
}
.demand-bubble:hover {
  fill: rgba(218, 104, 37, .62);
  stroke-width: 2.2;
}
.demand-bubble-core {
  fill: #a23e21;
  pointer-events: none;
}
.demand-market-label {
  fill: #71331f;
  font-size: 10.5px;
  font-weight: 850;
  paint-order: stroke;
  stroke: rgba(255,255,255,.94);
  stroke-width: 3px;
  stroke-linejoin: round;
  pointer-events: none;
}
.demand-share-label {
  fill: #8c4124;
  font-size: 8.5px;
  font-weight: 800;
  paint-order: stroke;
  stroke: rgba(255,255,255,.94);
  stroke-width: 2.5px;
  pointer-events: none;
}
.signal-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  margin-top: 6px;
  color: #dbe8f2;
  font-size: .65rem;
}
.signal-grid strong { color: #fff; }
.map-stage { min-height: 480px; }
@media (max-width: 680px) {
  .demand-legend-wrap { width: 100%; }
  .map-stage { min-height: 400px; }
}
