/* ============================================================
   Time Engine — UI Styles
   WeatherAgency · Clean slate, no dependency on legacy time-engine.css
   ============================================================ */

/* ── Crop draw mode ──────────────────────────────────────────── */

/* Crosshair cursor on the map canvas while drawing a bbox */
.te-crop-active .mapboxgl-canvas {
  cursor: crosshair !important;
}

/* Dashed rect drawn on screen while the user drags */
.te-crop-indicator {
  display: none;
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  border: 2px dashed #1A6FD4;
  background: transparent;
  border-radius: 4px;
}

/* ── Accordion ───────────────────────────────────────────────── */

.te-accordion {
  /* Glass panel — matches app UI (backdrop-filter, frosted) */
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-md);
  margin: 4px 0 2px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  animation: te-slide-down 200ms cubic-bezier(0.16, 1, 0.3, 1) both;
  overflow: hidden;
}

@keyframes te-slide-down {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.te-acc-section {
  padding: 10px 12px;
}

.te-acc-section+.te-acc-section {
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.te-acc-head {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.te-acc-head svg {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  opacity: 0.7;
}

.te-range-hint {
  font-size: 10px;
  color: #444;
  margin: -4px 0 6px 0;
  font-weight: 500;
}

/* Layer info block — data description, updates, animation support */
.te-layer-info {
  padding: 10px 12px 8px;
  font-size: 11px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(0, 0, 0, 0.02);
}
.te-layer-desc {
  margin-bottom: 4px;
  color: #2c2c2c;
  line-height: 1.4;
  font-weight: 500;
}
.te-layer-updates {
  font-size: 10px;
  color: #444;
  margin-bottom: 4px;
  font-weight: 500;
}
.te-layer-anim {
  font-size: 10px;
  font-weight: 600;
  padding: 4px 6px;
  border-radius: 4px;
  margin-top: 2px;
}
.te-layer-anim--yes {
  color: #1a5f1a;
  background: rgba(26, 95, 26, 0.1);
}
.te-layer-anim--no {
  color: #8b4513;
  background: rgba(139, 69, 19, 0.1);
}

/* ── Segmented control (Crop Area) ───────────────────────────── */

.te-seg {
  display: flex;
  background: rgba(0, 0, 0, 0.04);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}

.te-seg-btn {
  flex: 1;
  padding: 5px 7px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-sans);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 140ms var(--ease-out);
  white-space: nowrap;
}

.te-seg-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.5);
}

.te-seg-sub {
  background: rgba(0, 0, 0, 0.04);
}

.te-seg-btn.active {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* Draw button turns green when active + drawn */
.te-seg-btn.active.draw {
  color: var(--success);
}

.te-seg-btn svg {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
}

.te-draw-shape-row {
  /* Rectangle/Polygon picker was moved to the Work Area panel — hidden here */
  display: none !important;
}

/* Hide "Custom" area chip — not used in Work Space context */
.te-area-chips [data-area="custom"] {
  display: none !important;
}

/* ── Preset chips ────────────────────────────────────────────── */

.te-chips {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.te-chip {
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 120ms var(--ease-out);
  white-space: nowrap;
}

.te-chip:hover {
  border-color: rgba(26, 111, 212, 0.25);
  color: var(--accent);
  background: rgba(26, 111, 212, 0.08);
}

.te-chip.active {
  background: rgba(26, 111, 212, 0.18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-color: rgba(26, 111, 212, 0.35);
  color: var(--accent);
  box-shadow: none;
}

/* ── Interval chips ──────────────────────────────────────────── */

.te-int-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.te-int-chips {
  display: flex;
  gap: 3px;
  margin-bottom: 9px;
}

.te-int-chip {
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-mono);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 120ms var(--ease-out);
}

.te-int-chip:hover {
  border-color: rgba(26, 111, 212, 0.25);
  color: var(--accent);
  background: rgba(26, 111, 212, 0.08);
}

.te-int-chip.active {
  background: rgba(26, 111, 212, 0.18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-color: rgba(26, 111, 212, 0.35);
  color: var(--accent);
  box-shadow: none;
}

/* ── Custom date row ─────────────────────────────────────────── */

.te-date-row {
  display: none;
  align-items: flex-end;
  gap: 5px;
  margin-bottom: 9px;
  position: relative;
}

.te-date-row.visible {
  display: flex;
}

.te-date-field {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  position: relative;
}

.te-date-lbl {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.te-date-inp {
  padding: 6px 9px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--radius-sm);
  box-shadow: none;
  cursor: pointer;
  width: 100%;
  font-family: var(--font-sans);
  outline: none;
  user-select: none;
  transition: border-color 140ms, background 140ms;
}

.te-date-inp:hover {
  border-color: rgba(26, 111, 212, 0.3);
  background: rgba(255, 255, 255, 0.75);
}

.te-date-arrow {
  color: var(--text-muted);
  flex-shrink: 0;
  padding-bottom: 8px;
}

/* ── Frame estimate badge ────────────────────────────────────── */

.te-fest {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(26, 111, 212, 0.1);
  border: 1px solid rgba(26, 111, 212, 0.2);
  padding: 3px 9px;
  border-radius: 999px;
  display: inline-block;
  margin-bottom: 9px;
}

/* ── Fetch / Add button ──────────────────────────────────────── */

.te-fetch-btn {
  width: 100%;
  padding: 9px 14px;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-sans);
  letter-spacing: 0.01em;
  background: rgba(26, 111, 212, 0.25);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--accent);
  border: 1px solid rgba(26, 111, 212, 0.35);
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition:
    background 140ms var(--ease-out),
    border-color 140ms var(--ease-out),
    transform 140ms var(--ease-spring);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.te-fetch-btn:hover {
  background: rgba(26, 111, 212, 0.35);
  border-color: rgba(26, 111, 212, 0.5);
  transform: translateY(-1px);
}

.te-fetch-btn:active {
  transform: translateY(0);
}

/* Glass variant for "Live / Add Layer" mode */
.te-fetch-btn.live-mode {
  background: rgba(16, 185, 129, 0.22);
  border-color: rgba(16, 185, 129, 0.4);
  color: #059669;
}

.te-fetch-btn.live-mode:hover {
  background: rgba(16, 185, 129, 0.32);
  border-color: rgba(16, 185, 129, 0.55);
}

.te-fetch-btn svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

/* ── Floating glass calendar ─────────────────────────────────── */

.te-calendar {
  position: fixed;
  z-index: 9999;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(24px) saturate(1.8);
  -webkit-backdrop-filter: blur(24px) saturate(1.8);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 14px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.16),
    0 2px 8px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  padding: 12px;
  width: 222px;
  animation: te-pop-in 0.18s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes te-pop-in {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(-4px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.te-cal-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.te-cal-nav {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid #E8EAED;
  background: #fff;
  color: #8E99A8;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 120ms;
  line-height: 1;
}

.te-cal-nav:hover {
  color: #1A6FD4;
  border-color: #1A6FD4;
}

.te-cal-mo {
  font-size: 12px;
  font-weight: 700;
  color: #1C2533;
}

.te-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
}

.te-cal-dow {
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  font-weight: 600;
  color: #8E99A8;
  padding: 2px 0 3px;
  text-transform: uppercase;
}

.te-cal-d {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 500;
  color: #1C2533;
  border-radius: 6px;
  cursor: pointer;
  transition: all 100ms;
  position: relative;
  user-select: none;
}

.te-cal-d:hover {
  background: rgba(26, 111, 212, 0.08);
  color: #1A6FD4;
}

.te-cal-d.dim {
  color: #8E99A8;
  opacity: 0.4;
  pointer-events: none;
}

.te-cal-d.today {
  font-weight: 700;
  color: #1A6FD4;
}

.te-cal-d.today::after {
  content: '';
  position: absolute;
  bottom: 1px;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #1A6FD4;
}

/* Range selection states */
.te-cal-d.rs {
  background: #1A6FD4;
  color: #fff;
  border-radius: 6px 0 0 6px;
  font-weight: 700;
}

.te-cal-d.re {
  background: #1A6FD4;
  color: #fff;
  border-radius: 0 6px 6px 0;
  font-weight: 700;
}

.te-cal-d.rs.re {
  border-radius: 6px;
}

.te-cal-d.ri {
  background: #EBF3FF;
  color: #1A6FD4;
  border-radius: 0;
}

.te-cal-ft {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #E8EAED;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.te-cal-sel {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: #5A6777;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.te-cal-ok {
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  font-family: system-ui, sans-serif;
  background: #1A6FD4;
  color: #fff;
  border: none;
  cursor: pointer;
  transition: background 120ms;
}

.te-cal-ok:hover {
  background: #155cb8;
}

/* ── 2-line time display in the shared weather timeline ─────── */

.layer-mini-time {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  min-width: 0;
}

.tl-time-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  font-weight: 600;
  color: rgba(26, 111, 212, 0.65);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.tl-time-clock {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  color: #1A6FD4;
  letter-spacing: 0.04em;
  white-space: nowrap;
  line-height: 1;
}

/* ── Per-layer inline mini-timeline ──────────────────────────── */

.layer-item-wrap {
  display: flex;
  flex-direction: column;
}


.layer-mini-play {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(26, 111, 212, 0.4);
  background: #fff;
  color: #1A6FD4;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.layer-mini-play:hover {
  background: #1A6FD4;
  color: #fff;
  border-color: #1A6FD4;
}

.layer-mini-time {
  flex: 1;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  color: #1A6FD4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.layer-mini-track {
  position: relative;
  height: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
}
.layer-mini-track::before {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  height: 3px;
  background: #E0E6F0;
  border-radius: 999px;
}

.layer-mini-fill {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 3px;
  background: #1A6FD4;
  border-radius: 999px;
  pointer-events: none;
}

.layer-mini-knob {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #1A6FD4;
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
  cursor: grab;
}
.layer-mini-knob:active { cursor: grabbing; }

/* ── Shared weather-group timeline (sits above all weather layers) ─────── */

.weather-tl {
  padding: 6px 10px 8px 10px;
  background: rgba(26, 111, 212, 0.05);
  border-bottom: 1px solid rgba(26, 111, 212, 0.10);
  border-radius: 5px 5px 0 0;
}

.weather-tl-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

/* Duration preset — custom dropdown with rounded panel */
.weather-tl-duration-wrap {
  flex-shrink: 0;
  margin-left: auto;
  position: relative;
}

.weather-tl-duration-trigger {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  font-weight: 700;
  padding: 3px 8px 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(26, 111, 212, 0.25);
  background: rgba(255, 255, 255, 0.95);
  color: #1A6FD4;
  cursor: pointer;
  pointer-events: auto;
  outline: none;
  letter-spacing: 0.02em;
  line-height: 1.4;
  transition: border-color 0.14s, background 0.14s, box-shadow 0.14s;
}

.weather-tl-duration-trigger:hover {
  border-color: rgba(26, 111, 212, 0.45);
  background: #fff;
  box-shadow: 0 1px 3px rgba(26, 111, 212, 0.12);
}

.weather-tl-duration-arrow {
  flex-shrink: 0;
  opacity: 0.8;
}

.weather-tl-duration-panel {
  position: absolute;
  top: calc(100% + 3px);
  right: 0;
  min-width: 82px;
  padding: 4px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(26, 111, 212, 0.12);
  z-index: 9999;
}

.weather-tl-duration-options {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.weather-tl-duration-opt {
  display: block;
  width: 100%;
  padding: 4px 10px;
  font-size: 10px;
  font-weight: 500;
  text-align: left;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #1A6FD4;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}

.weather-tl-duration-opt:hover {
  background: rgba(26, 111, 212, 0.08);
}

.weather-tl-duration-opt.active {
  background: rgba(26, 111, 212, 0.12);
  color: #1557b0;
  font-weight: 600;
}

.weather-tl-duration-custom-inline {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid rgba(26, 111, 212, 0.1);
}

.weather-tl-duration-input {
  width: 36px;
  padding: 2px 4px;
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  border: 1px solid rgba(26, 111, 212, 0.2);
  border-radius: 4px;
  color: #1A6FD4;
  outline: none;
}

.weather-tl-duration-input:focus {
  border-color: #1A6FD4;
  box-shadow: 0 0 0 1px rgba(26, 111, 212, 0.2);
}

.weather-tl-duration-sec {
  font-size: 9px;
  color: #8E99A8;
}

.weather-tl-duration-apply {
  padding: 2px 6px;
  font-size: 9px;
  font-weight: 600;
  border: none;
  border-radius: 4px;
  background: rgba(26, 111, 212, 0.12);
  color: #1A6FD4;
  cursor: pointer;
  transition: background 0.1s;
}

.weather-tl-duration-apply:hover {
  background: rgba(26, 111, 212, 0.2);
}

/* Info button — preview area tooltip */
.weather-tl-info-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(26, 111, 212, 0.12);
  color: #1A6FD4;
  cursor: pointer;
  outline: none;
  transition: background 0.14s, color 0.14s;
}

.weather-tl-info-btn:hover {
  background: rgba(26, 111, 212, 0.22);
  color: #1557b0;
}

/* Popover — blurry glass, no layout shift (position:absolute when in flow) */
.weather-tl-info-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 260px;
  padding: 12px 12px 12px 14px;
  padding-right: 32px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(24px) saturate(1.8);
  -webkit-backdrop-filter: blur(24px) saturate(1.8);
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(26, 111, 212, 0.12);
  z-index: 99999;
  pointer-events: auto;
}

.weather-tl-info-popover-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.12s, background 0.12s;
}

.weather-tl-info-popover-close:hover {
  color: #1A6FD4;
  background: rgba(26, 111, 212, 0.08);
}

.weather-tl-info-popover-inner strong {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #1A6FD4;
  margin-bottom: 6px;
}

.weather-tl-info-popover-inner p {
  margin: 0;
  font-size: 10px;
  line-height: 1.5;
  color: #4a5568;
}

/* ── Range labels below weather timeline scrubber ────────────── */

.weather-tl-range {
  display: flex;
  justify-content: space-between;
  margin-top: 3px;
}

.weather-tl-range-lbl {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  font-weight: 500;
  color: #8E99A8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 48%;
}

/* Spinning animation for loading state on play button */
@keyframes tl-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.tl-spin {
  animation: tl-spin 0.8s linear infinite;
  transform-origin: center;
}

/* ── Scrub slider (LayerPanel) ───────────────────────────────── */

.te-scrub-wrap {
  padding: 8px 12px 10px;
  background: #f2f6ff;
  border-top: 1px solid rgba(26, 111, 212, 0.08);
}

/* Large current-time display at top of scrubber */
.te-now-display {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.te-now-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 600;
  color: #1A6FD4;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.te-now-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #fff;
  background: #1A6FD4;
  border-radius: 4px;
  padding: 1px 5px;
  white-space: nowrap;
}

/* Play / Pause button */
.te-play-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(26, 111, 212, 0.35);
  background: #fff;
  color: #1A6FD4;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.te-play-btn:hover {
  background: #1A6FD4;
  border-color: #1A6FD4;
  color: #fff;
}

.te-scrub-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.te-scrub-t {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  white-space: nowrap;
  color: #8E99A8;
}

/* (legacy — kept for back-compat) */
.te-scrub-now {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  white-space: nowrap;
  color: #1A6FD4;
  font-weight: 500;
}

.te-scrub-track-wrap {
  position: relative;
  height: 14px;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.te-scrub-track {
  position: absolute;
  inset: 0;
  margin: auto;
  height: 3px;
  border-radius: 999px;
  background: #E8EAED;
}

.te-scrub-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  border-radius: 999px;
  background: #1A6FD4;
  pointer-events: none;
}

.te-scrub-knob {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #1A6FD4;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(26, 111, 212, 0.35);
  cursor: ew-resize;
  z-index: 1;
}

/* MapsGL tile loading indicator */
.te-scrub-loading-badge {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 9px;
  font-family: 'JetBrains Mono', monospace;
  color: #1A6FD4;
  opacity: 0.9;
  pointer-events: none;
  animation: te-loading-pulse 1s ease-in-out infinite;
}

.te-scrub-loading .te-scrub-track {
  opacity: 0.85;
}

@keyframes te-loading-pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

.te-update-now {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: 5px;
  gap: 3px;
  font-size: 10px;
  color: #8E99A8;
  cursor: pointer;
  transition: color 120ms;
  user-select: none;
}

.te-update-now:hover {
  color: #1A6FD4;
}

.te-update-now svg {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
}

/* ── Frame count badge (in layer item icons area) ────────────── */

.te-frame-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 999px;
  background: #ECFDF5;
  color: #10B981;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Sub-label "dated" style (after fetch) ───────────────────── */

.te-sub-dated {
  color: #1A6FD4 !important;
}

/* ══════════════════════════════════════════════════════════════
   Work Space modal  (.ws-*)
   Centered, glass effect, fixed-size — no layout shifts
   ══════════════════════════════════════════════════════════════ */

/* Overlay */
.ws-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.ws-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 37, 51, 0.35);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

/* Dialog — fixed width, auto height (content drives it, not search results) */
.ws-dialog {
  position: relative;
  width: 400px;
  max-width: calc(100vw - 40px);
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(24px) saturate(1.8);
  -webkit-backdrop-filter: blur(24px) saturate(1.8);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--panel-radius);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  animation: ws-pop-in 0.2s cubic-bezier(0.34, 1.4, 0.64, 1) both;
  overflow: hidden;
}

@keyframes ws-pop-in {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}

/* Header */
.ws-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.ws-header-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ws-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}

.ws-subtitle {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.ws-close {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border: none;
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.ws-close svg { width: 10px; height: 10px; }

.ws-close:hover {
  background: var(--accent-hover);
  color: var(--accent);
}

/* Mode tabs */
.ws-tabs {
  display: flex;
  gap: 3px;
  padding: 10px 14px 8px;
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.02);
}

.ws-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 5px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.6);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
  font-family: var(--font-sans);
  white-space: nowrap;
}

.ws-tab svg { width: 12px; height: 12px; flex-shrink: 0; }

.ws-tab:hover {
  background: var(--accent-hover);
  color: var(--accent);
  border-color: rgba(26, 111, 212, 0.25);
}

.ws-tab.active {
  background: rgba(26, 111, 212, 0.2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--accent);
  border-color: rgba(26, 111, 212, 0.4);
  box-shadow: none;
}

/* Mode body — FIXED HEIGHT so switching tabs never changes panel size */
.ws-mode-body {
  padding: 10px 14px 6px;
  flex-shrink: 0;
  height: 160px;         /* fits search-input + ~3-4 results OR draw hint + button */
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Search mode — fills the fixed-height body */
.ws-search-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 100%;
}

.ws-search-box {
  position: relative;
  flex-shrink: 0;
}

.ws-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 13px;
  height: 13px;
  color: var(--text-secondary);
  pointer-events: none;
}

.ws-search-input {
  width: 100%;
  padding: 9px 10px 9px 32px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 12px;
  font-family: var(--font-sans);
  background: rgba(255, 255, 255, 0.8);
  color: var(--text-primary);
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.ws-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-hover);
}

.ws-search-input::placeholder { color: var(--text-muted); }

/* Results area — takes remaining height, scrolls internally. Fixed = no panel growth.
   Always rendered (even empty) so the panel never changes size when results arrive. */
.ws-results {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.12) transparent;
  /* Subtle placeholder background so the reserved space is visually clear */
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.015);
}

.ws-results::-webkit-scrollbar { width: 4px; }
.ws-results::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 4px; }

.ws-result {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: left;
  font-family: var(--font-sans);
  transition: background 0.12s, color 0.12s;
  width: 100%;
  flex-shrink: 0;
}

.ws-result svg { width: 10px; height: 14px; flex-shrink: 0; color: var(--text-secondary); }
.ws-result span { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ws-result:hover {
  background: var(--accent-hover);
  color: var(--accent);
}

.ws-result-poly-badge {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
  letter-spacing: 0.02em;
}

/* Draw modes — also fills the fixed-height body */
.ws-draw-wrap {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 10px;
  height: 100%;
}

.ws-draw-hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

.ws-draw-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background 0.14s, box-shadow 0.14s;
  box-shadow: 0 2px 8px rgba(26, 111, 212, 0.25);
}

.ws-draw-btn svg { width: 13px; height: 13px; }

.ws-draw-btn:hover {
  background: #155cb8;
  box-shadow: 0 4px 14px rgba(26, 111, 212, 0.35);
}
.ws-draw-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Floating draw-mode bar (modal minimised state) ─────────── */
.ws-draw-bar {
  display: none;
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10010;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 30px;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  white-space: nowrap;
  pointer-events: all;
  animation: ws-bar-in 0.22s cubic-bezier(0.16,1,0.3,1) both;
}

@keyframes ws-bar-in {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.ws-draw-bar-cancel {
  border: 1px solid rgba(255,255,255,0.25);
  background: transparent;
  color: rgba(255,255,255,0.8);
  border-radius: 12px;
  padding: 3px 10px;
  font-size: 11px;
  cursor: pointer;
  transition: background 0.15s;
}
.ws-draw-bar-cancel:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

/* Capture panel — slides in with max-height transition, no layout flash */
.ws-capture {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 14px;
  border-top: 0px solid var(--border);
  background: rgba(16, 185, 129, 0.04);
  flex-shrink: 0;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              opacity    0.22s ease,
              padding    0.28s ease,
              border-top-width 0.28s ease;
}

.ws-capture.visible {
  max-height: 180px;
  opacity: 1;
  padding: 10px 14px 8px;
  border-top-width: 1px;
}

.ws-capture-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.ws-capture-icon { width: 15px; height: 15px; flex-shrink: 0; }

.ws-capture-label {
  font-size: 11px;
  font-weight: 600;
  color: #059669;
}

.ws-name-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 12px;
  font-family: var(--font-sans);
  background: rgba(255, 255, 255, 0.8);
  color: var(--text-primary);
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.ws-name-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-hover);
}

.ws-name-input.ws-input-error { border-color: var(--danger); }
.ws-name-input::placeholder { color: var(--text-muted); }

/* Save row */
.ws-save-row {
  display: flex;
  gap: 8px;
}

.ws-btn-save {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--success);
  color: #fff;
  border: none;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background 0.14s;
}

.ws-btn-save svg { width: 11px; height: 11px; }
.ws-btn-save:hover { background: #059669; }

.ws-btn-discard {
  padding: 7px 12px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 12px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background 0.14s, color 0.14s;
}

.ws-btn-discard:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-secondary);
}

/* Divider */
.ws-divider {
  height: 1px;
  background: var(--border);
  flex-shrink: 0;
  margin: 0;
}

/* Saved profiles section */
.ws-profiles-section {
  padding: 10px 14px 14px;
  overflow-y: auto;
  max-height: 200px;
  min-height: 60px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.1) transparent;
}

.ws-profiles-section::-webkit-scrollbar { width: 4px; }
.ws-profiles-section::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 4px; }

.ws-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.ws-profiles-hint {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin: 0 0 8px 0;
  padding: 0;
}

.ws-empty {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 10px 0;
  line-height: 1.5;
}

.ws-profile-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ws-profile-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 9px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border);
  border-radius: 9px;
  transition: background 0.13s;
}

.ws-profile-item:hover { background: #fff; }

/* Brief highlight when profile is just saved — shows user where it went */
.ws-profile-item--saved {
  background: rgba(16, 185, 129, 0.15) !important;
  border-color: rgba(5, 150, 105, 0.4) !important;
  animation: ws-profile-saved 1.8s ease-out forwards;
}
@keyframes ws-profile-saved {
  0% { box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.4); }
  60% { box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2); }
  100% { box-shadow: none; }
}

.ws-profile-info {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1;
  overflow: hidden;
}

.ws-profile-name {
  font-size: 12px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws-mask-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  text-transform: capitalize;
}

.ws-mask-land  { background: rgba(16, 185, 129, 0.12); color: #059669; }
.ws-mask-water { background: rgba(26, 111, 212, 0.10); color: #1A6FD4; }

.ws-profile-delete {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.14s, color 0.14s;
}

.ws-profile-delete svg { width: 9px; height: 9px; }

.ws-profile-delete:hover {
  background: var(--danger-light);
  color: var(--danger);
}

/* Chip badge in accordion */
.te-chip-badge {
  font-size: 10px;
  font-weight: var(--weight-medium);
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(59, 130, 246, 0.12);
  color: #1d4ed8;
  margin-left: 4px;
  text-transform: capitalize;
}