.shared-modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--modal-backdrop, rgba(0, 0, 0, 0.4));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  z-index: 9999;
  overflow: auto;
}

:root {
  --modal-bg: #ffffff;
  --modal-border: 1px solid rgba(15, 23, 42, 0.08);
  --modal-text: #0f172a;
  --modal-muted: rgba(15, 23, 42, 0.65);
  --modal-accent: #3b82f6;
  --modal-primary: #4338ca;
  --modal-backdrop: rgba(15, 23, 42, 0.45);
}

body.shared-modal-open {
  overflow: hidden;
}

.shared-modal {
  background: var(--modal-bg, #ffffff);
  color: var(--modal-text, #0f172a);
  border-radius: 16px;
  min-width: 280px;
  max-width: 100%;
  width: min(560px, 100%);
  max-height: 90vh;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.15);
  display: flex;
  flex-direction: column;
  outline: none;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border: var(--modal-border, 1px solid rgba(15, 23, 42, 0.08));
}

.shared-modal--small {
  width: min(420px, 100%);
}

.shared-modal--medium {
  width: min(640px, 100%);
}

.shared-modal--large {
  width: min(720px, 100%);
}

.shared-modal--fullscreen {
  width: min(1000px, 100%);
  height: 95vh;
}

.shared-modal--draggable .shared-modal-header {
  cursor: move;
}

.shared-modal-resize-handle {
  position: absolute;
  width: 18px;
  height: 18px;
  bottom: 12px;
  right: 12px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  cursor: se-resize;
  display: block;
}

.shared-modal--resizable {
  padding-bottom: 22px;
}

.shared-modal-header,
.shared-modal-footer {
  padding: 16px 20px;
  border-bottom: 1px solid var(--modal-border, rgba(15, 23, 42, 0.08));
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.shared-modal-header {
  gap: 12px;
}

.shared-modal-title {
  font-size: 1rem;
  font-weight: 600;
}

.shared-modal-header .shared-modal-close {
  margin-left: auto;
}

.shared-modal-body {
  padding: 16px 20px;
  overflow: auto;
  flex: 1;
  background: transparent;
}

.shared-modal-footer {
  border-bottom: none;
  border-top: 1px solid var(--modal-border, rgba(255, 255, 255, 0.08));
  gap: 8px;
  justify-content: flex-end;
}

.shared-modal-footer-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.shared-modal-footer-actions button {
  min-width: 88px;
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 600;
  background: rgba(15, 23, 42, 0.04);
  color: var(--modal-text, #0f172a);
  transition: border 0.2s ease, background 0.2s ease;
}

.shared-modal-footer-actions button.primary {
  background: var(--modal-primary, #4338ca);
  border-color: transparent;
  color: #fff;
}

.shared-modal-footer-actions button.secondary {
  background: rgba(15, 23, 42, 0.06);
}

.shared-modal-footer-actions button:hover {
  border-color: rgba(15, 23, 42, 0.25);
}

.shared-modal-lane-description {
  margin: 0 0 12px;
  font-size: 0.95rem;
  color: var(--modal-muted, rgba(255, 255, 255, 0.8));
}

.shared-modal-lane-params {
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
}

.shared-modal-lane-params dt {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--modal-muted, rgba(255, 255, 255, 0.6));
}

.shared-modal-lane-params dd {
  margin: 0;
  font-size: 0.95rem;
  color: var(--modal-text, #fff);
}

.shared-modal-lane-events {
  margin-top: 12px;
}

.shared-modal-lane-events ul {
  margin: 0;
  padding-left: 16px;
  max-height: 120px;
  overflow: hidden;
  list-style: disc;
}

.shared-modal-lane-events li {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 4px;
}

.shared-modal-close {
  background: transparent;
  border: none;
  color: inherit;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.shared-modal-footer:empty {
  display: none;
}

.shared-modal-tab-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.shared-modal-tab-button {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 6px 14px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.shared-modal-tab-button.is-active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.shared-modal-tab-panels {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.shared-modal-tab-panel {
  display: none;
}

.shared-modal-tab-panel.is-active {
  display: block;
}

.shared-modal-timeline-root {
  margin-top: 18px;
}
