:root {
  --paper: #f4efe5;
  --paper-dark: #e8decc;
  --ink: #21201f;
  --accent: #9d3f24;
  --accent-soft: #d67f54;
  --success: #23673a;
  --warning: #8a6c13;
  --danger: #7a1b1b;
  --muted: #5f5b54;
  --line: #d2c5b0;
  --card: rgba(255, 252, 246, 0.9);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 10%, #fff9ef, transparent 35%),
    radial-gradient(circle at 85% 30%, #f9e9d5, transparent 30%),
    linear-gradient(180deg, var(--paper), var(--paper-dark));
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, serif;
  line-height: 1.45;
}

.container {
  width: min(1200px, 92vw);
  margin: 0 auto;
}

.topbar {
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(3px);
  background: rgba(255, 251, 243, 0.88);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-inner {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  font-size: 1.3rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--accent);
  letter-spacing: 0.04em;
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-link {
  color: var(--ink);
  text-decoration: none;
}

.link-button {
  border: 0;
  padding: 0;
  background: none;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
}

.page {
  padding: 1.5rem 0 2rem;
  animation: fade-in 220ms ease-in;
}

.hero {
  margin-bottom: 1rem;
}

.hero h1 {
  margin-bottom: 0.4rem;
}

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

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  box-shadow: 0 8px 24px rgba(34, 26, 15, 0.07);
}

.auth-card {
  max-width: 460px;
  margin: 5vh auto;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.transcript-card h2 {
  margin-top: 0;
}

.list-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.filter-panel h2 {
  margin-top: 0;
}

.filter-tag-list {
  display: grid;
  gap: 0.5rem;
  max-height: 60vh;
  overflow: auto;
  padding-right: 0.2rem;
}

.filter-group {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffaf2;
}

.filter-group-title {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.6rem;
  font-weight: 600;
}

.filter-group-title::-webkit-details-marker {
  margin-right: 0.3rem;
}

.filter-group-indicator {
  color: var(--muted);
  transition: transform 160ms ease;
}

.filter-group[open] .filter-group-indicator {
  transform: rotate(180deg);
}

.filter-tag-group-list {
  display: grid;
  gap: 0.35rem;
  padding: 0 0.5rem 0.45rem;
}

.filter-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.filter-tag-choice {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.2rem;
  padding: 0.1rem 0.2rem;
}

.filter-tag-choice input[type="checkbox"] {
  width: auto;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  margin: 0;
}

.list-main {
  display: grid;
  gap: 1rem;
}

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

.trial-column {
  padding: 0;
  overflow: hidden;
}

.trial-column-title {
  margin: 0;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--line);
  font-size: 1.1rem;
  background: #f8f1e4;
}

.day-list {
  display: grid;
  gap: 0;
}

.day-list-item {
  padding: 0.95rem 1rem;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 0.5rem;
}

.day-list-item.is-hidden {
  display: none;
}

.day-list-item:last-child {
  border-bottom: 0;
}

.day-title {
  margin: 0;
  font-size: 1.05rem;
}

.meta-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.meta-tag {
  --tag-bg: #6b7280;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
  background: var(--tag-bg);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2) inset;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.detail-header-main h1 {
  margin-top: 0;
  margin-bottom: 0.35rem;
}

.detail-header-actions {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
}

.two-col {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1rem;
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.8rem;
}

.history-item {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 0.65rem;
}

.table-wrap {
  overflow: auto;
}

.user-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

.user-table th,
.user-table td {
  text-align: left;
  padding: 0.55rem 0.5rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.user-table th {
  font-size: 0.92rem;
  color: var(--muted);
  background: #faf4e9;
}

.note {
  margin-top: 0.35rem;
  color: var(--ink);
}

.transcript-body {
  margin: 0;
  white-space: pre-wrap;
  max-height: 72vh;
  overflow: auto;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.9rem;
}

.transcript-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 1rem;
}

.bookmark-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffdf8;
  padding: 0.8rem;
  position: sticky;
  top: 84px;
  align-self: start;
  max-height: calc(100vh - 110px);
  overflow: auto;
}

.bookmark-panel h3 {
  margin: 0 0 0.6rem;
}

.bookmark-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}

.bookmark-item {
  padding-left: calc(var(--bookmark-level, 0) * 0.95rem);
}

.bookmark-link {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.5rem;
  text-decoration: none;
  color: inherit;
  background: #fffaf1;
  display: block;
}

.bookmark-level-0 .bookmark-link {
  font-weight: 700;
}

.bookmark-item:not(.bookmark-level-0) .bookmark-link {
  border-left: 4px solid #d0c0a6;
  font-size: 0.95rem;
}

.bookmark-link:hover {
  border-color: #bba78b;
  background: #fff5e6;
}

.bookmark-link-missing {
  opacity: 0.65;
}

.transcript-body-lines {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffdf8;
  padding: 0.4rem 0.8rem;
}

.transcript-line {
  display: block;
  padding: 0.08rem 0;
  scroll-margin-top: 92px;
}

.transcript-line:target {
  background: #fff5d6;
}

.transcript-line-text {
  display: block;
  font-family: "Courier New", Courier, monospace;
  white-space: pre-wrap;
  word-break: normal;
  overflow-wrap: break-word;
}

.stack {
  display: grid;
  gap: 0.65rem;
}

.search-row {
  display: flex;
  gap: 0.75rem;
}

.form-input,
.stack input,
.stack textarea,
.stack select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffdf9;
  padding: 0.65rem 0.75rem;
  color: var(--ink);
  font: inherit;
}

.transcript-editor {
  min-height: 50vh;
  font-family: "Courier New", Courier, monospace;
}

.tag-fieldset {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem;
}

.tag-fieldset legend {
  padding: 0 0.25rem;
  color: var(--muted);
}

.tag-editor-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.85rem;
}

.tag-choice {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.35rem;
  border-radius: 6px;
}

.current-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.6rem;
  margin-bottom: 0.55rem;
}

.current-tag-choice {
  background: #fff8eb;
  border: 1px dashed var(--line);
  padding: 0.28rem 0.38rem;
}

.current-tag-button {
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.current-tag-button .meta-tag {
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.current-tag-button:hover .meta-tag {
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.28) inset;
}

.current-tag-remove {
  color: var(--muted);
  font-size: 0.86rem;
}

.btn {
  display: inline-block;
  border: 1px solid transparent;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  color: #fff;
  text-decoration: none;
  font: inherit;
  font-weight: 600;
  padding: 0.55rem 1rem;
  cursor: pointer;
}

.btn-small {
  padding: 0.45rem 0.85rem;
  font-size: 0.95rem;
}

.btn-muted {
  background: #e8dfcf;
  color: #2f2c29;
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #b13b3b);
}

.action-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.inline-form {
  margin: 0;
}

.rename-form {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.rename-input {
  width: 12rem;
  min-width: 0;
  padding: 0.4rem 0.6rem;
}

.pill {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8f1e4;
  padding: 0.2rem 0.65rem;
  font-size: 0.88rem;
}

.pager {
  margin: 1rem 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
}

.alerts {
  margin-bottom: 1rem;
  display: grid;
  gap: 0.4rem;
}

.alert {
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 0.55rem 0.7rem;
}

.alert-success {
  border-color: #8fc8a1;
  background: #eefaf2;
  color: var(--success);
}

.alert-warning {
  border-color: #d6bf7a;
  background: #fff8e1;
  color: var(--warning);
}

.alert-error {
  border-color: #d9a0a0;
  background: #fdecec;
  color: var(--danger);
}

.alert-info {
  border-color: #91b1c7;
  background: #edf6fc;
}

.diff-view {
  margin: 0;
  overflow: auto;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #1e1d1a;
  color: #f8f1e3;
  padding: 0.8rem;
  white-space: pre-wrap;
}

.diff-line {
  display: block;
}

.diff-add {
  background: rgba(84, 189, 110, 0.28);
}

.diff-remove {
  background: rgba(233, 84, 84, 0.28);
}

.diff-meta {
  color: #f2c979;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .trial-board {
    grid-template-columns: 1fr;
  }

  .list-layout {
    grid-template-columns: 1fr;
  }

  .detail-header {
    flex-direction: column;
  }

  .detail-header-actions {
    margin-left: 0;
    align-items: flex-start;
  }

  .transcript-detail-layout {
    grid-template-columns: 1fr;
  }

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

/* Transcript viewer */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.transcript-viewer-page {
  overflow: hidden;
  background: #aeb0b2;
}

.transcript-viewer-page .topbar {
  z-index: 30;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.72) inset;
}

.viewer-main {
  width: 100%;
  animation: fade-in 180ms ease-out;
}

.viewer-main > .alerts {
  position: fixed;
  top: 74px;
  right: 18px;
  z-index: 60;
  width: min(420px, calc(100vw - 36px));
}

.document-viewer {
  --viewer-blue: #1769d2;
  --viewer-border: #b9bab8;
  --viewer-chrome: #e9e9e7;
  --viewer-sidebar-width: 320px;
  height: calc(100dvh - 63px);
  min-height: 540px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) 25px;
  overflow: hidden;
  color: #202124;
  background: #a9abad;
  font-family: "Avenir Next", Avenir, "Helvetica Neue", sans-serif;
}

.viewer-toolbar {
  min-height: 58px;
  display: grid;
  grid-template-columns: auto minmax(160px, 1fr) auto minmax(240px, 350px) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid #a7a8a6;
  background: linear-gradient(180deg, #f5f5f3 0%, #e3e3e0 52%, #d8d8d5 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.88) inset,
    0 1px 4px rgba(0, 0, 0, 0.14);
  z-index: 15;
}

.viewer-toolbar-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.viewer-navigation-controls {
  padding-right: 8px;
  border-right: 1px solid rgba(0, 0, 0, 0.12);
}

.viewer-icon-button,
.viewer-zoom-value,
.viewer-edit-button {
  min-height: 30px;
  border: 1px solid #b8b9b7;
  border-radius: 7px;
  color: #292a2d;
  background: linear-gradient(#fdfdfc, #e5e5e2);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 1px 1px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  font: 600 0.78rem/1 "Avenir Next", Avenir, sans-serif;
}

.viewer-icon-button {
  width: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  flex: 0 0 auto;
}

.viewer-icon-button:hover,
.viewer-zoom-value:hover,
.viewer-edit-button:hover {
  border-color: #999a98;
  background: linear-gradient(#fff, #ededeb);
}

.viewer-icon-button:active,
.viewer-zoom-value:active,
.viewer-edit-button:active {
  background: #d5d5d2;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12) inset;
}

.viewer-icon-button:focus-visible,
.viewer-zoom-value:focus-visible,
.viewer-edit-button:focus-visible,
.viewer-search input:focus-visible,
.viewer-search button:focus-visible,
.viewer-bookmark-link:focus-visible {
  outline: 3px solid rgba(23, 105, 210, 0.28);
  outline-offset: 1px;
}

.viewer-icon-button svg,
.viewer-search svg,
.viewer-search button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.viewer-actions-menu summary svg circle {
  fill: currentColor;
  stroke: none;
}

.viewer-document-identity {
  min-width: 0;
  display: grid;
  justify-items: center;
  line-height: 1.12;
}

.viewer-document-title {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.86rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.viewer-document-subtitle {
  margin-top: 3px;
  color: #6d6e70;
  font-size: 0.69rem;
  white-space: nowrap;
}

.viewer-zoom-controls {
  gap: 0;
}

.viewer-zoom-controls .viewer-icon-button {
  border-radius: 0;
}

.viewer-zoom-controls .viewer-icon-button:first-child {
  border-radius: 7px 0 0 7px;
}

.viewer-zoom-controls .viewer-icon-button:last-child {
  border-radius: 0 7px 7px 0;
}

.viewer-zoom-value {
  min-width: 54px;
  padding: 0 7px;
  border-left: 0;
  border-right: 0;
  border-radius: 0;
  font-variant-numeric: tabular-nums;
}

.viewer-search {
  height: 32px;
  min-width: 0;
  display: grid;
  grid-template-columns: 19px minmax(80px, 1fr) auto 27px 27px;
  align-items: center;
  gap: 3px;
  padding: 0 3px 0 8px;
  border: 1px solid #b2b3b1;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.08) inset,
    0 1px 0 rgba(255, 255, 255, 0.75);
}

.viewer-search > svg {
  width: 16px;
  color: #707174;
}

.viewer-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  padding: 0;
  background: transparent;
  color: #242528;
  font: 500 0.78rem/1.2 "Avenir Next", Avenir, sans-serif;
}

.viewer-search input::-webkit-search-cancel-button {
  cursor: pointer;
}

.viewer-search-count {
  color: #6e6f71;
  font-size: 0.67rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.viewer-search button {
  width: 27px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 5px;
  padding: 0;
  color: #55565a;
  background: transparent;
  cursor: pointer;
}

.viewer-search button:hover {
  background: #e5e5e3;
}

.viewer-search button svg {
  width: 14px;
  height: 14px;
}

.viewer-document-actions {
  justify-content: flex-end;
}

.viewer-edit-button {
  min-width: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  text-decoration: none;
  color: #fff;
  border-color: #105bb8;
  background: linear-gradient(#3489ec, #1769d2);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.25) inset,
    0 1px 1px rgba(0, 0, 0, 0.12);
}

.viewer-edit-button:hover {
  border-color: #0d4f9f;
  background: linear-gradient(#4395f1, #1c70db);
}

.viewer-actions-menu {
  position: relative;
}

.viewer-actions-menu summary {
  list-style: none;
}

.viewer-actions-menu summary::-webkit-details-marker {
  display: none;
}

.viewer-actions-popover {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  z-index: 50;
  width: 205px;
  padding: 6px;
  border: 1px solid #b7b7b4;
  border-radius: 9px;
  background: rgba(250, 250, 248, 0.98);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

.viewer-actions-popover a,
.viewer-actions-popover button {
  width: 100%;
  display: block;
  border: 0;
  border-radius: 5px;
  padding: 8px 9px;
  color: #28292c;
  background: transparent;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  font: 500 0.78rem/1.25 "Avenir Next", Avenir, sans-serif;
}

.viewer-actions-popover a:hover,
.viewer-actions-popover button:hover {
  color: #fff;
  background: var(--viewer-blue);
}

.viewer-workspace {
  min-width: 0;
  min-height: 0;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--viewer-sidebar-width);
  overflow: hidden;
  transition: grid-template-columns 180ms ease;
}

.document-viewer:not(.is-sidebar-open) .viewer-workspace {
  grid-template-columns: minmax(0, 1fr) 0;
}

.viewer-canvas {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: #797b7d #b9bbbd;
  background:
    radial-gradient(circle at 50% -15%, rgba(255, 255, 255, 0.24), transparent 42%),
    linear-gradient(115deg, rgba(255, 255, 255, 0.035) 25%, transparent 25%) 0 0 / 5px 5px,
    #a7a9ab;
}

.viewer-canvas:focus {
  outline: none;
}

.viewer-paper-stage {
  width: 820px;
  min-height: 100%;
  margin: 34px auto 72px;
}

.viewer-paper {
  width: 820px;
  min-height: 1060px;
  padding: 54px 64px 82px;
  position: relative;
  color: #202020;
  background:
    linear-gradient(90deg, rgba(103, 81, 44, 0.018), transparent 12%, transparent 88%, rgba(103, 81, 44, 0.018)),
    #fffefa;
  border: 1px solid rgba(64, 64, 60, 0.18);
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.22),
    0 15px 36px rgba(0, 0, 0, 0.18);
  transform-origin: top left;
}

.viewer-paper::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: 0 0 22px rgba(78, 63, 42, 0.035) inset;
}

.viewer-paper-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 42px;
  padding-bottom: 22px;
  border-bottom: 1px solid #d8d3c8;
}

.viewer-paper-kicker,
.viewer-sidebar-kicker {
  margin: 0 0 5px;
  color: #77746d;
  font: 700 0.64rem/1.2 "Avenir Next", Avenir, sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.viewer-paper-header h1 {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  font-size: 1.75rem;
  line-height: 1.12;
  letter-spacing: -0.025em;
}

.viewer-paper-date {
  margin: 7px 0 0;
  color: #66625b;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  font-size: 0.9rem;
}

.viewer-paper-tags {
  max-width: 280px;
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 5px;
}

.viewer-paper-tags .meta-tag {
  padding: 0.16rem 0.48rem;
  font: 650 0.66rem/1.35 "Avenir Next", Avenir, sans-serif;
}

.viewer-transcript-lines {
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
}

.viewer-transcript-lines .transcript-line {
  min-height: 1.56em;
  padding: 0;
  border-radius: 2px;
  scroll-margin: 150px 0 70px;
  transition: background-color 140ms ease, box-shadow 140ms ease;
}

.viewer-transcript-lines .transcript-line-text {
  display: block;
  color: #222;
  font-family: "SFMono-Regular", Menlo, "Courier New", monospace;
  font-size: 0.79rem;
  line-height: 1.56;
  white-space: pre-wrap;
  word-break: normal;
  overflow-wrap: normal;
  tab-size: 4;
}

.viewer-transcript-lines .transcript-line:target {
  background: #ffed9e;
  box-shadow: -8px 0 0 #ffed9e, 8px 0 0 #ffed9e;
}

.viewer-transcript-lines .transcript-line.has-search-match {
  background: rgba(255, 224, 83, 0.28);
}

.viewer-transcript-lines .transcript-line.is-current-search-match {
  background: #ffd84d;
  box-shadow: -8px 0 0 #ffd84d, 8px 0 0 #ffd84d;
}

.viewer-sidebar {
  min-width: 0;
  width: var(--viewer-sidebar-width);
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border-left: 1px solid #a4a5a3;
  background: rgba(243, 243, 241, 0.98);
  box-shadow: 1px 0 0 rgba(255, 255, 255, 0.72) inset;
  opacity: 1;
  visibility: visible;
  transition: opacity 130ms ease, visibility 130ms ease;
}

.document-viewer:not(.is-sidebar-open) .viewer-sidebar {
  width: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.viewer-sidebar-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px 12px 17px;
  border-bottom: 1px solid #c7c7c4;
  background: rgba(250, 250, 248, 0.82);
}

.viewer-sidebar-header h2 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.15;
  letter-spacing: -0.015em;
}

.viewer-sidebar-close {
  display: none;
}

.viewer-bookmark-scroll {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 10px 8px 30px;
  scrollbar-color: #a3a4a2 transparent;
}

.viewer-bookmark-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.viewer-bookmark-item {
  margin: 1px 0;
  padding-left: calc(var(--bookmark-level, 0) * 13px);
}

.viewer-bookmark-link {
  min-height: 32px;
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr);
  align-items: start;
  gap: 7px;
  padding: 7px 9px 7px 8px;
  border-radius: 6px;
  color: #36373a;
  text-decoration: none;
  font-size: 0.76rem;
  line-height: 1.32;
}

.bookmark-level-0 .viewer-bookmark-link {
  margin-top: 5px;
  color: #252629;
  font-weight: 650;
}

.viewer-bookmark-item:not(.bookmark-level-0) .viewer-bookmark-link {
  color: #55565a;
  font-size: 0.73rem;
}

.viewer-bookmark-link:hover {
  background: rgba(0, 0, 0, 0.055);
}

.viewer-bookmark-link.is-active {
  color: #fff;
  background: linear-gradient(180deg, #287ee2, #1769d2);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset;
}

.viewer-bookmark-link.is-missing {
  color: #989996;
  cursor: default;
}

.viewer-bookmark-marker {
  width: 5px;
  height: 5px;
  margin-top: 5px;
  border: 1px solid currentColor;
  border-radius: 50%;
  opacity: 0.65;
}

.bookmark-level-0 .viewer-bookmark-marker {
  background: currentColor;
}

.viewer-bookmark-empty {
  padding: 15px 10px;
  color: #77787a;
  font-size: 0.78rem;
}

.viewer-sidebar-backdrop {
  display: none;
}

.viewer-statusbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  min-height: 25px;
  padding: 0 12px;
  border-top: 1px solid #9fa09e;
  color: #626366;
  background: linear-gradient(#e7e7e4, #d6d6d3);
  font-size: 0.66rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset;
  z-index: 16;
}

.viewer-statusbar > :last-child {
  justify-self: end;
}

@media (max-width: 1180px) {
  .viewer-toolbar {
    grid-template-columns: auto minmax(120px, 1fr) auto minmax(190px, 280px) auto;
  }

  .viewer-document-subtitle {
    display: none;
  }

  .document-viewer {
    --viewer-sidebar-width: 290px;
  }
}

@media (max-width: 1000px) {
  .viewer-toolbar {
    grid-template-columns: auto minmax(100px, 1fr) auto auto;
    grid-template-areas:
      "navigation identity zoom actions"
      "search search search search";
  }

  .viewer-navigation-controls {
    grid-area: navigation;
  }

  .viewer-document-identity {
    grid-area: identity;
  }

  .viewer-zoom-controls {
    grid-area: zoom;
  }

  .viewer-search {
    grid-area: search;
  }

  .viewer-document-actions {
    grid-area: actions;
  }

  .viewer-workspace,
  .document-viewer:not(.is-sidebar-open) .viewer-workspace {
    display: block;
  }

  .viewer-canvas {
    width: 100%;
    height: 100%;
  }

  .viewer-sidebar {
    position: absolute;
    inset: 0 0 0 auto;
    z-index: 25;
    width: min(340px, 88vw);
    transform: translateX(0);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.22);
    transition: transform 180ms ease, visibility 180ms ease;
  }

  .document-viewer:not(.is-sidebar-open) .viewer-sidebar {
    width: min(340px, 88vw);
    opacity: 1;
    transform: translateX(105%);
  }

  .viewer-sidebar-close {
    display: inline-flex;
  }

  .viewer-sidebar-backdrop {
    position: absolute;
    inset: 0;
    z-index: 24;
    width: 100%;
    height: 100%;
    border: 0;
    background: rgba(26, 27, 29, 0.28);
    backdrop-filter: blur(1px);
  }

  .document-viewer.is-sidebar-open .viewer-sidebar-backdrop {
    display: block;
  }
}

@media (max-width: 640px) {
  .transcript-viewer-page .topbar-inner {
    width: 100%;
    min-height: 54px;
    padding: 0 11px;
  }

  .transcript-viewer-page .brand {
    font-size: 1rem;
  }

  .transcript-viewer-page .nav {
    font-size: 0.76rem;
  }

  .transcript-viewer-page .nav > .nav-link,
  .transcript-viewer-page .nav > .pill {
    display: none;
  }

  .document-viewer {
    height: calc(100dvh - 55px);
  }

  .viewer-toolbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "navigation identity actions"
      "search search search";
    gap: 7px;
    padding: 7px 8px;
  }

  .viewer-navigation-controls {
    padding-right: 0;
    border-right: 0;
  }

  .viewer-zoom-controls {
    display: none;
  }

  .viewer-document-title {
    font-size: 0.77rem;
  }

  .viewer-edit-button {
    min-width: 42px;
    padding: 0 9px;
  }

  .viewer-paper-stage {
    margin-top: 14px;
    margin-bottom: 44px;
  }

  .viewer-paper {
    padding-top: 44px;
  }

  .viewer-paper-header {
    margin-bottom: 34px;
  }

  .viewer-status-document {
    visibility: hidden;
  }
}
