:root {
  color-scheme: light;
  --ink: #18201e;
  --muted: #68716e;
  --line: #dfe5e2;
  --line-strong: #c8d1cd;
  --paper: #f6f8f7;
  --surface: #ffffff;
  --surface-subtle: #eef2f0;
  --accent: #185f4b;
  --accent-hover: #104c3c;
  --accent-soft: #dcebe5;
  --danger: #9d3f38;
  --focus: #2583d8;
  --shadow: 0 16px 46px rgb(28 45 39 / 8%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 1080px;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus), transparent 55%);
  outline-offset: 2px;
}

.app-shell {
  width: min(1640px, calc(100% - 48px));
  margin: 0 auto;
  padding: 22px 0 48px;
}

.topbar,
.filebar,
.section-heading,
.header-actions,
.file-actions,
.selection-actions,
.brand,
.file-identity {
  display: flex;
  align-items: center;
}

.topbar,
.filebar,
.section-heading {
  justify-content: space-between;
}

.topbar {
  min-height: 64px;
  margin-bottom: 20px;
}

.brand {
  gap: 12px;
}

.brand__mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 11px;
  color: #fff;
  background: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 19px;
  letter-spacing: -.025em;
}

h2 {
  font-size: 20px;
  letter-spacing: -.025em;
}

.eyebrow {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .13em;
}

.button,
.text-button {
  border: 0;
  cursor: pointer;
}

.button {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 700;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}

.button:hover {
  border-color: #aeb9b4;
  background: #f9fbfa;
}

.button:active {
  transform: translateY(1px);
}

.button--primary {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.button--primary:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
}

.button--large {
  min-height: 46px;
  padding: 10px 20px;
  font-size: 14px;
}

.button--small {
  min-height: 32px;
  padding: 5px 10px;
  font-size: 12px;
}

.button--danger {
  border-color: #e4c9c6;
  color: var(--danger);
}

.text-button {
  padding: 5px;
  color: var(--accent);
  background: transparent;
  font-size: 12px;
  font-weight: 750;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
}

.text-button:hover {
  text-decoration-color: currentColor;
}

.header-actions,
.file-actions,
.selection-actions {
  gap: 8px;
}

.upload-view {
  min-height: calc(100vh - 140px);
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 48px 0 8vh;
}

.drop-zone {
  width: min(690px, 90vw);
  padding: 72px 48px;
  border: 2px dashed #b9c6c0;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}

.drop-zone:hover,
.drop-zone.is-dragging {
  border-color: var(--accent);
  background: #fbfdfc;
  transform: translateY(-2px);
}

.drop-zone__badge {
  display: inline-grid;
  width: 58px;
  height: 66px;
  margin-bottom: 22px;
  place-items: center;
  border: 1px solid #bad2c9;
  border-radius: 10px 10px 14px 10px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .08em;
}

.drop-zone h2 {
  margin-bottom: 7px;
  font-size: 30px;
}

.drop-zone p {
  margin-bottom: 26px;
  color: var(--muted);
}

.privacy-note {
  display: block;
  margin-top: 18px;
  color: var(--muted);
  font-size: 12px;
}

.upload-view > .text-button {
  margin-top: 16px;
}

.paste-panel {
  display: grid;
  width: min(690px, 90vw);
  gap: 9px;
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
}

.paste-panel label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.paste-panel textarea {
  width: 100%;
  min-height: 96px;
  padding: 11px 12px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink);
  background: #fbfcfb;
  line-height: 1.5;
}

.paste-panel .button {
  justify-self: end;
}

.drop-overlay {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: none;
  place-items: center;
  background: rgb(15 50 41 / 74%);
  backdrop-filter: blur(5px);
}

.drop-overlay.is-visible {
  display: grid;
}

.drop-overlay__card {
  display: grid;
  width: 340px;
  height: 210px;
  place-items: center;
  align-content: center;
  gap: 12px;
  border: 2px dashed #fff;
  border-radius: 20px;
  color: #fff;
  font-size: 20px;
}

.drop-overlay__icon {
  font-size: 48px;
  line-height: 1;
}

.workspace {
  display: grid;
  gap: 14px;
}

.filebar,
.timeline-card,
.transcript-card,
.detail-panel {
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: 0 2px 10px rgb(31 50 43 / 3%);
}

.filebar {
  min-height: 68px;
  padding: 12px 18px;
}

.file-identity {
  gap: 10px;
}

.file-identity strong,
.file-identity span {
  display: block;
}

.file-identity strong {
  max-width: 520px;
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-identity span {
  color: var(--muted);
  font-size: 11px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #2fa06f;
  box-shadow: 0 0 0 4px #e0f3ea;
}

.view-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #eaeeec;
}

.view-tab {
  flex: 1;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .045em;
}

.view-tab:hover {
  color: var(--ink);
  background: rgb(255 255 255 / 55%);
}

.view-tab[aria-selected="true"] {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 2px 9px rgb(35 53 47 / 10%);
}

.view-tab__count {
  display: inline-grid;
  min-width: 19px;
  height: 19px;
  margin-left: 6px;
  place-items: center;
  border-radius: 99px;
  color: var(--muted);
  background: var(--surface-subtle);
  font-size: 10px;
}

.timeline-card {
  padding: 14px 18px 16px;
}

.section-heading {
  min-height: 47px;
  gap: 16px;
  padding: 0 2px 13px;
}

.section-heading--compact {
  min-height: 38px;
  padding-bottom: 8px;
}

.section-heading--compact h2 {
  font-size: 15px;
}

.timeline {
  padding: 2px 0 0;
}

.timeline-track {
  position: relative;
  height: 30px;
  overflow: hidden;
  border-radius: 7px;
  background: #e6ebe8;
}

.timeline-track + .timeline-track {
  margin-top: 5px;
}

.timeline-segment {
  position: absolute;
  top: 0;
  bottom: 0;
  min-width: 2px;
  border: 0;
  border-right: 2px solid rgb(255 255 255 / 80%);
  cursor: pointer;
  color: #26322f;
  font-size: 10px;
  font-weight: 800;
  text-align: left;
  white-space: nowrap;
}

.timeline-segment:hover,
.timeline-segment.is-selected {
  z-index: 2;
  filter: saturate(1.18) brightness(.98);
  box-shadow: inset 0 0 0 2px rgb(24 32 30 / 45%);
}

.timeline-segment span {
  display: block;
  overflow: hidden;
  padding: 7px 8px;
  text-overflow: ellipsis;
}

.timeline-axis {
  position: relative;
  height: 21px;
  margin-top: 5px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 10px;
}

.timeline-axis span {
  position: absolute;
  transform: translateX(-50%);
  white-space: nowrap;
}

.timeline-axis span:first-child {
  transform: none;
}

.timeline-axis span:last-child {
  transform: translateX(-100%);
}

.timeline-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px 12px;
  color: var(--muted);
  font-size: 10px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.work-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  align-items: start;
  gap: 14px;
}

.transcript-card {
  min-width: 0;
  padding: 16px 18px 20px;
}

.transcript {
  display: grid;
  gap: 5px;
}

.caption-block {
  position: relative;
  display: grid;
  grid-template-columns: 95px minmax(0, 1fr);
  min-height: 48px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #f1f3f2;
  cursor: pointer;
  width: 100%;
  padding: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  transition: border-color .12s ease, box-shadow .12s ease, transform .12s ease;
}

.caption-block:hover {
  z-index: 1;
  border-color: rgb(35 54 47 / 27%);
  box-shadow: 0 3px 12px rgb(30 49 42 / 8%);
  transform: translateX(2px);
}

.caption-block.is-selected-clip {
  border-color: #25342f;
  box-shadow: inset 4px 0 0 #25342f;
}

.caption-block.is-manual-selected {
  border-color: var(--focus);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--focus), transparent 35%);
}

.caption-time {
  display: flex;
  align-items: flex-start;
  padding: 14px 10px 10px 12px;
  color: rgb(39 52 48 / 67%);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 10px;
  font-weight: 700;
}

.caption-text {
  padding: 11px 42px 11px 8px;
  font-size: 14px;
  line-height: 1.68;
  white-space: pre-line;
}

.clip-start-badges {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 3px;
}

.clip-badge {
  display: grid;
  min-width: 24px;
  height: 21px;
  padding: 0 6px;
  place-items: center;
  border: 1px solid rgb(31 45 41 / 16%);
  border-radius: 5px;
  color: #25302d;
  background: rgb(255 255 255 / 78%);
  font-size: 9px;
  font-weight: 850;
}

.view-message {
  margin-bottom: 12px;
  padding: 11px 13px;
  border: 1px solid #d8dfdc;
  border-radius: 8px;
  color: #53615d;
  background: #f2f5f4;
  font-size: 12px;
}

.view-message.is-estimated {
  border-color: #e4d29a;
  color: #6b5823;
  background: #fff8df;
}

.detail-panel {
  position: sticky;
  top: 14px;
  max-height: calc(100vh - 28px);
  overflow-y: auto;
  padding: 18px;
  scrollbar-width: thin;
}

.detail-empty {
  min-height: 280px;
  display: grid;
  place-items: center;
  align-content: center;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.detail-empty strong {
  margin-bottom: 6px;
  color: var(--ink);
}

.clip-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 13px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .1em;
}

.clip-kicker__swatch {
  width: 11px;
  height: 11px;
  border-radius: 3px;
}

.field {
  display: grid;
  gap: 5px;
  margin-bottom: 14px;
}

.field label,
.detail-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .075em;
  text-transform: uppercase;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink);
  background: #fbfcfb;
}

.field input,
.field select {
  min-height: 39px;
  padding: 8px 10px;
}

.field textarea {
  min-height: 70px;
  padding: 9px 10px;
  resize: vertical;
  line-height: 1.45;
}

.field textarea[readonly] {
  min-height: 142px;
  color: #37433f;
  background: #f4f6f5;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 2px 0 15px;
}

.metric {
  padding: 8px 7px;
  border-radius: 7px;
  background: var(--surface-subtle);
}

.metric span,
.metric strong {
  display: block;
}

.metric span {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  text-transform: uppercase;
}

.metric strong {
  overflow: hidden;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
  text-overflow: ellipsis;
}

.quote-block,
.reason-block,
.variation-block {
  margin-bottom: 13px;
  padding: 10px;
  border-left: 3px solid #bbc6c2;
  border-radius: 0 7px 7px 0;
  color: #3d4945;
  background: #f5f7f6;
  font-size: 12px;
}

.quote-block p + p,
.variation-block p + p {
  margin-top: 8px;
}

.detail-copy-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 16px;
}

.detail-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.toast {
  position: fixed;
  z-index: 200;
  right: 22px;
  bottom: 22px;
  max-width: 380px;
  padding: 11px 15px;
  border-radius: 9px;
  color: #fff;
  background: #26342f;
  box-shadow: 0 10px 28px rgb(0 0 0 / 20%);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity .18s ease, transform .18s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.is-error {
  background: var(--danger);
}

[hidden] {
  display: none !important;
}

@media (max-width: 1240px) {
  .work-grid {
    grid-template-columns: minmax(0, 1fr) 350px;
  }

  .caption-block {
    grid-template-columns: 84px minmax(0, 1fr);
  }
}

@media print {
  body {
    min-width: 0;
    background: #fff;
  }

  .topbar,
  .file-actions,
  .header-actions,
  .selection-actions,
  .detail-copy-row,
  .detail-footer {
    display: none !important;
  }

  .app-shell {
    width: 100%;
    padding: 0;
  }

  .work-grid {
    grid-template-columns: 2fr 1fr;
  }

  .detail-panel {
    position: static;
    max-height: none;
  }
}
