:root {
  color: #172126;
  background: #f5f7f8;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  background: #234f68;
  color: white;
  cursor: pointer;
  padding: 0.65rem 0.9rem;
}

button:hover {
  background: #183d52;
}

a {
  color: #234f68;
}

audio {
  width: 100%;
}

code {
  background: #edf1f2;
  border-radius: 4px;
  padding: 0.1rem 0.25rem;
}

.topbar {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid #d9e1e5;
  display: flex;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
}

.brand {
  color: #172126;
  font-weight: 700;
  text-decoration: none;
}

.topnav {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  justify-content: flex-end;
}

.topnav a {
  color: #234f68;
  font-weight: 650;
  text-decoration: none;
}

.topnav a:hover {
  text-decoration: underline;
}

.main {
  margin: 0 auto;
  max-width: 1120px;
  padding: 1.5rem;
}

.app-shell {
  display: grid;
  gap: 1rem;
}

.toolbar,
.recording header,
.track-head {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
}

.toolbar-actions,
.recording-actions,
.transport-controls {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: flex-end;
}

.recording-actions {
  color: #566871;
  font-weight: 650;
}

.button-link {
  background: #234f68;
  border-radius: 6px;
  color: #ffffff;
  display: inline-flex;
  font-weight: 700;
  justify-content: center;
  line-height: 1;
  padding: 0.72rem 0.9rem;
  text-decoration: none;
}

.button-link:hover {
  background: #183d52;
  text-decoration: none;
}

.button-link.secondary,
.transport-controls button:nth-child(n + 2) {
  background: #eaf0f2;
  color: #234f68;
}

.button-link.secondary:hover,
.transport-controls button:nth-child(n + 2):hover {
  background: #dce7eb;
}

.toolbar h1,
.panel h2,
.recording h2 {
  margin: 0;
}

.eyebrow,
.muted {
  color: #65757d;
  margin: 0;
}

.eyebrow {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.panel,
.recording {
  background: #ffffff;
  border: 1px solid #d9e1e5;
  border-radius: 8px;
  padding: 1rem;
}

.form-grid,
.status-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

label {
  display: grid;
  gap: 0.35rem;
}

label span,
.status-grid span {
  color: #566871;
  font-size: 0.85rem;
}

input {
  border: 1px solid #c7d2d8;
  border-radius: 6px;
  padding: 0.6rem 0.7rem;
  width: 100%;
}

.drop-zone {
  border: 2px dashed #93a8b2;
  border-radius: 8px;
  margin: 1rem 0;
  padding: 1.25rem;
  text-align: center;
}

.upload-list,
.mini-list,
.failure-list,
.tracks,
.recordings {
  display: grid;
  gap: 0.75rem;
}

.upload-entry,
.mini-list div {
  align-items: center;
  display: flex;
  gap: 0.75rem;
}

.mini-list .error-row {
  align-items: flex-start;
}

.error-row code {
  flex: 0 0 auto;
}

.error-row button {
  flex: 0 0 auto;
}

.error-reason {
  flex: 1;
  max-height: 7rem;
  overflow: auto;
  white-space: pre-wrap;
}

.failure-card {
  border-top: 1px solid #e1e7ea;
  display: grid;
  gap: 0.75rem;
  padding-top: 0.85rem;
}

.failure-card:first-child {
  border-top: 0;
  padding-top: 0;
}

.failure-card header,
.failure-meta,
.result-meta {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
}

.failure-meta,
.result-meta {
  color: #566871;
  font-size: 0.86rem;
}

.result-meta {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.asr-result-block {
  display: grid;
  gap: 0.5rem;
}

.failure-reason {
  background: #fff5f5;
  border-radius: 6px;
  color: #9b2c2c;
  margin: 0;
  max-height: 7rem;
  overflow: auto;
  padding: 0.75rem;
  white-space: pre-wrap;
}

.upload-entry progress {
  flex: 1;
}

.status-grid div {
  background: #f5f7f8;
  border-radius: 6px;
  display: grid;
  gap: 0.25rem;
  padding: 0.75rem;
}

.status-grid strong {
  overflow-wrap: anywhere;
}

.recording {
  display: grid;
  gap: 1rem;
}

.session-index-card {
  gap: 0.75rem;
}

.session-id-block {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.session-id-block h2 {
  font-size: 1.45rem;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.speaker-name-list {
  border-left: 3px solid #d9e1e5;
  display: grid;
  gap: 0.45rem;
  list-style: none;
  margin: 0 0 0 1.15rem;
  padding: 0.15rem 0 0.15rem 1rem;
}

.speaker-name-list li {
  color: #172126;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
}

.session-page {
  gap: 1rem;
}

.session-summary {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.session-summary div {
  background: #ffffff;
  border: 1px solid #d9e1e5;
  border-radius: 8px;
  display: grid;
  gap: 0.35rem;
  min-width: 0;
  padding: 0.9rem 1rem;
}

.session-summary span {
  color: #566871;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.session-summary strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-tool {
  background: #ffffff;
  border: 1px solid #d9e1e5;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.timeline-control-bar {
  align-items: center;
  border-bottom: 1px solid #d9e1e5;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  padding: 0.85rem;
}

.timeline-control-bar output {
  background: #f3f6f7;
  border: 1px solid #d9e1e5;
  border-radius: 6px;
  color: #172126;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  min-width: 9.5rem;
  padding: 0.55rem 0.7rem;
  text-align: center;
}

.timeline-frame {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
}

.timeline-labels {
  background: #f7fafb;
  border-right: 1px solid #d9e1e5;
}

.timeline-label-spacer {
  border-bottom: 1px solid #d9e1e5;
  height: 36px;
}

.timeline-speaker {
  border-bottom: 1px solid #e1e7ea;
  display: grid;
  gap: 0.22rem;
  height: 76px;
  min-width: 0;
  padding: 0.9rem 0.85rem;
}

.timeline-speaker strong,
.timeline-speaker span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-speaker span {
  color: #65757d;
  font-size: 0.84rem;
}

.timeline-scroll {
  cursor: crosshair;
  overflow: auto;
}

.timeline-canvas {
  background:
    linear-gradient(to right, rgba(35, 79, 104, 0.06) 1px, transparent 1px) 0 36px /
      var(--timeline-grid-step, 70px) 76px,
    #ffffff;
  min-width: 100%;
  position: relative;
}

.time-ruler {
  background: #fbfcfd;
  border-bottom: 1px solid #d9e1e5;
  height: 36px;
  position: relative;
}

.time-tick {
  border-left: 1px solid #d9e1e5;
  bottom: 0;
  position: absolute;
  top: 0;
}

.time-tick span {
  color: #65757d;
  font-size: 0.78rem;
  left: 0.4rem;
  position: absolute;
  top: 0.55rem;
  white-space: nowrap;
}

.timeline-rows {
  position: relative;
}

.timeline-row {
  border-bottom: 1px solid #e1e7ea;
  height: 76px;
  position: relative;
}

.timeline-lane {
  height: 100%;
  position: relative;
}

.timeline-segment {
  color: #17212b;
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1;
  overflow: visible;
  padding: 0;
  position: absolute;
  top: 31px;
  white-space: nowrap;
}

.lane-empty {
  color: #7a5200;
  font-size: 0.86rem;
  left: 0.75rem;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.timeline-playhead {
  bottom: 0;
  cursor: ew-resize;
  left: 0;
  outline: none;
  position: absolute;
  top: 0;
  width: 0;
  z-index: 10;
}

.timeline-playhead::before {
  background: #b62935;
  bottom: 0;
  content: "";
  left: -1px;
  position: absolute;
  top: 0;
  width: 2px;
}

.timeline-playhead span {
  background: #b62935;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(23, 33, 38, 0.22);
  display: block;
  height: 22px;
  left: -10px;
  position: absolute;
  top: 7px;
  width: 20px;
}

.timeline-playhead:focus span,
.timeline-playhead.dragging span {
  outline: 3px solid rgba(182, 41, 53, 0.22);
}

.timeline-audio-bank {
  height: 1px;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  position: absolute;
  width: 1px;
}

.other-fields {
  background: #f5f7f8;
  border-radius: 6px;
  margin: 0;
  padding: 0.75rem;
  white-space: pre-wrap;
}

.track {
  border-top: 1px solid #e1e7ea;
  display: grid;
  gap: 0.6rem;
  padding-top: 0.85rem;
}

.badge {
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.25rem 0.55rem;
}

.badge.done {
  background: #d9f0e5;
  color: #11633d;
}

.badge.needed {
  background: #fff1cc;
  color: #7a5200;
}

.transcript-preview {
  line-height: 1.5;
  margin: 0;
}

.errors span {
  color: #9b2c2c;
}

.upload-error {
  color: #9b2c2c;
  margin: 0;
}

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  min-width: 900px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid #e1e7ea;
  padding: 0.65rem;
  text-align: left;
  vertical-align: top;
}

th {
  color: #566871;
  font-size: 0.82rem;
  text-transform: uppercase;
}

td code {
  overflow-wrap: anywhere;
}

td audio {
  min-width: 220px;
}

pre {
  background: #f5f7f8;
  border-radius: 6px;
  max-height: 360px;
  overflow: auto;
  padding: 0.75rem;
}

.login-body {
  background: #f5f7f8;
  min-height: 100vh;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  padding: 1.5rem;
  place-items: center;
}

.login-form {
  background: #ffffff;
  border: 1px solid #d9e1e5;
  border-radius: 8px;
  display: grid;
  gap: 1rem;
  max-width: 360px;
  padding: 1.25rem;
  width: 100%;
}

.login-form h1 {
  font-size: 1.45rem;
  margin: 0.15rem 0 0;
}

.login-error {
  background: #fff0f0;
  border: 1px solid #efb4b4;
  border-radius: 6px;
  color: #8f1d1d;
  margin: 0;
  padding: 0.65rem 0.75rem;
}

@media (max-width: 760px) {
  .main {
    padding: 1rem;
  }

  .toolbar,
  .recording header,
  .timeline-control-bar {
    align-items: flex-start;
    display: grid;
  }

  .toolbar-actions,
  .recording-actions,
  .transport-controls {
    justify-content: flex-start;
  }

  .session-summary {
    grid-template-columns: 1fr;
  }

  .timeline-frame {
    grid-template-columns: 128px minmax(0, 1fr);
  }

  .timeline-speaker {
    padding: 0.85rem 0.65rem;
  }
}
