.topics-panel,
.live-panel {
  min-height: 0;
}

.topics-panel > .panel-head,
.live-panel > .panel-head {
  flex: 0 0 auto;
}

/*
 * The columns scroll instead of compressing
 * their child rows.
 */
.topic-list,
.live-events {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.topic-row,
.live-event {
  flex: 0 0 auto;
  min-width: 0;
}

.live-events {
  align-items: stretch;
}

.live-event {
  width: 100%;
}

.live-event header {
  flex: 0 0 auto;
  gap: 16px;
}

/*
 * Each JSON payload has its own vertical
 * and horizontal scrolling.
 */
.live-event pre {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 72px;
  max-height: 260px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable both-edges;
  white-space: pre;
  overflow-wrap: normal;
  word-break: normal;
  tab-size: 2;
}

.live-placeholder {
  margin: auto;
}

@media (max-width: 900px) {
  .topics-panel,
  .live-panel {
    height: min(620px, 72vh);
  }
}

/* =====================================================
   Live sample cards
   ===================================================== */

.live-event header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.live-event-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.expand-live-event {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 32px;
  padding: 0.35rem 0.7rem;

  border: 1px solid #263440;
  border-radius: 4px;

  background: #151d25;
  color: #9fb0be;

  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;

  cursor: pointer;

  transition:
    color 150ms ease,
    background 150ms ease,
    border-color 150ms ease;
}

.expand-live-event svg {
  color: #27df72;
}

.expand-live-event:hover {
  border-color: rgba(39, 223, 114, 0.55);
  background: rgba(39, 223, 114, 0.08);
  color: #ffffff;
}

.expand-live-event:focus-visible {
  outline: 2px solid #27df72;
  outline-offset: 2px;
}


/* =====================================================
   Enlarged live-data dialog
   ===================================================== */

.live-data-dialog {
  width: min(1280px, calc(100vw - 80px));
  height: min(820px, calc(100vh - 80px));

  max-width: none;
  max-height: none;

  padding: 0;

  border: 1px solid #25313b;
  border-radius: 6px;

  background: #0f151b;
  color: #e9eef3;

  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.7);

  overflow: hidden;
}

.live-data-dialog[open] {
  display: block;
}

.live-data-dialog::backdrop {
  background: rgba(3, 7, 11, 0.82);
  backdrop-filter: blur(3px);
}

.live-data-dialog-content {
  display: flex;
  flex-direction: column;

  width: 100%;
  height: 100%;
  min-height: 0;

  background: #0f151b;
}


/* =====================================================
   Dialog header
   ===================================================== */

.live-data-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;

  min-height: 84px;
  padding: 1.15rem 1.4rem;

  border-bottom: 1px solid #202b34;
  background: #11181f;
}

.live-data-dialog-header > div {
  min-width: 0;
}

.live-data-dialog-header .eyebrow {
  display: block;
  margin-bottom: 0.35rem;

  color: #27df72;

  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.live-data-dialog-header h2 {
  margin: 0;

  color: #f4f7fa;

  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.25;
}

.live-data-dialog-header time {
  display: block;
  margin-top: 0.35rem;

  color: #7f92a3;

  font-family:
    "SFMono-Regular",
    Consolas,
    "Liberation Mono",
    monospace;

  font-size: 0.7rem;
}


/* =====================================================
   Close button
   ===================================================== */

.close-live-data-dialog {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;

  width: 36px;
  height: 36px;
  padding: 0;

  border: 1px solid #283540;
  border-radius: 4px;

  background: #151d25;
  color: #9fb0be;

  font: inherit;
  font-size: 1.45rem;
  font-weight: 300;
  line-height: 1;

  cursor: pointer;

  transition:
    color 150ms ease,
    background 150ms ease,
    border-color 150ms ease;
}

.close-live-data-dialog:hover {
  border-color: rgba(39, 223, 114, 0.55);
  background: rgba(39, 223, 114, 0.08);
  color: #27df72;
}

.close-live-data-dialog:focus-visible {
  outline: 2px solid #27df72;
  outline-offset: 2px;
}


/* =====================================================
   Expanded JSON/data area
   ===================================================== */

.expanded-sample-content {
  flex: 1;
  min-width: 0;
  min-height: 0;

  margin: 0;
  padding: 1.4rem 1.5rem;

  border: 0;
  border-radius: 0;

  overflow: auto;

  background: #0b1117;
  color: #d9e4ec;

  white-space: pre;
  tab-size: 2;

  font-family:
    "SFMono-Regular",
    Consolas,
    "Liberation Mono",
    monospace;

  font-size: 0.78rem;
  line-height: 1.65;

  scrollbar-width: thin;
  scrollbar-color: #53616c #11181f;
}

.expanded-sample-content:focus {
  outline: none;
}

.expanded-sample-content::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

.expanded-sample-content::-webkit-scrollbar-track {
  background: #11181f;
}

.expanded-sample-content::-webkit-scrollbar-thumb {
  border: 2px solid #11181f;
  border-radius: 8px;
  background: #53616c;
}

.expanded-sample-content::-webkit-scrollbar-thumb:hover {
  background: #6d7c87;
}


/* =====================================================
   Responsive layout
   ===================================================== */

@media (max-width: 700px) {
  .expand-live-event span {
    display: none;
  }

  .expand-live-event {
    width: 34px;
    padding: 0;
  }

  .live-data-dialog {
    width: calc(100vw - 20px);
    height: calc(100vh - 20px);

    border-radius: 4px;
  }

  .live-data-dialog-header {
    min-height: 76px;
    padding: 1rem;
  }

  .live-data-dialog-header h2 {
    font-size: 1rem;
  }

  .expanded-sample-content {
    padding: 1rem;
    font-size: 0.72rem;
  }
}