.maps-tool {
  position: relative;
  z-index: 1;
  display: none;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  font-family: inherit;
  pointer-events: auto;
}

.maps-tool.is-open {
  display: flex;
  min-height: 0;
}

.maps-tool__backdrop {
  display: none;
}

.maps-tool__panel {
  position: relative;
  inset: auto;
  display: flex;
  z-index: 1;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  background: var(--surface-card, #ffffff);
  color: var(--text-color, #1f2937);
  box-shadow: none;
  transform: none;
  transition: none;
  border-left: 1px solid rgba(15, 23, 42, 0.08);
  pointer-events: auto;
  touch-action: pan-y manipulation;
  overflow: hidden;
}

.maps-tool__resize-handle {
  position: absolute;
  top: 0;
  left: -10px;
  width: 20px;
  height: 100%;
  padding: 0;
  border: 0;
  background: linear-gradient(90deg, transparent 0, rgba(92, 26, 38, 0.06) 45%, transparent 100%);
  cursor: ew-resize;
  touch-action: none;
  z-index: 2;
}

.maps-tool__resize-handle::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 9px;
  width: 3px;
  height: 84px;
  border-radius: 999px;
  background: rgba(92, 26, 38, 0.26);
  transform: translateY(-50%);
}

.maps-tool__resize-handle:hover::before {
  background: rgba(92, 26, 38, 0.42);
}

.maps-tool__panel-inner,
.maps-tool__screen {
  height: 100%;
}

.maps-tool__panel-inner {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
}

.maps-tool__screen {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.maps-tool__screen[hidden] {
  display: none !important;
}

.maps-tool__screen--editor {
  overflow: hidden;
}

.maps-tool__screen--selector {
  overflow-y: auto;
  padding: 22px 20px 18px;
  gap: 18px;
  scrollbar-width: thin;
  scrollbar-color: rgba(92, 26, 38, 0.32) transparent;
}

.maps-tool__screen--selector::-webkit-scrollbar {
  width: 10px;
}

.maps-tool__screen--selector::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(92, 26, 38, 0.28);
  border: 2px solid transparent;
  background-clip: padding-box;
}

.maps-tool__selector-head,
.maps-tool__editor-head {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.maps-tool__selector-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.maps-tool__editor-head {
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--surface-border, rgba(15, 23, 42, 0.08));
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.94));
  position: sticky;
  top: 0;
  z-index: 3;
  flex: 0 0 auto;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.06);
}

.maps-tool__editor-summary,
.maps-tool__editor-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.maps-tool__editor-summary {
  justify-content: space-between;
}

.maps-tool__editor-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.maps-tool__editor-title-wrap {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.maps-tool__editor-title-wrap h3 {
  overflow-wrap: anywhere;
}

.maps-tool__editor-title-wrap p {
  margin: 0;
  color: var(--text-light, rgba(15, 23, 42, 0.68));
  font-size: 0.82rem;
  line-height: 1.45;
}

.maps-tool__editor-statuses {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.maps-tool__eyebrow {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary-color, #5c1a26);
}

.maps-tool__selector-head h2,
.maps-tool__editor-head h3 {
  margin: 0;
  font-size: 1.22rem;
  line-height: 1.18;
  letter-spacing: -0.02em;
}

.maps-tool__lead {
  margin: 8px 0 0;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text-light, rgba(15, 23, 42, 0.68));
}

.maps-tool__icon-btn,
.maps-tool__secondary-btn,
.maps-tool__tool-btn,
.maps-tool__chip,
.maps-tool__swatch,
.maps-tool__type-card,
.maps-tool__main-placeholder {
  appearance: none;
  border: 0;
  font: inherit;
}

.maps-tool__icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-color, #1f2937);
  background: rgba(92, 26, 38, 0.08);
  cursor: pointer;
}

.maps-tool__icon-btn--danger {
  background: rgba(239, 68, 68, 0.1);
  color: #b91c1c;
}

.maps-tool__secondary-btn {
  height: 36px;
  padding: 0 12px;
  border-radius: 11px;
  background: rgba(92, 26, 38, 0.08);
  color: var(--primary-color, #5c1a26);
  font-size: 0.86rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.maps-tool__type-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.maps-tool__type-card {
  min-height: 144px;
  padding: 14px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.94), rgba(248,244,246,0.98));
  border: 1px solid rgba(92, 26, 38, 0.1);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  text-align: left;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.maps-tool__type-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.12);
  border-color: rgba(92, 26, 38, 0.35);
}

.maps-tool__type-card.is-suggested {
  border-color: rgba(37, 99, 235, 0.34);
  box-shadow: 0 16px 36px rgba(37, 99, 235, 0.12);
}

.maps-tool__type-preview {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 70px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(92, 26, 38, 0.04), rgba(92, 26, 38, 0.01));
}

.maps-tool__type-preview svg {
  width: 100%;
  max-width: 122px;
  height: 70px;
  fill: none;
  stroke: var(--primary-color, #5c1a26);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.maps-tool__type-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.maps-tool__type-content strong {
  font-size: 0.96rem;
}

.maps-tool__type-content small {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-light, rgba(15, 23, 42, 0.68));
}

.maps-tool__type-arrow {
  align-self: end;
  color: var(--primary-color, #5c1a26);
}

.maps-tool__tutorial-strip {
  margin-top: auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(92, 26, 38, 0.06);
  font-size: 0.82rem;
  color: var(--text-light, rgba(15, 23, 42, 0.75));
}

.maps-tool__inline-tutorial {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid rgba(92, 26, 38, 0.1);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(248,244,246,0.98));
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.maps-tool__inline-tutorial-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.maps-tool__inline-tutorial-head strong {
  font-size: 0.95rem;
}

.maps-tool__inline-tutorial ol {
  margin: 0 0 0 18px;
  padding: 0;
  display: grid;
  gap: 8px;
  font-size: 0.86rem;
  line-height: 1.5;
}

.maps-tool__steps {
  display: inline-flex;
  gap: 4px;
}

.maps-tool__steps i {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(92, 26, 38, 0.2);
  animation: maps-tool-pulse 1.3s ease-in-out infinite;
}

.maps-tool__steps i:nth-child(2) { animation-delay: 0.12s; }
.maps-tool__steps i:nth-child(3) { animation-delay: 0.24s; }

@keyframes maps-tool-pulse {
  0%, 100% { opacity: 0.35; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.15); }
}

.maps-tool__workspace {
  display: grid;
  grid-template-columns: minmax(176px, var(--maps-tool-toolbar-width, 224px)) 12px minmax(0, 1fr);
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.maps-tool__toolbar {
  padding: 14px 12px 18px;
  min-height: 0;
  height: 100%;
  overflow: auto;
  background: linear-gradient(180deg, rgba(248, 249, 251, 0.98), rgba(243, 246, 249, 0.98));
  touch-action: pan-x pan-y;
  overscroll-behavior: contain;
  border-right: 1px solid rgba(15, 23, 42, 0.06);
}

.maps-tool__workspace-resize-handle {
  position: relative;
  padding: 0;
  border: 0;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.03), rgba(15, 23, 42, 0.06));
  cursor: ew-resize;
  touch-action: none;
}

.maps-tool__workspace-resize-handle::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 72px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.22);
  transform: translate(-50%, -50%);
}

.maps-tool__tool-group {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.maps-tool__tool-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-light, rgba(15, 23, 42, 0.62));
}

.maps-tool__tool-btn {
  min-height: 34px;
  padding: 8px 10px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--text-color, #1f2937);
  border: 1px solid rgba(92, 26, 38, 0.08);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-start;
  cursor: pointer;
}

.maps-tool__tool-btn.is-active,
.maps-tool__chip.is-active {
  background: var(--primary-color, #5c1a26);
  color: #ffffff;
  border-color: transparent;
}

.maps-tool__tool-btn:disabled {
  cursor: default;
  opacity: 0.46;
}

.maps-tool__segmented,
.maps-tool__palette {
  display: grid;
  gap: 7px;
}

.maps-tool__segmented > span,
.maps-tool__palette > span {
  font-size: 12px;
  font-weight: 600;
}

.maps-tool__segmented > div,
.maps-tool__palette > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.maps-tool__chip {
  min-height: 30px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid rgba(92, 26, 38, 0.14);
  background: rgba(255, 255, 255, 0.94);
  color: var(--text-color, #1f2937);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.maps-tool__swatch {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--swatch);
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.1);
  cursor: pointer;
}

.maps-tool__swatch.is-active {
  box-shadow: 0 0 0 2px var(--primary-color, #5c1a26);
}

.maps-tool__swatch.is-light {
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.14);
}

.maps-tool__canvas-shell {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(245,247,250,0.98));
  overflow: hidden;
}

.maps-tool__status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(92, 26, 38, 0.08);
  color: var(--primary-color, #5c1a26);
  font-size: 12px;
  font-weight: 700;
  max-width: 100%;
}

.maps-tool__status--ghost {
  background: rgba(15, 23, 42, 0.06);
  color: var(--text-light, rgba(15, 23, 42, 0.7));
}

.maps-tool__canvas-viewport {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.05), transparent 24%),
    linear-gradient(180deg, #ffffff, #f8fafc);
  touch-action: none;
  cursor: grab;
}

.maps-tool__canvas-viewport:active {
  cursor: grabbing;
}

.maps-tool__canvas-grid,
.maps-tool__scene,
.maps-tool__edges,
.maps-tool__drawings,
.maps-tool__groups,
.maps-tool__nodes,
.maps-tool__texts {
  position: absolute;
  inset: 0;
}

.maps-tool__canvas-grid {
  background-image:
    linear-gradient(rgba(15, 23, 42, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.045) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0;
  transition: opacity 180ms ease;
}

.maps-tool__canvas-grid.is-visible {
  opacity: 1;
  cursor: grab;
}

.maps-tool__scene {
  width: 2000px;
  height: 2000px;
  transform-origin: top left;
}

.maps-tool__edges,
.maps-tool__drawings {
  overflow: visible;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.maps-tool__edges [data-edge-id] {
  pointer-events: auto;
}

.maps-tool__edge-path {
  fill: none;
  stroke: rgba(92, 26, 38, 0.72);
  stroke-width: 2.5;
  cursor: pointer;
}

.maps-tool__edge-path.is-selected {
  stroke: #2563eb;
  stroke-width: 3.2;
}

.maps-tool__edge-label {
  fill: var(--primary-color, #5c1a26);
  font: 700 11px Poppins, sans-serif;
  paint-order: stroke;
  stroke: rgba(255,255,255,0.92);
  stroke-width: 4px;
  stroke-linejoin: round;
}

.maps-tool__group {
  position: absolute;
  border: 2px dashed rgba(92, 26, 38, 0.34);
  border-radius: 18px;
  background: rgba(92, 26, 38, 0.03);
}

.maps-tool__group header {
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary-color, #5c1a26);
}

.maps-tool__group.is-selected {
  border-color: #2563eb;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.24);
}

.maps-tool__node,
.maps-tool__free-text {
  position: absolute;
  cursor: grab;
}

.maps-tool__node {
  border: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.1);
  padding: 12px 14px 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  user-select: none;
  backdrop-filter: blur(8px);
}

.maps-tool__node--rounded { border-radius: 18px; }
.maps-tool__node--rectangle { border-radius: 10px; }
.maps-tool__node--ellipse { border-radius: 999px; }
.maps-tool__node--stadium { border-radius: 999px; }
.maps-tool__node--circle { border-radius: 999px; }
.maps-tool__node--diamond {
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  padding: 18px 20px;
}
.maps-tool__node--hexagon {
  clip-path: polygon(10% 0%, 90% 0%, 100% 50%, 90% 100%, 10% 100%, 0% 50%);
  padding: 16px 18px;
}
.maps-tool__node--parallelogram {
  clip-path: polygon(10% 0%, 100% 0%, 90% 100%, 0% 100%);
  padding: 12px 18px;
}

.maps-tool__node.is-selected,
.maps-tool__free-text.is-selected {
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.55), 0 14px 32px rgba(15, 23, 42, 0.14);
}

.maps-tool__node-text {
  font-weight: 600;
  line-height: 1.35;
  outline: none;
  white-space: pre-wrap;
}

.maps-tool__node-meta {
  font-size: 11px;
  line-height: 1.2;
  opacity: 0.72;
}

.maps-tool__node-delete {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 0;
  background: #ffffff;
  color: #b91c1c;
  box-shadow: 0 6px 12px rgba(15, 23, 42, 0.16);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.maps-tool__node-resize {
  position: absolute;
  right: -7px;
  bottom: -7px;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: #2563eb;
  box-shadow: 0 0 0 2px #ffffff;
}

.maps-tool__free-text {
  min-width: 80px;
  padding: 4px 6px;
  font-weight: 600;
}

.maps-tool__free-text div {
  outline: none;
  white-space: pre-wrap;
}

.maps-tool__main-placeholder {
  position: absolute;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%);
  min-width: 230px;
  min-height: 88px;
  border-radius: 18px;
  border: 2px dashed rgba(92, 26, 38, 0.34);
  background: rgba(92, 26, 38, 0.03);
  color: var(--text-light, rgba(15, 23, 42, 0.72));
  font-weight: 700;
  cursor: pointer;
}

.maps-tool__table {
  position: absolute;
  top: 80px;
  left: 90px;
  right: 90px;
  min-width: 340px;
  display: grid;
  gap: 1px;
  background: rgba(15, 23, 42, 0.08);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.12);
}

.maps-tool__table-cell {
  min-height: 54px;
  background: #ffffff;
}

.maps-tool__table-cell.is-header {
  background: #f8e5ea;
}

.maps-tool__table-cell.is-selected {
  box-shadow: inset 0 0 0 2px #2563eb;
}

.maps-tool__table-cell-inner {
  min-height: 54px;
  padding: 12px;
  outline: none;
  font-size: 13px;
  line-height: 1.35;
}

.maps-tool__context-menu {
  position: fixed;
  z-index: 1410;
  min-width: 180px;
  padding: 8px;
  border-radius: 14px;
  background: var(--surface-card, #ffffff);
  border: 1px solid var(--surface-border, rgba(15, 23, 42, 0.08));
  box-shadow: 0 20px 36px rgba(15, 23, 42, 0.18);
}

.maps-tool__context-menu button {
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-color, #1f2937);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.maps-tool__context-menu button:hover {
  background: rgba(92, 26, 38, 0.07);
}

.maps-tool__tutorial-mask {
  display: none;
}

.maps-tool__tutorial-mask[hidden] {
  display: none !important;
}

body.dark-mode .maps-tool__panel,
body.dark-mode .maps-tool__context-menu,
body.dark-mode .maps-tool__inline-tutorial {
  background: #12162a;
  color: #eef2ff;
  border-color: rgba(255, 255, 255, 0.08);
}

body.dark-mode .maps-tool__lead,
body.dark-mode .maps-tool__type-content small,
body.dark-mode .maps-tool__tool-label,
body.dark-mode .maps-tool__status--ghost {
  color: rgba(226, 232, 240, 0.72);
}

body.dark-mode .maps-tool__type-card,
body.dark-mode .maps-tool__tool-btn,
body.dark-mode .maps-tool__chip {
  background: rgba(19, 24, 39, 0.92);
  color: #eef2ff;
  border-color: rgba(255, 255, 255, 0.08);
}

body.dark-mode .maps-tool__type-preview,
body.dark-mode .maps-tool__toolbar,
body.dark-mode .maps-tool__workspace-resize-handle,
body.dark-mode .maps-tool__tutorial-strip,
body.dark-mode .maps-tool__icon-btn,
body.dark-mode .maps-tool__secondary-btn,
body.dark-mode .maps-tool__status {
  background: rgba(255, 255, 255, 0.06);
  color: #eef2ff;
}

body.dark-mode .maps-tool__canvas-viewport,
body.dark-mode .maps-tool__table-cell {
  background: #1a1a2e;
}

body.dark-mode .maps-tool__canvas-grid {
  background-image: radial-gradient(rgba(255, 255, 255, 0.12) 0.8px, transparent 0.8px);
}

body.dark-mode .maps-tool__table {
  background: rgba(255, 255, 255, 0.12);
}

body.dark-mode .maps-tool__table-cell.is-header {
  background: rgba(92, 26, 38, 0.45);
}

body.dark-mode .maps-tool__node {
  border-color: rgba(255, 255, 255, 0.09);
}

body.dark-mode .maps-tool__edge-label {
  stroke: rgba(18,22,42,0.9);
}
