/* Life Timeline — Выпадающие окна фильтров: сферы, люди, истории, периоды.
   Вынесено без изменений из app/life-timeline.html (строки 3847–4260 на 31.10.2026).
   Порядок подключения файлов важен: он повторяет исходный порядок правил. */
.sphere-popover,
.people-popover,
.cluster-popover,
.period-popover {
  position: fixed;
  z-index: 26;
  top: 74px;
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  width: min(340px, calc(100vw - 36px));
  padding: 14px;
  border-radius: 8px;
  pointer-events: auto;
  opacity: 0;
  visibility: hidden;
  transition: opacity 140ms ease, transform 140ms ease, visibility 140ms ease;
}

.people-popover,
.cluster-popover,
.period-popover {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .082), rgba(255, 255, 255, .024) 44%, rgba(255, 255, 255, .046)),
    rgba(18, 22, 25, .78);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .14),
    0 20px 60px rgba(0, 0, 0, .36);
}

.sphere-popover .popover-title,
.people-popover .popover-title,
.cluster-popover .popover-title,
.period-popover .popover-title { color: rgba(238, 243, 239, .92); }
.sphere-popover .popover-subtitle,
.people-popover .popover-subtitle,
.cluster-popover .popover-subtitle,
.period-popover .popover-subtitle { color: rgba(238, 243, 239, .62); }
.sphere-popover .sphere-item,
.people-popover .person-item,
.cluster-popover .cluster-item,
.period-popover .period-item { color: rgba(238, 243, 239, .72); }

.sphere-popover.is-open,
.people-popover.is-open,
.cluster-popover.is-open,
.period-popover.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.popover-title {
  margin: 0 0 3px;
  font-size: 15px;
  font-weight: 560;
  letter-spacing: 0;
}

.popover-subtitle {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.sphere-list,
.person-list,
.cluster-list,
.period-list {
  display: grid;
  gap: 5px;
  max-height: 330px;
  overflow: auto;
}

.cluster-list,
.period-list {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 6px;
}

.story-empty-state {
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid rgba(238, 243, 239, .09);
  border-radius: 8px;
  background: rgba(255, 255, 255, .032);
  color: rgba(238, 243, 239, .62);
  font-size: 11.5px;
  line-height: 1.36;
}

.story-example-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.story-example {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  max-width: 100%;
  padding: 4px 7px;
  border: 1px solid rgba(238, 243, 239, .10);
  border-radius: 999px;
  background: rgba(255, 255, 255, .036);
  color: rgba(238, 243, 239, .72);
  white-space: nowrap;
}

.story-example span,
.story-example {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sphere-item,
.person-item,
.cluster-item,
.period-item {
  display: grid;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  padding: 7px 8px;
  background: transparent;
  color: rgba(238, 243, 239, .76);
  text-align: left;
  min-width: 0;
}

.sphere-item > span:nth-child(2),
.person-select > span:nth-child(2),
.cluster-item > span:nth-child(2),
.period-item > span:nth-child(2),
.people-suggestion > span:nth-child(2),
.period-suggestion > span:nth-child(2),
.sphere-suggestion > span:nth-child(2) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sphere-item {
  grid-template-columns: 12px 1fr auto;
}

.person-item {
  grid-template-columns: 1fr auto;
  min-height: 40px;
}

.period-item {
  grid-template-columns: 12px 1fr auto auto;
}

.period-edit-action {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(238, 243, 239, .12);
  background: rgba(255,255,255,.045);
  color: rgba(238, 243, 239, .66);
  font-size: 12px;
  line-height: 1;
}

.period-edit-action:hover {
  border-color: rgba(156, 200, 194, .28);
  background: rgba(156, 200, 194, .10);
  color: rgba(238, 243, 239, .9);
}

.person-select {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  align-items: center;
  gap: 9px;
  min-width: 0;
  width: 100%;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.person-avatar-action {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(238, 243, 239, .12);
  border-radius: 50%;
  background: rgba(255, 255, 255, .040);
  color: rgba(238, 243, 239, .56);
  font-size: 12px;
  line-height: 1;
}

.person-avatar-action:hover {
  background: rgba(156, 200, 194, .12);
  color: rgba(238, 243, 239, .88);
}

.cluster-item {
  grid-template-columns: 16px 1fr auto;
  min-height: 38px;
}

.cluster-popover .cluster-item {
  display: inline-flex;
  width: auto;
  min-height: 30px;
  max-width: 100%;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid color-mix(in srgb, var(--cluster-color) 24%, rgba(238,243,239,.12));
  border-radius: 999px;
  background: color-mix(in srgb, var(--cluster-color) 9%, rgba(255,255,255,.030));
  color: rgba(238, 243, 239, .74);
  white-space: nowrap;
}

.cluster-popover .cluster-item > span:nth-child(2) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cluster-popover .cluster-item:hover,
.cluster-popover .cluster-item.selected {
  border-color: color-mix(in srgb, var(--cluster-color) 46%, rgba(238,243,239,.18));
  background: color-mix(in srgb, var(--cluster-color) 16%, rgba(255,255,255,.035));
  color: rgba(238, 243, 239, .92);
}

.cluster-popover .cluster-marker {
  width: 7px;
  height: 7px;
  border: 0;
  border-radius: 50%;
  background: var(--cluster-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--cluster-color) 10%, transparent);
  opacity: .74;
}

.cluster-popover .cluster-count {
  display: none;
}

.period-item {
  grid-template-columns: 16px 1fr auto;
}

.period-popover .period-item {
  display: inline-flex;
  width: auto;
  min-height: 30px;
  max-width: 100%;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid rgba(238, 243, 239, .12);
  border-radius: 999px;
  background: rgba(255, 255, 255, .030);
  white-space: nowrap;
}

.period-popover .period-item > span:nth-child(2) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.period-popover .period-item.selected {
  border-color: rgba(156, 200, 194, .34);
  background: rgba(156, 200, 194, .13);
}

.period-popover .period-marker {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(156, 200, 194, .58);
}

.period-popover .period-range {
  display: inline-flex;
  align-items: center;
  color: rgba(238, 243, 239, .46);
  font-size: 10.5px;
  font-weight: 520;
  letter-spacing: .01em;
}

.sphere-item:hover,
.sphere-item.selected {
  background: color-mix(in srgb, var(--sphere-color) 15%, rgba(255,255,255,.04));
  color: var(--text);
}

.person-item:hover,
.person-item.selected,
.cluster-item:hover,
.cluster-item.selected,
.period-item:hover,
.period-item.selected {
  background: rgba(255, 255, 255, .055);
  color: var(--text);
}

.sphere-item.is-disabled {
  opacity: .42;
  cursor: default;
}

.sphere-color {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-radius: 50%;
  background: var(--sphere-color);
}

.person-avatar {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(238, 243, 239, .16);
  border-radius: 50%;
  background: rgba(255, 255, 255, .055);
  color: rgba(238, 243, 239, .76);
  font-size: 11px;
  font-weight: 560;
  line-height: 1;
}

.period-marker {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  border: 1px solid rgba(238, 243, 239, .18);
  border-radius: 4px;
  background:
    linear-gradient(90deg, transparent 42%, rgba(238,243,239,.30) 42%, rgba(238,243,239,.30) 58%, transparent 58%),
    rgba(255, 255, 255, .035);
}

.cluster-marker {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  border: 1px solid color-mix(in srgb, var(--cluster-color) 34%, rgba(238,243,239,.16));
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 35%, rgba(255,255,255,.25), transparent 36%),
    color-mix(in srgb, var(--cluster-color) 42%, rgba(255,255,255,.035));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--cluster-color) 10%, transparent);
}

.sphere-count,
.person-count,
.cluster-count,
.period-range {
  color: rgba(238, 243, 239, .44);
  font-size: 11px;
  flex: 0 0 auto;
  white-space: nowrap;
}

.sphere-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sphere-count::after {
  content: "✓";
  opacity: 0;
  color: var(--sphere-color);
}

.sphere-item.selected .sphere-count::after { opacity: 1; }

.popover-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.ghost-button {
  height: 34px;
  background: rgba(255,255,255,.055);
  color: rgba(238, 243, 239, .72);
  border: 1px solid rgba(238, 243, 239, .12);
}

.ghost-button.primary {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, .016)),
    rgba(156, 200, 194, .065);
  border-color: rgba(156, 200, 194, .26);
  color: rgba(229, 248, 244, .96);
}

