:root {
  --bg: #22272b;
  --surface: #252b30;
  --surface-soft: #2a3137;
  --surface-line: rgba(255, 255, 255, 0.08);
  --text: #eef3f6;
  --muted: #a4b0b8;
  --accent: #9ed3df;
  --accent-soft: rgba(158, 211, 223, 0.12);
  --highlight: #ffb347;
  --selected: #ff8f5a;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
}

.app-frame {
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  background: var(--surface);
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.app-frame::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.timeline-view,
.details-view {
  scroll-snap-align: none;
}

.timeline-view {
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: 18px 0 0;
  gap: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  margin-bottom: 14px;
  padding: 0 26px;
  min-height: 58px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark img {
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.22));
}

.brand-icon {
  height: clamp(26px, 3vw, 38px);
  width: auto;
  flex: 0 0 auto;
}

.brand-wordmark {
  height: clamp(18px, 2.2vw, 28px);
  width: auto;
  max-width: min(18vw, 156px);
}

.timeline-menu-button {
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex: 0 0 auto;
  color: rgba(238, 243, 246, 0.92);
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.035);
  position: relative;
  border-radius: 10px;
}

.timeline-menu-button span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: rgba(238, 243, 246, 0.88);
}

.timeline-menu-button::before {
  content: "\2630";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  line-height: 1;
  color: rgba(238, 243, 246, 0.92);
}

.timeline-menu-button span {
  opacity: 0;
}

.kicker,
.label {
  margin: 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.74rem;
}

.control-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

button {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 10px 14px;
  font: inherit;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
  border-radius: 10px;
}

.control-grid button {
  min-height: 42px;
  padding: 10px 18px;
}

button:hover {
  border-color: rgba(158, 211, 223, 0.35);
  background: var(--accent-soft);
}

button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.timeline-stage {
  position: relative;
  min-height: 0;
  height: 100%;
  background: #1b2024;
  border-top: 1px solid var(--surface-line);
  border-bottom: 0;
  border-left: 0;
  border-right: 0;
  overflow: hidden;
  isolation: isolate;
}

.timeline-menu-overlay {
  position: absolute;
  inset: 0 0 auto 0;
  height: calc(100vh - 24px);
  height: calc(100dvh - 24px);
  background: rgba(10, 12, 14, 0.12);
  z-index: 4;
}

.timeline-side-menu {
  position: absolute;
  top: 0;
  left: 0;
  width: min(33vw, 420px);
  max-width: min(calc(100% - 24px), 420px);
  height: calc(100vh - 24px);
  height: calc(100dvh - 24px);
  border: 1px solid rgba(28, 38, 48, 0.1);
  background: #f3f5f7;
  color: #1f2930;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.18);
  transform: translateX(calc(-100% - 18px));
  opacity: 0;
  pointer-events: none;
  transition: transform 180ms ease, opacity 180ms ease;
  z-index: 5;
  border-top-right-radius: 24px;
  border-bottom-right-radius: 24px;
  overflow: hidden;
}

.timeline-side-menu.is-open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.timeline-side-menu-inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  padding: 14px 14px 18px;
}

.timeline-menu-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.timeline-menu-titleblock {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.timeline-menu-close-button {
  width: 30px;
  height: 30px;
  padding: 0;
  flex: 0 0 auto;
  border: 1px solid rgba(31, 41, 48, 0.12);
  border-radius: 10px;
  background: rgba(31, 41, 48, 0.04);
  color: rgba(31, 41, 48, 0.58);
  font-size: 0.84rem;
  line-height: 1;
}

.timeline-menu-close-button:hover {
  border-color: rgba(31, 41, 48, 0.18);
  background: rgba(31, 41, 48, 0.07);
  color: rgba(31, 41, 48, 0.72);
}

.timeline-menu-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 0 12px;
  border-bottom: 1px solid rgba(31, 41, 48, 0.08);
}

.timeline-menu-section:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.timeline-menu-section strong {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  color: #182128;
}

.timeline-menu-icon {
  width: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(24, 33, 40, 0.62);
  font-size: 0.92rem;
}

.timeline-side-menu .label,
.timeline-side-menu .event-description,
.timeline-side-menu .field > span {
  color: rgba(31, 41, 48, 0.68);
}

.timeline-side-menu .field {
  gap: 6px;
}

.timeline-side-menu .event-description {
  font-size: 0.86rem;
  line-height: 1.45;
}

.timeline-side-menu select,
.timeline-side-menu input,
.timeline-side-menu textarea {
  border-color: rgba(31, 41, 48, 0.12);
  background: rgba(255, 255, 255, 0.86);
  color: #1f2930;
}

.timeline-side-menu select:focus-visible,
.timeline-side-menu input:focus-visible,
.timeline-side-menu textarea:focus-visible {
  outline: 2px solid rgba(92, 133, 160, 0.28);
  outline-offset: 1px;
}

.menu-language-field select {
  min-height: 36px;
}

.workspace-strip {
  width: 100%;
  border-top: 1px solid var(--surface-line);
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  background: rgba(255, 255, 255, 0.025);
  color: rgba(238, 243, 246, 0.45);
  text-align: center;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 16px 16px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  z-index: 2;
  user-select: none;
  touch-action: manipulation;
}

.workspace-strip:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
}

.workspace-strip-label {
  pointer-events: none;
}

.chart-strip-controls {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.chart-strip-button {
  min-width: 30px;
  height: 28px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  color: rgba(238, 243, 246, 0.78);
}

.chart-strip-button-icon {
  min-width: 40px;
  padding: 0 6px;
}

.chart-strip-button-icon svg {
  width: 18px;
  height: 18px;
  overflow: visible;
}

.chart-strip-button-icon polyline {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-strip-button-icon circle {
  fill: currentColor;
}

.chart-strip-button.is-active {
  border-color: rgba(255, 179, 71, 0.45);
  color: var(--highlight);
  background: rgba(255, 179, 71, 0.12);
}

.chart-strip-button.is-muted {
  border-color: rgba(255, 255, 255, 0.12);
  color: #8b949b;
  background: rgba(255, 255, 255, 0.04);
}

.chart-strip-button.is-off {
  border-color: rgba(255, 255, 255, 0.08);
  color: rgba(238, 243, 246, 0.42);
  background: #1b2024;
}

.workspace-fullscreen-button {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  min-width: 30px;
  height: 28px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(238, 243, 246, 0.78);
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.035);
  font-size: 0.78rem;
  line-height: 1;
}

.workspace-zoom-controls {
  position: absolute;
  top: 50%;
  right: 56px;
  transform: translateY(-50%);
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.workspace-zoom-button {
  position: static;
  transform: none;
}

.workspace-zoom-button svg {
  width: 16px;
  height: 16px;
  overflow: visible;
}

.workspace-zoom-button circle,
.workspace-zoom-button line {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.workspace-fullscreen-button.is-active {
  border-color: rgba(255, 179, 71, 0.45);
  color: var(--highlight);
  background: rgba(255, 179, 71, 0.12);
}

.workspace-fullscreen-button.is-muted {
  border-color: rgba(255, 255, 255, 0.12);
  color: #8b949b;
  background: rgba(255, 255, 255, 0.04);
}

.workspace-fullscreen-button:hover {
  border-color: rgba(255, 179, 71, 0.58);
  background: rgba(255, 179, 71, 0.12);
}

#zahlenstrahl {
  display: block;
  width: 100%;
  height: 100%;
  transform: scale(var(--presentation-scale, 1));
  transform-origin: center center;
  transition: transform 140ms ease;
}

.details-view {
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px;
  display: grid;
  grid-template-columns: minmax(320px, 1.1fr) minmax(320px, 1fr);
  gap: 18px;
  background: var(--surface-soft);
  overflow: hidden;
}

.details-inline {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--surface-line);
  background: rgba(255, 255, 255, 0.03);
  min-height: 0;
  overflow-y: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.details-inline::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.panel-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.details-inline strong {
  font-size: 1.15rem;
  font-weight: 600;
}

.event-year {
  color: var(--highlight);
  font-weight: 600;
}

.event-description {
  color: var(--muted);
  line-height: 1.6;
}

.event-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.event-item {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  padding: 10px 12px;
  min-width: 180px;
  text-align: left;
}

.event-item:hover,
.event-item.is-selected {
  border-color: rgba(255, 179, 71, 0.4);
  background: rgba(255, 179, 71, 0.06);
}

.event-item strong,
.event-item span {
  display: block;
}

.event-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
}

.editor-panel,
.search-panel {
  gap: 18px;
}

.data-mode-switch {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 2px;
}

.data-mode-button {
  min-width: 108px;
}

.data-mode-button.is-active {
  border-color: rgba(255, 179, 71, 0.45);
  color: var(--highlight);
  background: rgba(255, 179, 71, 0.12);
}

.data-mode-panel {
  display: block;
}

.data-mode-panel[hidden] {
  display: none !important;
}

.chart-import-panel {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.chart-source-row {
  margin-bottom: 10px;
}

.chart-search-form {
  margin-bottom: 10px;
}

.chart-results {
  display: grid;
  gap: 10px;
}

.chart-result-card {
  border: 1px solid var(--surface-line);
  background: rgba(255, 255, 255, 0.03);
  padding: 14px;
  display: grid;
  gap: 6px;
}

.chart-result-card .field {
  margin-top: 4px;
}

.chart-result-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.chart-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}

.field span {
  color: var(--muted);
  font-size: 0.88rem;
}

.field-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.compact-color-field {
  gap: 0;
  z-index: 12;
}

.compact-color-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 18px 28px;
  gap: 8px;
  align-items: center;
}

.compact-color-row > span:first-child {
  white-space: nowrap;
}

.compact-color-row input {
  min-width: 0;
}

.color-preview {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: transparent;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.color-preview.is-empty {
  background:
    linear-gradient(135deg, transparent 42%, rgba(255, 123, 114, 0.85) 42%, rgba(255, 123, 114, 0.85) 58%, transparent 58%),
    rgba(255, 255, 255, 0.03);
}

.color-picker-button {
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
}

.color-picker-icon {
  pointer-events: none;
}

.color-palette {
  position: absolute;
  top: auto;
  bottom: calc(100% + 8px);
  right: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(4, 28px);
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #2e353b;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.28);
}

.color-palette[hidden] {
  display: none !important;
}

.color-swatch {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: transparent;
}

.field input,
.field select,
.field textarea,
.search-form input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  padding: 6px 8px;
  font: inherit;
}

.field select {
  color: var(--text);
  background-color: #2e353b;
}

.field select option {
  color: var(--text);
  background-color: #2e353b;
}

.field textarea {
  resize: vertical;
  min-height: 72px;
}

.field-row {
  display: flex;
  gap: 10px;
}

.lane-input-wrap {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 32px;
  gap: 6px;
  align-items: center;
}

.lane-step-button {
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.lane-text-input {
  text-align: center;
}

.field-row > .compact-color-field,
.field-row > .field {
  flex: 1;
}

.year-fields .field {
  flex: 1;
}

.relation-control-row {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 0.85fr) 148px;
  gap: 10px;
  align-items: end;
}

.relation-control-row > .field {
  min-width: 0;
}

.relation-compact-field select {
  min-width: 0;
}

.relation-preview-field {
  flex: 0 0 auto;
}

.relation-preview-box {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}

.relation-preview-svg {
  width: 100%;
  height: 30px;
  display: block;
}

.checkbox-field,
.switch-field {
  flex-direction: row;
  align-items: center;
}

.checkbox-field input {
  width: auto;
}

.switch-field {
  justify-content: flex-start;
  gap: 8px;
  align-items: center;
  padding-top: 0;
}

.switch-field input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  position: relative;
  flex: 0 0 auto;
  width: 34px;
  height: 19px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.14);
  transition: background-color 160ms ease, border-color 160ms ease;
  margin-bottom: 0;
}

.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: rgba(239, 243, 246, 0.92);
  transition: transform 160ms ease;
}

.switch-field input:checked + .switch-track {
  background: rgba(255, 179, 71, 0.22);
  border-color: rgba(255, 179, 71, 0.44);
}

.switch-field input:checked + .switch-track .switch-thumb {
  transform: translateX(15px);
  background: #ffb347;
}

.field.is-disabled {
  opacity: 0.45;
}

.field.is-disabled input,
.field.is-disabled select,
.field.is-disabled textarea {
  color: rgba(164, 176, 184, 0.75);
  background: rgba(255, 255, 255, 0.025);
  border-color: rgba(255, 255, 255, 0.08);
  cursor: not-allowed;
}

.editor-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.editor-inline-hint {
  margin: -2px 0 4px;
  line-height: 1.35;
  font-size: 0.8rem;
  color: #ffb347;
}

.event-library {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--surface-line);
}

.library-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.event-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 120px;
}

.chart-section-label {
  display: block;
  margin: 16px 0 8px;
}

.chart-browser-item {
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
}

.chart-browser-item.is-open {
  border-left-color: rgba(255, 179, 71, 0.45);
}

.chart-browser-item.is-focus-muted {
  opacity: 0.42;
}

.chart-row {
  padding: 12px 14px;
}

.chart-row-main {
  min-width: 0;
  cursor: pointer;
}

.chart-row-main strong,
.chart-row-main span,
.chart-row-main small {
  display: block;
}

.chart-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.chart-inline-editor {
  display: grid;
  gap: 14px;
  padding: 0 14px 14px;
}

.chart-legend-line {
  width: 28px;
  height: 0;
  border-top: 3px solid currentColor;
  border-radius: 999px;
  margin-top: 8px;
  align-self: center;
}

.chart-row-date {
  align-self: center;
}

.epoch-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
}

.epoch-menu[hidden] {
  display: none;
}

.epoch-menu-item {
  margin-left: 0;
}

.epoch-menu-row {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.epoch-menu-item-button {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  text-align: left;
  padding: 0;
  border: 0;
  background: transparent;
}

.epoch-menu-item-button span {
  color: var(--muted);
  font-size: 0.74rem;
}

.event-browser-item {
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  border-radius: 0;
  overflow: visible;
}

.event-browser-item.is-child {
  margin-left: calc(14px + var(--tree-depth, 0) * 14px);
  border-left-color: rgba(255, 179, 71, 0.22);
}

.event-browser-item.is-open {
  border-left-color: rgba(255, 179, 71, 0.45);
}

.event-browser-item.is-focus-muted,
.group-browser-item.is-focus-muted {
  opacity: 0.42;
}

.group-browser-item.is-context-open > .group-row {
  opacity: 0.52;
}

.group-browser-item.is-context-open > .group-row {
  opacity: 1;
}

.event-browser-item.is-context-open > .event-row {
  opacity: 1;
}

.group-browser-item {
  border: 1px solid rgba(255, 179, 71, 0.22);
  background: rgba(255, 255, 255, 0.015);
  border-radius: 4px;
  overflow: visible;
}

.import-loading-card {
  border-color: rgba(255, 179, 71, 0.28);
}

.import-loading-row {
  grid-template-columns: auto auto minmax(0, 1fr) auto;
}

.import-loading-body {
  padding: 0 12px 10px 60px;
}

.import-loading-progress {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.group-browser-item.is-child-group {
  margin-left: calc(14px + var(--tree-depth, 0) * 14px);
  border: 0;
  border-left: 1px solid rgba(255, 179, 71, 0.22);
  background: transparent;
  border-radius: 0;
}

.group-browser-item.is-child-group > .group-row {
  padding: 3px 6px 3px 8px;
  background: rgba(255, 255, 255, 0.015);
}

.group-row {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto auto auto auto auto;
  gap: 6px;
  align-items: center;
  padding: 4px 6px;
}

.group-row-toggle,
.tree-row-toggle,
.group-row-main {
  padding: 0;
  border: 0;
  background: transparent;
}

.group-row-toggle,
.tree-row-toggle {
  width: 24px;
  height: 24px;
}

.tree-row-toggle:disabled {
  opacity: 0.25;
  cursor: default;
}

.group-row-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  text-align: left;
  cursor: default;
}

.group-row-main.is-disabled {
  opacity: 0.55;
}

.group-row-main strong {
  font-size: 0.98rem;
  line-height: 1.15;
}

.group-browser-item:has(> .event-inline-editor) > .group-row .group-row-main strong {
  color: #ffb347;
}

.group-row-main strong,
.group-row-main span {
  display: block;
}

.group-row-main span,
.group-row-source,
.group-empty {
  color: var(--muted);
  font-size: 0.74rem;
}

.group-browser-item.is-child-group > .group-row .group-row-main span,
.group-browser-item.is-child-group > .group-row .group-row-source {
  display: none;
}

.group-row-source {
  white-space: nowrap;
}

.group-row-export {
  min-width: 0;
  padding: 0 8px;
  height: 24px;
  font-size: 0.72rem;
  white-space: nowrap;
}

.group-row-properties {
  width: 28px;
  padding: 0;
  font-size: 0.8rem;
}

.group-row-properties.is-active {
  color: #ffb347;
  border-color: rgba(255, 179, 71, 0.48);
  background: rgba(255, 179, 71, 0.12);
  opacity: 1;
  pointer-events: auto;
}

.group-row-properties.is-muted {
  opacity: 0.42;
}

.group-row.is-drop-target,
.event-row.is-drop-target {
  outline: 1px solid rgba(255, 179, 71, 0.68);
  outline-offset: -1px;
  background: rgba(255, 179, 71, 0.08);
}

.event-row[draggable="true"] {
  cursor: grab;
}

.event-row.is-dragging {
  opacity: 0.55;
}

.group-row[draggable="true"] {
  cursor: grab;
}

.group-row.is-dragging {
  opacity: 0.55;
}

.group-children {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 6px 6px 10px;
  border-top: 1px solid rgba(255, 179, 71, 0.1);
}

.group-empty {
  padding: 8px 12px;
}

.event-row {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto auto;
  gap: 6px;
  align-items: center;
  padding: 3px 6px 3px 8px;
  background: rgba(255, 255, 255, 0.015);
}

.event-row-delete {
  width: 24px;
  height: 24px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
}

.event-row-delete {
  color: #ff7b72;
  border-color: rgba(255, 123, 114, 0.2);
}

.event-row-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
}

.event-row-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  box-shadow: none;
  cursor: pointer;
}

.event-row-main:disabled,
.group-row-export:disabled,
.event-row-delete:disabled,
.event-row-check input:disabled,
.tree-row-toggle:disabled,
.group-row-toggle:disabled {
  opacity: 0.42;
  cursor: default;
  pointer-events: none;
}

.event-row-main strong {
  font-size: 0.98rem;
  line-height: 1.15;
}

.event-browser-item.is-open .event-row-main strong {
  color: #ffb347;
}

.title-content {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.title-prefix {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.title-prefix-flag {
  height: 0.95em;
  width: auto;
  max-width: 1.35em;
  object-fit: contain;
  vertical-align: middle;
}

.event-row-main strong,
.event-row-main span {
  display: block;
}

.event-row-main:hover {
  background: transparent;
  border-color: transparent;
}

.event-row-main span {
  color: var(--muted);
  font-size: 0.74rem;
}

.event-row-date {
  color: var(--highlight);
  font-size: 0.74rem;
  white-space: nowrap;
}

.event-row-warning,
.event-row-main .event-row-warning {
  color: #ff7b72;
  font-size: 0.72rem;
  white-space: nowrap;
}

.event-inline-editor {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 6px 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.secondary-button {
  align-self: flex-start;
  padding: 8px 12px;
}

.add-action-button {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.add-action-button:disabled {
  opacity: 0.42;
  color: rgba(238, 243, 246, 0.42);
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.025);
  cursor: default;
  pointer-events: none;
}

.add-action-button:disabled .add-action-plus {
  color: rgba(239, 243, 246, 0.34);
}

.add-action-plus {
  color: rgba(239, 243, 246, 0.62);
  font-weight: 600;
  line-height: 1;
}

.event-tooltip {
  position: absolute;
  max-width: 320px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 179, 71, 0.35);
  background: rgba(34, 39, 43, 0.96);
  color: var(--text);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
  pointer-events: none;
  z-index: 5;
}

.event-tooltip strong,
.event-tooltip span {
  display: block;
}

.event-tooltip .title-content {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.event-tooltip span {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.45;
}

.editor-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.search-form {
  display: flex;
  gap: 10px;
}

.search-form input {
  flex: 1;
}

.search-results {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 120px;
}

.search-loading-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  width: min(420px, 100%);
  border: 1px solid rgba(255, 179, 71, 0.22);
  background: rgba(255, 179, 71, 0.06);
}

.search-loading-panel[hidden] {
  display: none !important;
}

.confirm-modal[hidden] {
  display: none !important;
}

.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
}

.confirm-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 12, 14, 0.52);
}

.confirm-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(420px, calc(100vw - 32px));
  display: grid;
  gap: 14px;
  padding: 18px 18px 16px;
  border: 1px solid rgba(255, 179, 71, 0.22);
  background: #2b3136;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.32);
}

.confirm-modal-dialog p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.confirm-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.search-loading-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.search-loading-percent {
  color: var(--highlight);
  font-size: 0.8rem;
  font-weight: 600;
}

.search-loading-bar {
  position: relative;
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.search-loading-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(255, 179, 71, 0.7), rgba(255, 179, 71, 1));
  transition: width 180ms ease;
}

.search-loading-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.search-result {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
}

.search-result input {
  margin-top: 4px;
}

.search-result strong,
.search-result span,
.search-result small {
  display: block;
}

.search-result span,
.search-result small {
  color: var(--muted);
  margin-top: 4px;
}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  .app-frame {
    height: auto;
    overflow: visible;
  }

  .topbar {
    flex-direction: column;
    align-items: start;
  }

  .brand-icon {
    height: clamp(28px, 8vw, 44px);
  }

  .brand-wordmark {
    max-width: min(60vw, 300px);
  }

  .control-grid {
    justify-content: flex-start;
  }

  .timeline-view {
    min-height: auto;
    padding: 16px 16px 0;
  }

  .timeline-stage {
    min-height: 55vh;
  }

  .details-view {
    height: auto;
    overflow: visible;
    min-height: auto;
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .details-inline {
    overflow: visible;
  }

  .search-form,
  .field-row {
    flex-direction: column;
  }

  .relation-control-row {
    grid-template-columns: 1fr;
  }

  .event-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .event-row-date {
    grid-column: 2 / 3;
  }

  .group-row {
    grid-template-columns: auto auto minmax(0, 1fr) auto auto;
  }

  .group-row-source {
    grid-column: 3 / 4;
  }
}
