/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 24px 26px;
}
.card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.card__title {
  font-size: 19px;
  font-weight: 700;
}
.card__subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}
.card__head + .card__subtitle,
.card__title + .card__subtitle {
  margin-bottom: 18px;
}

/* ── KPI card ────────────────────────────────────────────────────────────── */
.kpi {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px 22px;
}
.kpi__label {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 600;
}
.kpi__value {
  font-size: 38px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
}
.kpi__foot {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.kpi__note {
  color: var(--text-faint);
}

.chip-delta {
  border-radius: var(--radius-pill);
  padding: 3px 9px;
  font-weight: 700;
  direction: ltr;
  background: var(--chip-neutral);
  color: var(--legend);
}
.chip-delta--good {
  background: rgba(62, 207, 142, 0.15);
  color: var(--positive);
}
.chip-delta--bad {
  background: rgba(255, 77, 90, 0.15);
  color: #ff7a84;
}

/* ── Segmented control (date presets) ────────────────────────────────────── */
.segmented {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 4px;
}
.segmented__btn {
  min-height: var(--touch-target);
  border: 0;
  background: transparent;
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  transition: background 0.15s, color 0.15s;
}
.segmented__btn:hover {
  color: var(--text);
}
.segmented__btn[aria-pressed='true'] {
  background: var(--selected);
  color: #fff;
  font-weight: 700;
}
.segmented__btn--custom {
  border-inline-start: 1px solid var(--border-strong);
  border-radius: 0 8px 8px 0;
}

/* ── Popover (custom date range) ─────────────────────────────────────────── */
.popover-anchor {
  position: relative;
}
.popover {
  position: absolute;
  inset-block-start: calc(100% + 8px);
  inset-inline-end: 0;
  z-index: 20;
  width: 340px;
  max-width: calc(100vw - 32px);
  background: var(--surface-alt);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}
.popover[hidden] {
  display: none;
}

/* ── Form controls ───────────────────────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field__label {
  font-size: 13px;
  color: var(--label);
}
.input {
  width: 100%;
  min-height: var(--touch-target);
  background: var(--surface-alt);
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
}
.input::placeholder {
  color: var(--text-faint);
}

.btn {
  min-height: var(--touch-target);
  border: 0;
  border-radius: var(--radius-control);
  padding: 8px 16px;
  font-weight: 700;
  font-size: 14px;
  background: var(--accent);
  color: #fff;
}
.btn--ghost {
  background: var(--surface-alt);
  border: 1px solid var(--border-strong);
  color: var(--text);
}

.popover__actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ── Filter chips (sidebar) ──────────────────────────────────────────────── */
.filter-group__hint {
  font-size: 12px;
  color: var(--text-faint);
}
.filters {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.filters__heading {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}
.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.filter-group__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.toggle-all {
  min-height: 44px;
  margin-block: -14px; /* keeps the 44px touch target without stretching the row */
  padding: 0 4px;
  background: none;
  border: none;
  color: var(--accent);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.filter-group__actions {
  display: flex;
  gap: 8px;
}
.toggle-all:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  text-decoration: none;
}
.toggle-all:hover {
  text-decoration: underline;
}
.toggle-all:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.filter-group__label {
  font-size: 13px;
  color: var(--label);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  background: var(--surface-alt);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  padding: 5px 11px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
button.chip {
  transition: opacity 0.15s, background 0.15s;
}
button.chip[aria-pressed='false'] {
  background: transparent;
  border-style: dashed;
  color: var(--text-faint);
}
button.chip[aria-pressed='false'] .chip__dot {
  opacity: 0.4;
}
.chip__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}
.chip--zone {
  border-color: var(--accent);
}
.chip__remove {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  padding: 0;
  line-height: 1;
  font-size: 15px;
}

/* ── Combobox (alert area multi-select) ─────────────────────────────────── */
.combobox {
  position: relative;
}
.combobox__input {
  padding-inline-end: 40px;
}
.combobox__toggle {
  position: absolute;
  inset-inline-end: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  border-radius: 8px;
}
.combobox__input[aria-expanded='true'] + .combobox__toggle svg {
  transform: rotate(180deg);
}
.combobox__panel {
  position: absolute;
  inset-inline: 0;
  inset-block-start: calc(100% + 4px);
  z-index: 20;
  background: var(--surface-alt);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.combobox__list {
  margin: 0;
  padding: 4px;
  list-style: none;
  max-height: 260px;
  overflow-y: auto;
}
.combobox__option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 7px;
  font-size: 14px;
  cursor: pointer;
}
.combobox__option:hover,
.combobox__option[data-active='true'] {
  background: var(--selected);
}
.combobox__check {
  width: 16px;
  height: 16px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--border-strong);
  border-radius: 4px;
  color: #fff;
}
.combobox__check svg {
  stroke-width: 3;
  opacity: 0;
}
.combobox__option[aria-selected='true'] .combobox__check {
  background: var(--accent);
  border-color: var(--accent);
}
.combobox__option[aria-selected='true'] .combobox__check svg {
  opacity: 1;
}
.combobox__empty {
  padding: 9px 10px;
  font-size: 13px;
  color: var(--text-faint);
}
.combobox__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--divider);
  font-size: 12px;
  color: var(--text-muted);
}
.link-btn {
  border: 0;
  background: transparent;
  padding: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--info);
}

/* ── Legend ──────────────────────────────────────────────────────────────── */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}
.legend__item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--legend);
}
.swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex: none;
}

/* ── Stacked bar chart (hours, days or weeks) ──────────────────────────────────────────── */
.bars {
  display: flex;
  gap: 10px;
  direction: ltr;
}
.bars__axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: var(--chart-height, 240px);
  font-size: 11px;
  color: var(--text-faint);
  text-align: right;
}
.bars__plot {
  flex: 1;
  min-width: 0;
  height: var(--chart-height, 240px);
  display: flex;
  align-items: flex-end;
  gap: 3px;
  border-bottom: 1px solid var(--border-strong);
  background: repeating-linear-gradient(
    to top,
    transparent 0,
    transparent calc(var(--chart-height, 240px) / 3 - 1px),
    var(--track) calc(var(--chart-height, 240px) / 3 - 1px),
    var(--track) calc(var(--chart-height, 240px) / 3)
  );
}
.bars__col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column-reverse;
  border-radius: 3px 3px 0 0;
  overflow: hidden;
}
.bars__ticks {
  display: flex;
  justify-content: space-between;
  direction: ltr;
  margin-top: 8px;
  padding-left: 34px;
  font-size: 11px;
  color: var(--text-faint);
}

.bars__unit {
  margin-top: 6px;
  text-align: center;
  font-size: 11px;
  color: var(--text-faint);
}

/* ── Donut + rows ────────────────────────────────────────────────────────── */
.donut-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px;
}
.donut {
  position: relative;
  width: 150px;
  height: 150px;
  flex: none;
  border-radius: 50%;
}
.donut__hole {
  position: absolute;
  inset: 24px;
  border-radius: 50%;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.donut__total {
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
}
.donut__caption {
  font-size: 12px;
  color: var(--text-muted);
}
.split-rows {
  flex: 1;
  min-width: 150px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.split-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}
.split-row__name {
  flex: 1;
  font-weight: 600;
}
.split-row__count {
  color: var(--text-muted);
  direction: ltr;
}
.split-row__pct {
  width: 44px;
  text-align: left;
  font-weight: 700;
  direction: ltr;
}

/* ── Heatmap ─────────────────────────────────────────────────────────────── */
.heatmap {
  display: flex;
  gap: 8px;
}
.heatmap__days {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-faint);
}
.heatmap__days span {
  height: var(--cell-h, 22px);
  line-height: var(--cell-h, 22px);
}
.heatmap__body {
  flex: 1;
  min-width: 0;
  direction: ltr;
}
.heatmap__grid {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  gap: 2px;
}
.heatmap__cell {
  height: var(--cell-h, 22px);
  border-radius: 4px;
}
.heatmap__hours {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-faint);
}
.heatmap__totals {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 0 0 64px;
  direction: ltr;
}
.heatmap__day-total {
  position: relative;
  display: flex;
  align-items: center;
  height: var(--cell-h, 22px);
  font-size: 11px;
  color: var(--text-faint);
}
.heatmap__day-total i,
.heatmap__hour-total i {
  position: absolute;
  background: var(--track);
  border-radius: 3px;
}
.heatmap__day-total i {
  inset-block: 4px;
  inset-inline-start: 0;
  width: var(--share);
}
.heatmap__day-total b {
  position: relative;
  font-weight: 500;
  padding-inline-start: 4px;
}
.heatmap__hour-totals {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  gap: 2px;
  height: 36px;
  margin-top: 8px;
}
.heatmap__hour-total {
  position: relative;
}
.heatmap__hour-total i {
  inset-inline: 0;
  bottom: 0;
  height: var(--share);
}

/* ── Ranked list (top areas) ─────────────────────────────────────────────── */
.rank-list {
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.rank {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}
.rank__pos {
  width: 22px;
  color: var(--text-faint);
  font-weight: 700;
  direction: ltr;
  text-align: left;
}
.rank__name {
  width: 130px;
  flex: none;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rank__track {
  flex: 1;
  height: 8px;
  background: var(--track);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.rank__fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--accent);
}
.rank__count {
  width: 40px;
  text-align: left;
  font-weight: 700;
  direction: ltr;
}

/* ── States ──────────────────────────────────────────────────────────────── */
.state {
  text-align: center;
  padding: 48px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.state__title {
  font-size: 19px;
  font-weight: 700;
}
.state__text {
  color: var(--text-muted);
  max-width: 420px;
}

/* ── Origin cards ────────────────────────────────────────────────────────── */
.origin-card {
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.origin-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.origin-card__name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
}
.origin-card__dot {
  width: 12px;
  height: 12px;
  border-radius: 4px;
}
.origin-card__events {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.origin-card__count {
  font-size: 44px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
}
.origin-card__unit {
  font-size: 14px;
  color: var(--text-muted);
}
.origin-card__rule {
  height: 1px;
  margin: 0;
  border: 0;
  background: var(--border);
}
.meta-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  font-size: 14px;
}
.meta-list dt {
  color: var(--text-muted);
}
.meta-list dd {
  font-weight: 700;
  text-align: left;
}

/* ── Share bar ───────────────────────────────────────────────────────────── */
.share-bar {
  display: flex;
  gap: 3px;
  height: 18px;
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.share-bar > div {
  min-width: 6px;
}

/* ── Monthly bars ────────────────────────────────────────────────────────── */
.month-bars {
  flex: 1;
  min-width: 0;
  height: var(--chart-height, 228px);
  display: flex;
  align-items: flex-end;
  gap: 14px;
  border-bottom: 1px solid var(--border-strong);
  background: repeating-linear-gradient(
    to top,
    transparent 0,
    transparent calc(var(--chart-height, 228px) / 3 - 1px),
    var(--track) calc(var(--chart-height, 228px) / 3 - 1px),
    var(--track) calc(var(--chart-height, 228px) / 3)
  );
}
.month-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}
.month-col__total {
  font-size: 12px;
  font-weight: 700;
  color: var(--legend);
  margin-bottom: 4px;
}
.month-col__stack {
  width: 100%;
  max-width: 64px;
  display: flex;
  flex-direction: column-reverse;
  border-radius: 5px 5px 0 0;
  overflow: hidden;
}
.month-bars--compact {
  gap: 6px;
}
.month-bars--dense {
  gap: 2px;
}
.month-labels {
  display: flex;
  gap: 14px;
  direction: ltr;
  margin: 8px 0 0;
}
.month-labels--axis {
  margin-left: 34px;
}
.month-labels--compact {
  gap: 6px;
}
.month-labels--dense {
  gap: 2px;
}
.month-label {
  flex: 1;
  min-width: 0;
  position: relative;
  height: 16px;
}
.month-label__text {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 12px;
  color: var(--text-faint);
}

/* ── Data table ──────────────────────────────────────────────────────────── */
.table-card {
  overflow-x: auto;
}
.data-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table th,
.data-table td {
  padding: 13px 12px;
  text-align: right;
  border-bottom: 1px solid var(--track);
}
.data-table thead th {
  padding: 10px 12px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-strong);
}
.data-table tbody th {
  font-weight: 700;
}
.data-table__origin {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.kpi__value--long {
  font-size: 28px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

/* ── Toolbar, search, pager ──────────────────────────────────────────────── */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.toolbar__group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.toolbar__label {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 600;
}
.search {
  position: relative;
  flex: 0 1 320px;
  min-width: 220px;
}
.search__icon {
  position: absolute;
  inset-inline-start: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  color: var(--text-faint);
  pointer-events: none;
}
.search__input {
  background: var(--surface);
  border-color: var(--border);
  border-radius: 11px;
  padding-inline: 42px;
}
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}
.pager__info {
  font-size: 13px;
  color: var(--text-muted);
}
.pager__buttons {
  display: flex;
  gap: 6px;
}
.pager__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--touch-target);
  height: var(--touch-target);
  border: 1px solid var(--border-strong);
  background: var(--surface-alt);
  color: var(--text);
  border-radius: var(--radius-control);
  font-size: 16px;
}
.pager__btn:disabled {
  color: var(--text-faint);
  cursor: not-allowed;
}

.data-table--compact {
  min-width: 400px;
}
.data-table--compact th,
.data-table--compact td {
  padding: 13px 8px;
}
.data-table--compact thead th {
  padding: 10px 8px;
}
.data-table__empty {
  text-align: center !important;
  color: var(--text-muted);
}
.muted {
  color: var(--text-muted);
}
.footnote {
  font-size: 13px;
  color: var(--text-faint);
}

/* ── Daily bars + heatmap legend (timeline) ──────────────────────────────── */
.daybars {
  flex: 1;
  min-width: 0;
  height: var(--chart-height, 220px);
  display: flex;
  align-items: flex-end;
  gap: 2px;
  border-bottom: 1px solid var(--border-strong);
  background: repeating-linear-gradient(
    to top,
    transparent 0,
    transparent calc(var(--chart-height, 220px) / 3 - 1px),
    var(--track) calc(var(--chart-height, 220px) / 3 - 1px),
    var(--track) calc(var(--chart-height, 220px) / 3)
  );
}
.daybars--dense {
  gap: 1px;
}
.daybars__bar {
  flex: 1;
  min-width: 0;
  border-radius: 2px 2px 0 0;
  background: var(--accent-soft);
}
.daybars__bar--peak {
  background: var(--accent);
}
.heatmap__legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
  font-size: 12px;
  color: var(--text-muted);
  direction: ltr;
}
.heatmap__scale {
  width: 140px;
  height: 8px;
  border-radius: var(--radius-pill);
  background: linear-gradient(to right, var(--track), var(--accent));
}

/* Fewer pixels per bar on long ranges: shrink the gaps so bars never collapse to nothing. */
.bars__plot--dense,
.daybars--dense {
  gap: 1px;
}
.bars__plot--packed,
.daybars--packed {
  gap: 0;
}

/* ── Map page ────────────────────────────────────────────────────────────── */
.map-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
}
.map-card {
  flex: 1 1 520px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.map-side {
  flex: 1 1 300px;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.map-select__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}
.map-select__actions .btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.map-select__status {
  font-size: 12px;
  color: var(--text-faint);
}
.map-stage {
  display: flex;
  justify-content: center;
  background: #0d1018;
  border: 1px solid var(--track);
  border-radius: 14px;
  padding: 20px 10px;
}
.map-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
}
.map-legend {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.map-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.map-legend__dot {
  border-radius: 50%;
  background: rgba(255, 77, 90, 0.55);
  border: 1px solid var(--accent);
}
.map-legend__dot--small {
  width: 10px;
  height: 10px;
}
.map-legend__dot--large {
  width: 24px;
  height: 24px;
}

/* ── Chart tooltip ───────────────────────────────────────────────────────── */
.tooltip {
  position: fixed;
  z-index: 100;
  min-width: 120px;
  max-width: 280px;
  padding: 10px 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  font-size: 13px;
  pointer-events: none;
}
.tooltip__title {
  margin-bottom: 6px;
  font-weight: 700;
  color: var(--text);
}
.tooltip__row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
}
.tooltip__label {
  flex: 1;
}
.tooltip__value {
  font-weight: 700;
  color: var(--text);
}
[data-tip],
[data-slices] {
  cursor: default;
}
.bars__col:hover,
.month-col:hover .month-col__stack,
.daybars__bar:hover {
  filter: brightness(1.3);
}
.heatmap__cell:hover,
.rank:hover .rank__fill {
  filter: brightness(1.3);
}
.share-bar > div:hover {
  filter: brightness(1.2);
}

/* ── Live map (Leaflet) ──────────────────────────────────────────────────── */
.map-stage--live {
  padding: 0;
  overflow: hidden;
  width: 100%;
  max-width: 560px; /* Israel is a tall country: a tall, narrow map shows every area at once */
  margin-inline: auto;
}
.live-map,
.live-map.leaflet-container {
  width: 100%;
  height: clamp(560px, 88vh, 1000px);
  direction: ltr;
  background: #0d1018;
}
.live-map--error {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  direction: rtl;
}
.live-map-tip {
  background: var(--surface-alt);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  direction: rtl;
}
.live-map-tip::before {
  display: none;
}
/* Map buttons: the zoom buttons and "back to the regions" share one look */
.live-map-back,
.live-map .leaflet-control-zoom a.leaflet-control-zoom-in,
.live-map .leaflet-control-zoom a.leaflet-control-zoom-out {
  box-sizing: border-box;
  min-width: 44px;
  min-height: 44px;
  background: var(--surface-alt);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.live-map-back {
  margin-top: 10px;
  padding: 0 16px;
  direction: rtl;
}
.live-map .leaflet-control-zoom {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: none;
  border: none;
  box-shadow: none;
}
.live-map .leaflet-control-zoom a.leaflet-control-zoom-in,
.live-map .leaflet-control-zoom a.leaflet-control-zoom-out {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  font-size: 22px;
  line-height: 1;
}
.live-map-back:hover,
.live-map .leaflet-control-zoom a.leaflet-control-zoom-in:hover,
.live-map .leaflet-control-zoom a.leaflet-control-zoom-out:hover {
  background: var(--surface);
  color: var(--text);
}
.live-map .leaflet-control-zoom a.leaflet-disabled {
  background: var(--surface-alt);
  color: var(--text-faint);
  opacity: 0.55;
  cursor: not-allowed;
}
.live-map-back:focus-visible,
.live-map .leaflet-control-zoom a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.live-map-label span {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  direction: rtl;
  text-shadow: 0 0 3px #000, 0 0 3px #000, 0 0 6px #000;
  pointer-events: none;
}
.live-map .leaflet-tile-pane {
  /* label-free tiles turned into a dark grey map */
  filter: grayscale(1) brightness(0.32) contrast(1.5);
}
.minute-labels {
  display: flex;
  direction: ltr;
  margin-top: 8px;
  padding-left: 34px; /* the width of the value axis plus its gap, as in .bars__ticks */
  font-size: 11px;
  color: var(--text-faint);
}
.minute-labels > span {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 14px;
}
.minute-labels__text {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}
/* ── Drag-to-zoom on bar charts ──────────────────────────────────────────── */
[data-zoom-plot] {
  position: relative;
  cursor: crosshair;
  user-select: none;
  touch-action: pan-y;
}
.zoom-selection {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.12);
  border-inline: 1px solid rgba(255, 255, 255, 0.5);
  pointer-events: none;
}
.segmented--small {
  align-self: stretch;
}
.segmented--small .segmented__btn {
  flex: 1;
  justify-content: center;
  min-height: 40px;
  padding: 4px 12px;
  font-size: 13px;
}
.range-dates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.range-dates .input {
  padding-inline: 8px;
}
.relative-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.relative-row[hidden],
.range-dates[hidden] {
  display: none;
}
.relative-row .input {
  width: auto;
  min-width: 0;
}
.relative-row input[type='number'] {
  width: 84px;
}
.relative-row select {
  flex: 1;
}
.relative-row__suffix {
  font-size: 14px;
  color: var(--text-muted);
}
.filters__head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.popover--block {
  inset-inline: 0;
  inset-block-start: calc(100% + 4px);
  width: auto;
}
.popover__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
}
.summary__row {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  font-size: 13px;
}
.summary__row dt {
  color: var(--label);
  white-space: nowrap;
}
.summary__row dd {
  margin: 0;
  color: var(--text);
  text-align: end;
}

/* ── Named conflict periods on the time charts ───────────────────────────── */
.bars__plotwrap {
  position: relative;
  flex: 1;
  min-width: 0;
}
.bars__bands {
  position: absolute;
  inset: 0 0 1px;
  pointer-events: none;
}
.bars__band {
  position: absolute;
  top: 0;
  bottom: 0;
  min-width: 2px;
  background: rgba(76, 141, 255, 0.16);
  border-inline: 1px solid rgba(76, 141, 255, 0.45);
  opacity: 0; /* shown only while its tag below the chart is hovered or focused */
  transition: opacity 0.12s;
}
.bars__band--active {
  opacity: 1;
}
.period-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}
.period-chips__label {
  font-size: 12px;
  color: var(--text-faint);
}
.period-chips__chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.period-chips__swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: rgba(76, 141, 255, 0.45);
  border: 1px solid rgba(76, 141, 255, 0.8);
  flex: none;
}

/* ── Biggest events + footprint ──────────────────────────────────────────── */
.event-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.event-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--touch-target);
  width: 100%;
  padding: 8px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  color: var(--text);
  text-align: start;
  cursor: pointer;
}
.event-row:hover {
  background: var(--surface-alt);
}
.event-row[aria-pressed='true'] {
  background: var(--selected);
  border-color: var(--border-strong);
}
.event-row:focus-visible {
  outline: 2px solid var(--info);
  outline-offset: 2px;
}
.event-row__main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.event-row__when {
  font-weight: 700;
  text-align: right;
}
.event-row__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.event-row__size {
  width: 96px;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.event-row__size .rank__track {
  width: 100%;
}
.event-row__count {
  font-weight: 700;
}
.event-origin {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.event-zones {
  margin-top: 14px;
}
.event-detail__link {
  margin-top: 16px;
}

/* ── Header tools: presets, named periods, copy link ─────────────────────── */
.header-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.period-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.period-option {
  min-height: var(--touch-target);
  padding: 8px 12px;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-align: start;
  cursor: pointer;
}
.period-option:hover {
  background: var(--selected);
}
.period-option:focus-visible {
  outline: 2px solid var(--info);
  outline-offset: 2px;
}
