:root {
  --bg: #e6ebf1;
  --surface: #ffffff;
  --text: #1c1c1e;
  --muted: #6d7b8a;
  --border: #d7dee8;
  --accent: #2aabee;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
  --lane-gutter: 90px;
}

* {
  box-sizing: border-box;
}

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

body {
  display: flex;
  flex-direction: column;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
}

h1, h2 {
  margin: 0;
  font-weight: 600;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.session-field {
  margin-left: auto;
}

.session-field span {
  display: none;
}

.tabs {
  display: flex;
  gap: 8px;
}

.tab {
  border: 1px solid var(--border);
  background: #f7f9fc;
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
}

.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

main {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

#panel-transcript {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: nowrap;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.field.grow {
  flex: 1;
  min-width: 220px;
}

select,
input[type="search"] {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  background: var(--surface);
}

.search-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.search-row input[type="search"] {
  flex: 1;
  min-width: 0;
}

#speaker-toggle {
  width: 42px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  color: var(--muted);
}

#speaker-toggle[aria-expanded="true"] {
  background: #eef6fc;
  color: var(--accent);
}

.speaker-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.speaker-filters[hidden] {
  display: none !important;
}

.speaker-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13px;
}

.speaker-chip input {
  accent-color: var(--accent);
}

.timeline-panel {
  width: 100%;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 8px 16px;
  flex-shrink: 0;
}

.timeline-panel.is-nav .lane-segment {
  cursor: pointer;
}

.timeline-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.zoom-controls button,
.pager button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f7f9fc;
  cursor: pointer;
  font-size: 16px;
}

.timeline-scroll {
  overflow-x: auto;
  overflow-y: hidden;
}

.timeline-scale {
  min-width: 100%;
}

.timeline-stripes {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lane {
  display: grid;
  grid-template-columns: var(--lane-gutter) 1fr;
  align-items: center;
}

.lane-gutter {
  width: var(--lane-gutter);
  flex: 0 0 var(--lane-gutter);
}

.lane-label {
  position: sticky;
  left: 0;
  z-index: 2;
  padding-right: 8px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--surface);
}

.lane-track {
  position: relative;
  height: 18px;
  background: #eef2f7;
  border-radius: 999px;
  overflow: hidden;
}

.lane-segment {
  position: absolute;
  top: 2px;
  bottom: 2px;
  border-radius: 999px;
  cursor: default;
}

.lane-segment.gray {
  filter: grayscale(1);
}

.slider-row {
  display: grid;
  grid-template-columns: var(--lane-gutter) 1fr;
  align-items: center;
  margin-top: 8px;
}

.range-label {
  font-size: 12px;
  color: var(--muted);
}

.dual-range {
  position: relative;
  height: 28px;
}

.dual-range input[type="range"] {
  position: absolute;
  left: 0;
  right: 0;
  width: 100%;
  margin: 0;
  background: transparent;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
}

.dual-range input[type="range"]::-webkit-slider-thumb {
  pointer-events: auto;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  box-shadow: var(--shadow);
}

.dual-range input[type="range"]::-moz-range-thumb {
  pointer-events: auto;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  box-shadow: var(--shadow);
}

.chat-viewport {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  flex-shrink: 0;
}

.chat-list {
  padding: 12px;
}

.anchor-block {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.anchor-main {
  min-width: 0;
}

.satellite-rail {
  position: relative;
  min-height: 48px;
}

.turn-card {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 10px;
  align-items: start;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
}

.turn-body {
  min-width: 0;
}

.turn-meta {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 4px;
  font-size: 12px;
}

.speaker-name {
  font-weight: 600;
}

.timestamp {
  color: var(--muted);
}

.bubble {
  background: #f2f7fd;
  border-radius: 12px 12px 12px 4px;
  padding: 10px 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.bubble mark {
  background: #ffe08a;
  padding: 0 2px;
  border-radius: 3px;
}

.satellite-card {
  position: absolute;
  left: 0;
  right: 0;
}

.satellite-card .bubble {
  background: #fff7f0;
  border-radius: 12px 12px 4px 12px;
  font-size: 14px;
}

.turn-card.flash .bubble {
  outline: 2px solid var(--accent);
}

.stub-lead {
  color: var(--muted);
}

#panel-meaning {
  overflow: auto;
}

.coach-note {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  line-height: 1.5;
}

.coach-note h2 {
  font-size: 18px;
  margin-bottom: 10px;
}

.coach-note p {
  margin: 0 0 10px;
}

.coach-note p:last-child {
  margin-bottom: 0;
}

.coach-note .question {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.kpi-note {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  vertical-align: middle;
}

.dot.green { background: #7bc862; }
.dot.yellow { background: #e5ca77; }

.kpi-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.kpi-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 10px;
}

.kpi-stat .val {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.2;
}

.kpi-stat .lbl {
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
}

.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.kpi-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  min-width: 0;
}

.kpi-block h3 {
  font-size: 13px;
  margin-bottom: 8px;
}

.kpi-hint {
  margin: 0 0 8px;
  font-size: 11px;
  color: var(--muted);
}

.share-row {
  display: grid;
  grid-template-columns: 88px 1fr 42px;
  gap: 8px;
  align-items: center;
  margin: 5px 0;
  font-size: 12px;
}

.share-bar {
  height: 12px;
  background: #eef2f7;
  border-radius: 999px;
  overflow: hidden;
}

.share-bar > i {
  display: block;
  height: 100%;
}

.share-bar.split {
  display: flex;
}

.share-bar.split i {
  height: 100%;
}

.tempo-person {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 8px;
  align-items: center;
  margin: 4px 0;
  font-size: 12px;
}

.tempo-person .tempo-svg {
  height: 36px;
}

.window-stack {
  display: flex;
  gap: 4px;
  align-items: stretch;
  height: 88px;
}

.window-col {
  flex: 1;
  display: flex;
  flex-direction: column-reverse;
  min-width: 0;
  border-radius: 5px;
  overflow: hidden;
  background: #eef2f7;
}

.window-seg {
  width: 100%;
}

.kpi-table-wrap {
  overflow: auto;
  max-height: 180px;
}

.kpi-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.kpi-table th,
.kpi-table td {
  padding: 4px 6px;
  text-align: left;
  white-space: nowrap;
}

.kpi-table th {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

.interact-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.chip {
  background: #f7f9fc;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
}

.tempo-svg {
  width: 100%;
  height: 90px;
  display: block;
}

#panel-technical {
  display: block;
  overflow: auto;
  min-height: 0;
}

#panel-technical .kpi-note,
#panel-technical .kpi-cards,
#panel-technical .kpi-grid,
#panel-technical .kpi-block {
  flex-shrink: 0;
}

.artifact-list {
  margin: 12px 0 0;
  padding-left: 20px;
  line-height: 1.6;
}

@media (max-width: 900px) {
  .anchor-block {
    grid-template-columns: 1fr;
  }

  .satellite-rail {
    margin-left: 50px;
  }

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