/* Life Timeline — Форма события: поля, даты, эмоция, значимость, люди, сферы, истории, фото.
   Вынесено без изменений из app/life-timeline.html (строки 3130–3846 на 31.10.2026).
   Порядок подключения файлов важен: он повторяет исходный порядок правил. */
.event-form {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

body[data-panel="form"] .event-form { display: block; }
body[data-panel="form"] .event-list,
body[data-panel="form"] .selected-event-card,
body[data-panel="form"] .scope-chip,
body[data-panel="form"] .panel-memory-row,
body[data-panel="form"] .remember-more-panel-slot,
body[data-panel="form"] .list-mode-toggle,
body[data-panel="form"] .saved-count { display: none; }

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
  color: rgba(238, 243, 239, .72);
  font-size: 12px;
}

.sphere-field,
.people-field,
.period-field {
  position: relative;
  z-index: 3;
}

.sphere-field select {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.form-main-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.form-detail-section {
  display: block;
  margin: 0 0 12px;
}

.form-detail-section > summary {
  display: none;
}

.form-impact-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 42px;
  margin: -1px 0 12px;
}

.date-precision-note {
  display: block;
  margin: -5px 0 12px;
  color: rgba(238, 243, 239, .46);
  font-size: 11px;
}

.field-note {
  display: block;
  margin-top: -2px;
  color: rgba(238, 243, 239, .46);
  font-size: 11px;
  line-height: 1.35;
}

.date-refinement-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.date-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 34px;
  align-items: center;
}

.date-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 5px 8px;
  border: 1px solid rgba(238, 243, 239, .13);
  border-radius: 999px;
  background: rgba(255, 255, 255, .030);
  color: rgba(238, 243, 239, .68);
  font-size: 11px;
}

.date-chip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 13px;
  height: 13px;
  color: rgba(238, 243, 239, .74);
}

.date-chip.is-selected {
  border-color: rgba(156, 200, 194, .38);
  background: rgba(156, 200, 194, .14);
  color: rgba(238, 243, 239, .92);
}

.date-chip:disabled,
.date-refinement-field.is-disabled {
  opacity: .38;
}

.form-impact-field {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 116px;
  min-height: 34px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(238, 243, 239, .62);
  font-size: 11px;
}

.form-impact-label {
  color: rgba(238, 243, 239, .72);
  font-size: 12px;
  line-height: 1.2;
}

.impact-column {
  display: flex;
  align-items: center;
  align-content: center;
  gap: 16px;
  min-height: 34px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field-row.three {
  grid-template-columns: 1fr 1fr 1fr;
}

.field-row.compact {
  grid-template-columns: 1fr 1fr;
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid rgba(238, 243, 239, .16);
  border-radius: 7px;
  background: rgba(255, 255, 255, .055);
  color: var(--text);
  outline: none;
  padding: 0 10px;
}

select option {
  background: #1b2024;
  color: var(--text);
}

input[readonly] {
  color: rgba(238, 243, 239, .56);
  background: rgba(255, 255, 255, .032);
}

input:disabled,
select:disabled,
textarea:disabled {
  opacity: .42;
  cursor: not-allowed;
  background: rgba(255, 255, 255, .025);
}

textarea {
  min-height: 76px;
  padding: 10px;
  resize: none;
  line-height: 1.35;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(156, 200, 194, .50);
  box-shadow: 0 0 0 3px rgba(156, 200, 194, .12);
}

.form-picker {
  position: absolute;
  z-index: 32;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  width: 100%;
  display: none;
  gap: 4px;
  max-height: 168px;
  padding: 6px;
  border: 1px solid rgba(238, 243, 239, .15);
  border-radius: 7px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.070), rgba(255,255,255,.020)),
    rgba(18, 22, 25, .92);
  box-shadow: 0 16px 42px rgba(0,0,0,.36);
  overflow: auto;
}

.form-picker.is-open,
.sphere-select-popover.is-open,
.people-suggestions.is-open,
.period-suggestions.is-open {
  display: grid;
}

.people-suggestions,
.period-suggestions,
.sphere-select-popover {
  position: absolute;
  z-index: 32;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  width: 100%;
  display: none;
  gap: 4px;
  max-height: 168px;
  overscroll-behavior: contain;
  padding: 6px;
  border: 1px solid rgba(238, 243, 239, .15);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.070), rgba(255,255,255,.020)),
    rgba(18, 22, 25, .94);
  box-shadow: 0 16px 42px rgba(0,0,0,.36);
  overflow: auto;
}

.sphere-select-popover {
  max-height: min(254px, 48vh);
  align-content: start;
  grid-auto-rows: minmax(30px, auto);
  z-index: 42;
}

.sphere-select-popover.is-open {
  position: static;
  margin-top: 4px;
}

.form-picker-button {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 38px;
  padding: 5px 10px;
  border: 1px solid rgba(238, 243, 239, .16);
  border-radius: 7px;
  background: rgba(255, 255, 255, .055);
  color: var(--text);
  text-align: left;
}

.form-picker-button.is-open {
  border-color: rgba(156, 200, 194, .50);
  box-shadow: 0 0 0 3px rgba(156, 200, 194, .12);
}

.period-range-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.period-range-fields input {
  min-height: 32px;
  padding: 0 8px;
  font-size: 11px;
}

.form-picker-caret {
  color: rgba(238, 243, 239, .56);
  font-size: 13px;
}

.people-suggestion,
.period-suggestion,
.sphere-suggestion {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 5px 7px;
  border-radius: 6px;
  color: rgba(238, 243, 239, .76);
  text-align: left;
  background: transparent;
}

.sphere-suggestion span:nth-child(2) {
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.2;
}

.people-suggestion .person-avatar,
.person-chip,
.person-item-avatar,
.person-avatar,
.timeline-card-person {
  overflow: hidden;
}

.people-suggestion .person-avatar img,
.person-chip img,
.person-item-avatar img,
.person-avatar img,
.timeline-card-person img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.people-suggestion:hover,
.period-suggestion:hover,
.sphere-suggestion:hover,
.sphere-suggestion.is-selected {
  background: rgba(156, 200, 194, .12);
  color: var(--text);
}

.people-suggestion.is-new,
.period-suggestion.is-new {
  color: rgba(240, 208, 154, .84);
}

.form-picker-marker,
.people-suggestion .person-avatar,
.period-suggestion .period-marker,
.sphere-suggestion .sphere-color {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.sphere-suggestion .sphere-color,
.form-picker-marker {
  background: var(--sphere-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--sphere-color) 12%, transparent);
}

.sphere-create-input {
  width: 100%;
  min-height: 30px;
  padding: 5px 7px;
  border-radius: 6px;
  font-size: 12px;
}

.sphere-suggestion.is-new {
  color: rgba(240, 208, 154, .84);
}

.emotion-scale {
  display: grid;
  gap: 7px;
}

.emotion-live-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.emotion-live-value {
  min-width: 38px;
  padding: 2px 8px;
  border: 1px solid rgba(238, 243, 239, .14);
  border-radius: 999px;
  background: rgba(255, 255, 255, .055);
  color: rgba(238, 243, 239, .82);
  font-size: 12px;
  text-align: center;
}

.emotion-input {
  padding: 0;
  min-height: 22px;
  accent-color: #89b8b2;
}

.emotion-labels {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  color: rgba(238, 243, 239, .44);
  font-size: 11px;
}

.emotion-labels span:nth-child(1) {
  justify-self: start;
  text-align: left;
}

.emotion-labels span:nth-child(2) {
  justify-self: center;
  text-align: center;
}

.emotion-labels span:nth-child(3) {
  justify-self: end;
  text-align: right;
}

.impact-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 36px;
}

.impact-dot {
  width: var(--size);
  height: var(--size);
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(238, 243, 239, .26);
  background: rgba(238, 243, 239, .16);
}

.impact-dot.is-selected {
  border-color: rgba(156, 200, 194, .56);
  background: rgba(156, 200, 194, .34);
  box-shadow: 0 0 0 5px rgba(156, 200, 194, .085);
}

.cluster-field {
  position: relative;
  z-index: 2;
}

.cluster-select {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 38px;
  padding: 5px 8px;
  border: 1px solid rgba(238, 243, 239, .16);
  border-radius: 7px;
  background: rgba(255, 255, 255, .055);
  color: rgba(238, 243, 239, .68);
  text-align: left;
}

.cluster-select.is-open {
  border-color: rgba(156, 200, 194, .50);
  box-shadow: 0 0 0 3px rgba(156, 200, 194, .12);
}

.cluster-selected-list,
.cluster-option-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.cluster-select-popover .cluster-option-list {
  display: grid;
  gap: 4px;
}

.cluster-select-caret {
  color: rgba(238, 243, 239, .56);
  font-size: 13px;
}

.cluster-empty {
  padding: 4px 2px;
  color: rgba(238, 243, 239, .44);
  font-size: 12px;
}

.cluster-choice {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  max-width: 100%;
  padding: 5px 8px;
  border: 1px solid color-mix(in srgb, var(--cluster-color) 22%, rgba(238,243,239,.12));
  border-radius: 999px;
  background: rgba(255, 255, 255, .030);
  color: rgba(238, 243, 239, .68);
  font-size: 11px;
  text-align: left;
}

.cluster-choice::before {
  content: "";
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cluster-color);
  opacity: .62;
}

.cluster-choice.is-selected {
  border-color: color-mix(in srgb, var(--cluster-color) 48%, rgba(238,243,239,.18));
  background: color-mix(in srgb, var(--cluster-color) 16%, rgba(255,255,255,.035));
  color: rgba(238, 243, 239, .90);
}

.cluster-select-popover .cluster-choice {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  width: 100%;
  min-height: 30px;
  padding: 5px 7px;
  border-color: transparent;
  border-radius: 6px;
  background: transparent;
  color: rgba(238, 243, 239, .76);
}

.cluster-select-popover .cluster-choice:hover,
.cluster-select-popover .cluster-choice.is-selected {
  border-color: transparent;
  background: rgba(156, 200, 194, .12);
  color: var(--text);
}

.cluster-select-popover .cluster-choice::before {
  width: 14px;
  height: 14px;
  opacity: .72;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--cluster-color) 12%, transparent);
}

.cluster-select-popover {
  position: absolute;
  z-index: 32;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  display: none;
  gap: 8px;
  max-height: 232px;
  padding: 8px;
  border: 1px solid rgba(238, 243, 239, .15);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.070), rgba(255,255,255,.020)),
    rgba(18, 22, 25, .94);
  box-shadow: 0 16px 42px rgba(0,0,0,.36);
  overflow: auto;
}

.cluster-select-popover.is-open {
  display: grid;
}

.cluster-search {
  min-height: 32px;
  font-size: 12px;
}

.cluster-create {
  justify-content: flex-start;
  border-color: rgba(240, 208, 154, .24);
  color: rgba(240, 208, 154, .86);
}

.form-save {
  width: 100%;
  height: 42px;
  margin-top: 2px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .050), rgba(255, 255, 255, .018)),
    rgba(156, 200, 194, .075);
  border: 1px solid rgba(156, 200, 194, .28);
  color: rgba(229, 248, 244, .96);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .08),
    0 0 0 1px rgba(156, 200, 194, .035);
}

.form-save:disabled {
  cursor: wait;
  opacity: .64;
}

.form-delete {
  display: none;
  justify-self: end;
  min-height: 28px;
  padding: 0 9px;
  background: transparent;
  border: 1px solid rgba(240, 111, 106, .18);
  color: rgba(240, 111, 106, .74);
  font-size: 12px;
}

body[data-editing-event="true"] .form-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.form-delete:hover {
  background: rgba(240, 111, 106, .08);
  color: rgba(255, 198, 194, .94);
}

.form-save-status {
  min-height: 18px;
  color: rgba(156, 200, 194, .88);
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}

.form-save-status.is-error {
  color: rgba(240, 111, 106, .92);
}

.media-button {
  width: 100%;
  height: 38px;
  margin: 0 0 12px;
  border: 1px dashed rgba(238, 243, 239, .18);
  border-radius: 7px;
  background: rgba(255, 255, 255, .030);
  color: rgba(238, 243, 239, .62);
  text-align: center;
}

.person-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}

.person-chip {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  width: 28px;
  height: 28px;
  margin-right: -6px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, rgba(255,255,255,.18), transparent 42%),
    color-mix(in srgb, var(--event-color) 22%, rgba(255,255,255,.055));
  color: rgba(238, 243, 239, .72);
  font-size: 12px;
  line-height: 1;
}

.person-chip.extra {
  justify-content: center;
  margin-right: 0;
  background: rgba(255, 255, 255, .055);
  color: rgba(238, 243, 239, .74);
  font-size: 11px;
}

.person-initial {
  display: inline-grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: transparent;
  color: rgba(255, 255, 255, .86);
  font-size: 11px;
}

