body { background: #f8fafc; }
/* This page's own <main> shouldn't be capped/centered like the rest of the
   site (main { max-width: 1100px; margin: 0 auto; } in styles.css) — the
   planner wants the full viewport width. Also loaded on /time-zone-meeting-planner,
   which uses this same single <main> for both the desktop and mobile
   shells (toggled via multi-city-planner-v3.css), so this applies there
   too regardless of which shell is currently visible. */
main {
  max-width: none;
  padding: 0px 0;
}
.planner-page {
  width: 100%;
  margin: 40px 0 80px;
  padding: 0 24px;
  box-sizing: border-box;
}
.planner-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 28px 28px 24px;
}
.planner-page-title { font-size: 1.3rem; font-weight: 600; color: var(--foreground); margin: 0 0 4px; }
.planner-page-subtitle { font-size: 0.9rem; color: var(--muted-foreground); margin: 0 0 20px; }
.planner-inline-icon { vertical-align: -2px; }

.planner-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin: 16px 4px 0;
  font-size: 0.78rem;
  color: var(--muted-foreground);
}
.planner-legend-item { display: flex; align-items: center; gap: 6px; }
.planner-legend-swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; border: 1px solid var(--border); }
.planner-legend-swatch.tier-night { background: #e2e8f0; }
.planner-legend-swatch.tier-morning { background: #f8fafc; }
.planner-legend-swatch.tier-business { background: #e3ffe5; border-color: #bfe8c4; }
.planner-legend-swatch.tier-evening { background: #ffedd5; border-color: #fed7aa; }
.planner-legend-swatch.selected { background: var(--accent); box-shadow: inset 0 0 0 2px var(--foreground); }
.planner-legend-swatch.hovered { background: #fff; box-shadow: inset 0 0 0 2px var(--foreground); }

.planner-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin: 4px 0 18px;
}

.planner-format-toggle {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}
.planner-format-btn {
  border: 0;
  background: #fff;
  color: var(--muted-foreground);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 8px 12px;
  cursor: pointer;
  white-space: nowrap;
}
.planner-format-btn + .planner-format-btn { border-left: 1px solid var(--border); }
.planner-format-btn.is-active { background: var(--foreground); color: #fff; }

.planner-search { position: relative; flex: 1 1 260px; max-width: 320px; }
.planner-search input {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--foreground);
  background: #fff;
}
.planner-search input:focus { outline: none; border-color: var(--foreground); }
.planner-search-results {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  max-height: 260px;
  overflow-y: auto;
  z-index: 20;
}
.planner-search-results.is-open { display: block; }
.planner-search-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: none;
  text-align: left;
  cursor: pointer;
}
.planner-search-item:last-child { border-bottom: none; }
.planner-search-item:hover { background: var(--accent); }
.planner-search-item-label { font-size: 0.85rem; font-weight: 600; color: var(--foreground); }
.planner-search-item-sub { font-size: 0.72rem; color: var(--muted-foreground); }
.planner-search-empty { padding: 10px 12px; font-size: 0.8rem; color: var(--muted-foreground); }

.planner-date-tabs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.planner-date-nav {
  width: 26px; height: 26px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  color: var(--muted-foreground);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}
.planner-date-nav:hover { border-color: var(--foreground); color: var(--foreground); }
.planner-date-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 4px 9px;
  border: 1px solid transparent;
  background: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.65rem;
  color: var(--muted-foreground);
  text-transform: uppercase;
}
.planner-date-tab strong { font-size: 0.85rem; color: var(--foreground); font-weight: 600; }
.planner-date-tab.is-today strong { color: #b91c1c; }
.planner-date-tab.is-active { border-color: var(--foreground); background: var(--accent); }
.planner-date-tab:hover { background: var(--accent); }

.planner-rows-wrap { position: relative; }
.planner-rows { display: flex; flex-direction: column; gap: 6px; }

.planner-hover-beam {
  display: grid;
  position: absolute;
  inset: 0;
  padding: 0 6px;
  grid-template-columns: 270px 104px 1fr;
  column-gap: 18px;
  pointer-events: none;
  z-index: 5;
}
.planner-hover-beam-track {
  grid-column: 3;
  position: relative;
  height: 100%;
}
.planner-hover-beam-bar {
  position: absolute;
  top: 0;
  bottom: 0;
  border: 2px dashed var(--foreground);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.05);
  transition: left 0.12s ease-out, width 0.12s ease-out;
}
.planner-hover-beam.has-selection .planner-hover-beam-bar {
  border-style: solid;
  background: rgba(15, 23, 42, 0.08);
  pointer-events: auto;
  cursor: grab;
}
.planner-hover-beam.has-selection .planner-hover-beam-bar:active { cursor: grabbing; }
.planner-beam-handle {
  display: none;
  position: absolute;
  top: 50%;
  width: 18px;
  height: 18px;
  margin-top: -9px;
  border-radius: 999px;
  background: var(--foreground);
  border: 3px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  cursor: ew-resize;
  pointer-events: auto;
}
.planner-hover-beam.has-selection .planner-beam-handle { display: block; }
.planner-beam-handle-start { left: -9px; }
.planner-beam-handle-end { right: -9px; }

/* A dimension-line style "11h 30m" readout above the selection — a child
   of the beam bar itself, so it automatically rides along with the bar's
   own left/width instead of needing separate positioning math. Only shown
   once there's a locked-in selection, not for the plain hover ghost. */
.planner-beam-duration {
  display: none;
  position: absolute;
  top: -17px;
  left: 0;
  right: 0;
  align-items: center;
  gap: 6px;
  padding: 0 2px;
}
.planner-hover-beam.has-selection .planner-beam-duration { display: flex; }
.planner-beam-duration-line {
  flex: 1 1 auto;
  height: 1px;
  background: var(--muted-foreground);
  opacity: 0.6;
  position: relative;
}
.planner-beam-duration-line:first-child::before,
.planner-beam-duration-line:last-child::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 0;
  height: 0;
  transform: translateY(-50%);
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
}
.planner-beam-duration-line:first-child::before { left: 0; border-right: 4px solid var(--muted-foreground); opacity: 0.6; }
.planner-beam-duration-line:last-child::after { right: 0; border-left: 4px solid var(--muted-foreground); opacity: 0.6; }
.planner-beam-duration-text {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted-foreground);
  white-space: nowrap;
}

.planner-row {
  display: grid;
  grid-template-columns: 270px 104px 1fr;
  align-items: center;
  gap: 18px;
  padding: 14px 6px;
  border-bottom: 1px solid var(--border);
  cursor: default;
  transition: opacity 0.15s, background-color 0.15s;
  border-radius: 8px;
}
.planner-row:last-child { border-bottom: none; }
.planner-row {
  transition: height 0.15s ease, opacity 0.12s ease, padding 0.15s ease, margin 0.15s ease;
}
/* Actually collapsed, not just faded — the rest of the list closes the
   gap immediately, like the row was really lifted out and is now only the
   ghost pill following the cursor, instead of a see-through placeholder
   still holding its spot in the list. */
.planner-row.is-dragging {
  height: 0;
  min-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin: 0;
  opacity: 0;
  overflow: hidden;
  border-bottom: none;
  pointer-events: none;
}
/* An actual gap opening up in the list at the drop position — a real DOM
   node inserted between rows, not a border/tint on the row being hovered
   — animated from 0 height so the surrounding rows visibly slide apart to
   make room, the way the row itself will land there. */
.planner-drag-placeholder {
  height: 0;
  border-radius: 8px;
  overflow: hidden;
  transition: height 0.12s ease-out;
}
.planner-drag-placeholder.is-active { height: 68px; }

/* Follows the cursor via JS (left/top on mousemove) instead of the
   browser's static native drag-image snapshot — it's a live clone of the
   row's own head (pin/offset badge, name, tz pill, meta), so what's
   visibly "picked up" reads as the actual row, not just a text label. */
.planner-drag-card {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  width: 280px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
  pointer-events: none;
  transform: rotate(-1.5deg);
}
.planner-drag-card .planner-row-head { gap: 8px; }
.planner-drag-card .planner-row-remove,
.planner-drag-card .planner-order-btns,
.planner-drag-card .planner-drag { display: none; }

.planner-row-head { display: flex; align-items: center; gap: 10px; min-width: 0; }

.planner-order-btns { display: flex; flex-direction: column; gap: 1px; flex: 0 0 auto; }
.planner-order-btn {
  width: 15px; height: 12px;
  border: none;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 7px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.planner-order-btn:hover:not(:disabled) { color: var(--foreground); }
.planner-order-btn:disabled { opacity: 0.25; cursor: default; }

.planner-drag {
  flex: 0 0 auto;
  width: 16px;
  height: 30px;
  border: none;
  background: transparent;
  color: var(--muted-foreground);
  cursor: grab;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.planner-anchor {
  flex: 0 0 auto;
  min-width: 42px;
  height: 34px;
  padding: 0 6px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted-foreground);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.planner-anchor:hover { border-color: var(--foreground); color: var(--foreground); }
.planner-anchor.is-home { background: var(--foreground); border-color: var(--foreground); color: #fff; font-size: 16px; }

.planner-row-info { min-width: 0; flex: 1 1 auto; }
.planner-row-name-line { display: flex; align-items: center; gap: 6px; }
.planner-row-name { font-weight: 700; font-size: 1.05rem; color: var(--foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.planner-row-tz-pill {
  flex: 0 0 auto;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--muted-foreground);
  border: 1px solid var(--border);
}
.planner-row-meta { font-size: 0.8rem; color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.planner-row-utc { font-size: 0.68rem; color: var(--muted-foreground); opacity: 0.8; white-space: nowrap; }
.planner-row-remove {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted-foreground);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}
.planner-row-remove:hover:not(:disabled) { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.planner-row-remove:disabled { opacity: 0.3; cursor: default; }

.planner-row-now { text-align: right; max-width: 128px; }
.planner-row-now-time { font-size: 1.2rem; font-weight: 700; color: var(--foreground); font-variant-numeric: tabular-nums; white-space: nowrap; }
.planner-row-now-time.is-range { font-size: 0.92rem; }
.planner-row-now-day { font-size: 0.76rem; color: var(--muted-foreground); text-transform: capitalize; }

.planner-track-weekdays {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  margin-bottom: 4px;
}
.planner-track-weekday-cell {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted-foreground);
  letter-spacing: 0.04em;
  text-align: left;
  padding-left: 1px;
}
.planner-track-weekday-cell.is-dimmed { opacity: 0.5; }

.planner-track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  height: 54px;
}
.planner-seg {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  background: #f8fafc;
  border: 1px solid var(--border);
  margin-left: -1px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--muted-foreground);
  padding: 0;
}
.planner-seg:first-child { margin-left: 0; border-radius: 8px 0 0 8px; }
.planner-seg:last-child { border-radius: 0 8px 8px 0; }
.planner-seg.tier-night { background: #e2e8f0; color: #64748b; }
.planner-seg.tier-business { background: #e3ffe5; color: #4f8a58; }
.planner-seg.tier-evening { background: #ffedd5; color: #b4682a; }
.planner-seg.is-day-boundary {
  background: #334155;
  color: #fff;
  border: 2px solid #64748b;
  border-radius: 16px 0 0 16px;
  margin-left: 3px;
  z-index: 2;
}
.planner-seg.is-day-end { border-radius: 0 16px 16px 0; }
.planner-seg.is-now::after {
  content: '';
  position: absolute;
  top: -7px;
  left: var(--now-pos, 50%);
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 7px solid #dc2626;
  z-index: 4;
}
.planner-seg-suffix {
  font-size: 0.75em;
  font-weight: 600;
  line-height: 1;
  color: inherit;
  opacity: 0.75;
  text-transform: lowercase;
}
.planner-seg.is-hover { filter: brightness(0.97); }
.planner-seg.is-dimmed { opacity: 0.5; }
.planner-seg-datebreak-month {
  font-size: 8.5px;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.85;
}
.planner-seg-datebreak-day {
  font-size: 15px;
  line-height: 1;
  font-weight: 700;
}

.planner-selection-popover {
  display: none;
  position: relative;
  margin-top: 14px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  /* Aligned to the same column the hour track occupies in .planner-row
     (270px head + 18px gap + 104px now + 18px gap + 6px row padding = 416px)
     instead of spanning the whole card, so the popover reads as belonging
     to the track/beam above it, not the row-head/now columns it isn't
     related to. */
  margin-left: 416px;
  max-width: calc(100% - 416px);
  box-sizing: border-box;
}
.planner-selection-popover.is-visible { display: block; }
/* A real element instead of a ::before with a fixed `left` — its position
   is set from JS to track the selected beam's horizontal center, so the
   arrow always points back up at the selection instead of sitting at a
   constant spot near the left edge regardless of where the beam is. */
.planner-selection-popover-arrow {
  position: absolute;
  top: -8px;
  left: 32px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
  transform: rotate(45deg);
  transition: left 0.12s ease-out;
}
.planner-selection-popover-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--foreground);
  margin: 0 0 12px;
}
.planner-selection-popover-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
}
.planner-selection-popover-btn {
  flex: 1 1 0;
  min-width: 0;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--foreground);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.planner-selection-popover-btn svg { flex-shrink: 0; }
.planner-selection-popover-btn:hover { border-color: var(--foreground); }
.planner-selection-popover-btn.is-primary { background: var(--foreground); border-color: var(--foreground); color: #fff; }
.planner-selection-popover-btn.is-primary:hover { filter: brightness(1.15); }

@media (max-width: 780px) {
  .planner-row { grid-template-columns: 1fr; }
  .planner-row-now { text-align: left; }
  .planner-header { flex-direction: column; }
  .planner-selection-popover { margin-left: 0; max-width: 100%; }
}

