:root {
  color-scheme: light;
  background: #f7f8fb;
  color: #111;
  font-family: Inter, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100vh;
  min-height: 100vh;
  background: #f3f5f9;
  color: #121212;
  overflow: hidden;
}

.topbar {
  background: #03070d;
  color: #fff;
  padding: 14px 24px;
}

.brand-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: #fff;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  width: 42px;
  height: 42px;
  border: 2px solid #fff;
  border-radius: 50%;
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  border: 2px solid #fff;
  border-radius: 50%;
  inset: 4px;
}

.brand-mark::after {
  inset: -6px;
  border-right-color: transparent;
  border-bottom-color: transparent;
}

.brand-name {
  color: #fff;
  font-size: 30px;
  font-weight: 400;
}

.page-title {
  position: absolute;
  left: 40%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  color: #fff;
  font-size: 24px;
  font-weight: 400;
  white-space: nowrap;
}

.page-subtitle {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.76);
}

nav a {
  color: #fff;
  text-decoration: none;
  margin-left: 18px;
  font-size: 14px;
}

.app-shell {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: 100%;
  height: 100%;
  margin: 0;
  gap: 10px;
  padding: 10px;
  align-items: stretch;
  justify-items: stretch;
  min-height: 0;
  overflow: hidden;
}

.parser-pane {
  display: grid;
  gap: 8px;
}

.hidden {
  display: none;
}

.source-options {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-weight: 700;
}

.file-button {
  border: 1px solid #2563eb;
  border-radius: 8px;
  background: #fff;
  color: #2563eb;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  padding: 10px 14px;
}

.secondary-action {
  border: 1px solid #2563eb;
  border-radius: 8px;
  background: #fff;
  color: #2563eb;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  padding: 10px 14px;
}

.input-block {
  display: grid;
  gap: 10px;
}

.input-block label {
  font-weight: 700;
}

textarea {
  min-height: 120px;
  width: 100%;
  border: 1px solid #c2c7d0;
  border-radius: 12px;
  padding: 16px;
  font-family: Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.3;
  resize: vertical;
  background: #fdfdff;
  color: #111;
}

input[type="file"] {
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  position: absolute;
  pointer-events: none;
}

.file-button:hover,
.secondary-action:hover {
  background: #eff6ff;
}

.secondary-action:disabled {
  border-color: #cbd5e1;
  background: #f8fafc;
  color: #94a3b8;
  cursor: not-allowed;
}

textarea.drag-over {
  border-color: #2563eb;
  background: #eff6ff;
}

.selection-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-family: Inter, Arial, sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1;
}

.status-message {
  color: #111;
  font-size: 14px;
}

.source-options .status-message {
  margin-left: 8ch;
  font-weight: 700;
}

.messages-list {
  width: 100%;
  min-height: 120px;
  border: 1px solid #dbe0e9;
  border-radius: 8px;
  background: #fff;
  color: #111;
  font-family: Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.1;
  overflow: auto;
}

.messages-list option {
  padding: 1px 4px;
  margin: 0;
  font-size: 12px;
  line-height: 1.1;
  white-space: nowrap;
}

.messages-list option:checked {
  background: #d4d4d4 linear-gradient(#d4d4d4, #d4d4d4);
  color: #111;
}

.results-grid {
  --ufo-col: minmax(0, 0.8fr);
  --ffo-col: minmax(0, 0.76fr);
  --sequence-col: minmax(0, 1.54fr);
  display: grid;
  grid-template-columns: var(--ufo-col) var(--ffo-col) var(--sequence-col);
  gap: 10px;
  align-items: stretch;
  width: 100%;
  height: calc(100vh - 280px);
  min-height: min(320px, calc(100vh - 190px));
  max-height: calc(100vh - 190px);
  overflow: hidden;
}

.results-grid.ufo-collapsed {
  --ufo-col: 34px;
}

.results-grid.ffo-collapsed {
  --ffo-col: 34px;
  --sequence-col: minmax(0, 2.3fr);
}

.result-pane {
  position: relative;
  background: #fff;
  border: 1px solid #dde1e8;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  width: 100%;
  height: 100%;
  max-height: 100%;
}

.pane-toggle {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 2;
  width: 24px;
  height: 24px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  color: #334155;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0;
}

.result-pane.collapsed .output {
  display: none;
}

.result-pane.collapsed .pane-toggle {
  inset: 4px 4px auto auto;
}

.output {
  margin: 0;
  padding: 10px;
  font-family: Menlo, Consolas, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  color: #111;
  min-height: 0;
  height: auto;
  flex: 1 1 auto;
  overflow: auto;
}

.sequence-pane {
  padding: 10px;
  min-height: 0;
}

.sequence-diagram {
  min-height: 0;
  height: auto;
  flex: 1 1 auto;
  overflow: auto;
  font-family: Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.2;
}

.sequence-empty {
  color: #5b6472;
  font-size: 13px;
  padding: 4px 2px;
}

.sequence-table {
  width: max(100%, 780px);
  min-width: 780px;
  border-collapse: collapse;
  table-layout: fixed;
}

.sequence-col-time {
  width: 138px;
}

.sequence-col-seq {
  width: 4ch;
}

.sequence-col-flow {
  width: 120px;
}

.sequence-col-message {
  width: 150px;
}

.sequence-col-info {
  width: 365px;
}

.sequence-event {
  cursor: pointer;
}

.sequence-from-left {
  background: #eef7ff;
}

.sequence-from-right {
  background: #fff5e8;
}

.sequence-event.selected {
  background: #d7e2ee;
}

.sequence-event:hover:not(.selected) {
  background: #f8fafc;
}

.sequence-event:focus-visible {
  outline: 1px solid #2563eb;
  outline-offset: -1px;
}

.sequence-table td {
  padding: 2px 0.5ch;
  vertical-align: middle;
  white-space: nowrap;
}

.sequence-table td:first-child {
  padding-left: 0;
}

.sequence-table td:last-child {
  padding-right: 0;
}

.sequence-meta {
  font-size: 11px;
  line-height: 1.2;
  color: #4b5563;
}

.sequence-flow {
  font-size: 11px;
  line-height: 1.2;
  color: #1f2937;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sequence-arrow-glyph {
  display: inline-block;
  font-size: 16px;
  font-weight: 900;
  color: #000000;
  line-height: 1;
  vertical-align: middle;
  transform: translateY(-3px);
}

.sequence-seq {
  color: #111827;
  font-weight: 700;
  text-align: right;
  width: 4ch;
}

.sequence-seq,
.sequence-badge,
.sequence-info {
  font-size: 11px;
  line-height: 1.2;
  color: #111827;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sequence-info {
  color: #4b5563;
}

.sequence-glyph {
  display: inline-block;
  font-size: 1em;
  font-weight: 900;
  line-height: 1;
  margin-left: 2px;
  max-height: 1em;
  vertical-align: baseline;
}

.sequence-heart,
.sequence-reject {
  color: #dc2626;
  font-size: 1.15em;
}

.sequence-login {
  color: inherit;
}

.sequence-heart-weak {
  font-size: 1.15em;
}

.sequence-heart {
  color: #dc2626;
  font-size: 1.15em;
}

.sequence-reject {
  color: #dc2626;
  font-size: 1.15em;
}

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

  .app-shell {
    min-height: 0;
    overflow: visible;
  }

  .results-grid {
    grid-template-columns: 1fr;
  }

  .result-pane {
    height: auto;
    min-height: 260px;
  }
}

.sequence-event:hover:not(.selected) {
  filter: brightness(0.98);
}

.sequence-event:focus-visible {
  outline: 1px solid #2563eb;
  outline-offset: 0;
}
