/* ZIP Code Territory Map (2026-10-11). Desktop: a fixed-height box, the sidebar scrolls inside it and the map fills the
   rest (as zip-mapper). Phone: sidebar then map in the page flow, no scroll box of its own (the phone-map-visible rule).
   !important on the container: global.css's .tool-container grid is bundled after this file (see zip-mapper.css). */
.zt-container {
  display: flex !important;
  gap: 0 !important;
  height: 760px !important;
  max-height: 760px !important;
  overflow: hidden !important;
  padding: 0 !important;
  max-width: 1400px;
  margin: 0 auto 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
}
.zt-container .tool-sidebar {
  width: 380px;
  flex-shrink: 0;
  overflow-y: auto;
  background: var(--card);
  border-right: 1px solid var(--border);
}
.zt-container .sidebar-content { padding: 18px 20px; }
.zt-container .map-container { flex: 1; min-width: 0; min-height: 0; height: 100%; }
.zt-container #map { height: 100%; border-radius: 0; box-shadow: none; }

.zt-container .tool-section { margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.zt-container .tool-section:last-child { border-bottom: none; margin-bottom: 0; }
.zt-container .tool-section h3 { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; font-size: 15px; }
.zt-container label { display: block; font-size: 13px; font-weight: 600; color: var(--text-muted); margin: 10px 0 5px; }
.zt-container select, .zt-container input[type="number"], .zt-container textarea {
  width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text); font-size: 14px;
}
.zt-container textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; resize: vertical; }
.zt-container .zt-radio, .zt-container .zt-check { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--text); margin: 6px 0; }
.zt-container .zt-radio input, .zt-container .zt-check input { width: auto; margin: 0; }
.zt-mode { display: flex; gap: 16px; flex-wrap: wrap; }
.zt-hint, .zt-note { font-size: 12px; color: var(--text-muted); line-height: 1.5; margin: 6px 0 0; }
.zt-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.zt-row .btn { flex: 1 1 auto; }
#ztRun { margin-top: 14px; }
.zt-example { margin-top: 8px; }
.zt-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.zt-chips:empty { display: none; }
.zt-chip { border: 1px solid var(--border); background: var(--bg); color: var(--text); border-radius: 999px; padding: 3px 10px; font-size: 12px; cursor: pointer; }
.zt-problems { font-size: 12px; line-height: 1.5; color: var(--text); }
.zt-problems:empty { display: none; }
.zt-problems ul { margin: 4px 0 0; padding-left: 18px; }
.zt-busy[hidden] { display: none; }
.zt-busy { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--text-muted); }
.zt-spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--primary, #2563eb); animation: zt-spin 0.8s linear infinite; }
@keyframes zt-spin { to { transform: rotate(360deg); } }

.zt-balance p { font-size: 13px; line-height: 1.5; margin: 0 0 8px; }
.zt-ok { color: #15803d; }
.zt-warn { color: #b45309; }
.zt-table-wrap { overflow-x: auto; }
.zt-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.zt-table th, .zt-table td { padding: 5px 4px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.zt-table th { font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.zt-table .zt-num { text-align: right; white-space: nowrap; }
.zt-table .zt-off { color: #b45309; font-weight: 600; }
.zt-sub { font-size: 11px; color: var(--text-muted); margin-left: 18px; overflow-wrap: anywhere; }
.zt-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; border: 1px solid rgba(0,0,0,0.25); }
.zt-notes { font-size: 12px; line-height: 1.5; color: var(--text); margin-top: 8px; }
.zt-notes p { margin: 6px 0; }
.zt-notes ul { margin: 4px 0; padding-left: 18px; max-height: 140px; overflow-y: auto; }
.zt-notes summary { cursor: pointer; font-weight: 600; }
.zt-edit .btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.zt-popup { font-size: 13px; line-height: 1.5; min-width: 180px; }
.zt-popup strong { display: block; margin-bottom: 2px; }
.zt-move { display: flex; gap: 6px; margin-top: 8px; }
.zt-move select { flex: 1; min-width: 0; padding: 4px; }
.zt-move .btn { padding: 4px 10px; }

/* Territory outlines, gap links and the state outline are drawn on canvases above or below the ZIP areas. A canvas
   with nothing clickable on it still swallows clicks, so these two panes let them through to the ZIP areas. */
.leaflet-ztLines-pane canvas, .leaflet-ztOutline-pane canvas { pointer-events: none !important; }

@media (max-width: 900px) {
  .zt-container {
    flex-direction: column;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  .zt-container .tool-sidebar { width: 100%; overflow: visible; border-right: none; border-bottom: 1px solid var(--border); }
  .zt-container .map-container { flex: none; height: 75vh; min-height: 380px; max-height: 640px; }
}
