:root {
  --bg: #f5f7f8;
  --panel: #ffffff;
  --panel-soft: #eef3f1;
  --ink: #17211d;
  --muted: #66736d;
  --line: #dce4e0;
  --brand: #136f63;
  --brand-strong: #0b5148;
  --accent: #b7791f;
  --danger: #b42318;
  --info: #285b9a;
  --shadow: 0 14px 34px rgba(23, 33, 29, .08);
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 74px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #f7faf9, #e8efed);
}

.login-card {
  width: min(420px, calc(100vw - 32px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-title {
  margin: 0 0 4px;
  font-size: 28px;
}

.login-subtitle {
  margin: 0 0 24px;
  color: var(--muted);
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: var(--sidebar-collapsed-width) minmax(0, 1fr);
}

.sidebar {
  background: #17211d;
  color: #f4f7f6;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-toggle {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 6px;
  background: rgba(255, 255, 255, .08);
  color: #f4f7f6;
  font-size: 20px;
  line-height: 1;
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, .14);
}

.sidebar-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 8px;
  height: 100%;
  cursor: col-resize;
}

.sidebar-resizer::after {
  content: "";
  position: absolute;
  top: 0;
  right: 2px;
  width: 1px;
  height: 100%;
  background: rgba(255, 255, 255, .12);
}

.sidebar-resizing {
  cursor: col-resize;
  user-select: none;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 10px 18px;
  font-size: 19px;
  font-weight: 750;
  min-width: 0;
  flex: 1;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #f6f4f2;
  overflow: hidden;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.brand-label,
.nav-link span,
.nav-section {
  transition: opacity .12s ease;
}

.app-shell.sidebar-collapsed .sidebar {
  padding-left: 10px;
  padding-right: 10px;
}

.app-shell.sidebar-collapsed .sidebar-header {
  align-items: center;
  flex-direction: column;
}

.app-shell.sidebar-collapsed .brand {
  justify-content: center;
  padding: 6px 0 12px;
}

.app-shell.sidebar-collapsed .brand-label,
.app-shell.sidebar-collapsed .nav-link span,
.app-shell.sidebar-collapsed .nav-section {
  opacity: 0;
  pointer-events: none;
  position: absolute;
}

.app-shell.sidebar-collapsed .nav-link {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

.app-shell.sidebar-collapsed .sidebar-toggle {
  transform: rotate(180deg);
}

.app-shell.sidebar-collapsed .sidebar-resizer {
  display: none;
}

.nav-section {
  margin: 12px 0 4px;
  padding: 0 10px;
  color: #aebdb7;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 6px;
  color: #e8efed;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(255, 255, 255, .10);
}

.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.main {
  min-width: 0;
}

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 28px;
  background: rgba(255, 255, 255, .88);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(12px);
}

.search {
  width: min(420px, 42vw);
}

.search input,
input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 38px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
}

textarea {
  min-height: 110px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.content {
  padding: 28px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.page-title {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
}

.page-kicker {
  color: var(--muted);
  margin-top: 5px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.panel,
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 0 rgba(23, 33, 29, .03);
}

.panel {
  padding: 18px;
}

.panel-title {
  margin: 0 0 14px;
  font-size: 16px;
}

.stat {
  padding: 16px;
}

.stat-value {
  font-size: 30px;
  line-height: 1;
  font-weight: 800;
}

.stat-label {
  margin-top: 8px;
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

th {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  background: #f9fbfa;
}

tr:last-child td {
  border-bottom: 0;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 700;
  background: var(--panel-soft);
  color: var(--brand-strong);
}

.badge.warn {
  background: #fff3d8;
  color: #87530d;
}

.badge.info {
  background: #e8f1fb;
  color: var(--info);
}

.badge.danger {
  background: #fee4e2;
  color: var(--danger);
}

.badge.neutral {
  background: #edf0ef;
  color: #53605a;
}

.btn,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 8px 12px;
  background: var(--brand);
  color: white;
  font-weight: 750;
  cursor: pointer;
}

.btn.secondary {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

.btn.danger,
button.danger {
  border-color: #b42318;
  background: #b42318;
  color: #fff;
}

.btn.ghost {
  background: transparent;
  color: var(--ink);
}

.inline-form {
  display: inline-flex;
  margin: 0;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

.filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.filter-bar {
  margin-bottom: 14px;
}

.filter-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 16px 0;
}

.tab {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 7px 11px;
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
}

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

.project-hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.project-hero-main h2 {
  margin: 2px 0 8px;
  font-size: 24px;
}

.project-eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.project-meta-row,
.project-badges,
.project-hero-actions,
.panel-heading-row,
.summary-link-list,
.list-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.project-meta-row {
  color: var(--muted);
  margin-bottom: 10px;
}

.project-meta-row > * + *::before {
  content: "·";
  margin-right: 8px;
  color: var(--muted);
}

.project-hero-actions {
  justify-content: flex-end;
  min-width: 260px;
}

.project-summary-grid .panel {
  min-height: 100%;
}

.metric-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.metric-list div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.metric-list strong {
  display: block;
  font-size: 22px;
}

.metric-list span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.action-list {
  margin: 0;
  padding-left: 18px;
}

.action-list li + li {
  margin-top: 8px;
}

.panel-heading-row {
  justify-content: space-between;
  margin-bottom: 12px;
}

.panel-heading-row .panel-title {
  margin-bottom: 0;
}

.summary-link-list {
  align-items: stretch;
  flex-direction: column;
}

.summary-link-list a,
.list-row {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.summary-link-list a {
  text-decoration: none;
  font-weight: 750;
}

.list-row {
  justify-content: space-between;
  margin-bottom: 8px;
}

.file-group {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.file-group h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.file-category {
  margin-bottom: 12px;
}

.file-category-title,
.timeline-date {
  margin: 12px 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-list.compact {
  grid-template-columns: 130px minmax(0, 1fr);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: start center;
  padding: 8vh 18px 18px;
  background: rgba(16, 24, 20, .42);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-panel {
  width: min(720px, 100%);
  max-height: 84vh;
  overflow: auto;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(23, 33, 29, .22);
}

.modal-header,
.form-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.form-span-2 {
  grid-column: 1 / -1;
}

.form-actions {
  justify-content: flex-start;
  margin-bottom: 0;
}

.detail-list {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 10px 16px;
}

.detail-list dt {
  color: var(--muted);
}

.detail-list dd {
  margin: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.action-stack {
  display: grid;
  gap: 8px;
  min-width: 180px;
}

.inline-upload-form {
  display: grid;
  gap: 6px;
}

.inline-upload-form input[type="file"] {
  max-width: 220px;
}

.field.full {
  grid-column: 1 / -1;
}

.project-form {
  display: grid;
  gap: 20px;
}

.form-section {
  display: grid;
  gap: 14px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.form-section:first-of-type {
  padding-top: 0;
  border-top: 0;
}

.form-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.form-section-header h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.25;
}

.form-section-header p {
  max-width: 520px;
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.hidden-field-errors:empty {
  display: none;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-weight: 750;
}

.helptext {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  margin-top: 7px;
}

.errorlist {
  color: var(--danger);
  margin: 6px 0 0;
  padding-left: 18px;
}

.agency-member-form {
  display: grid;
  gap: 20px;
}

.field-checkbox {
  display: flex;
  align-items: end;
}

.role-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.role-option {
  min-width: 0;
}

.role-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  min-height: 112px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.role-card.is-selected {
  border-color: var(--brand);
  background: #f1faf7;
}

.role-card.is-disabled {
  cursor: not-allowed;
  opacity: .55;
  background: #f8faf9;
}

.role-card strong,
.checkbox-line span {
  display: block;
  font-weight: 800;
}

.role-card small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.role-card input[type="checkbox"],
.checkbox-line input[type="checkbox"] {
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 1px 0 0;
  accent-color: var(--brand);
}

.role-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.role-detail {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfa;
}

.role-detail[data-field-name="engagement_type"] {
  grid-column: 1 / -1;
}

.checkbox-line {
  display: inline-flex;
  align-items: flex-start;
  gap: 9px;
  margin: 0;
  cursor: pointer;
}

.messages {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.message {
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  background: #fff;
  border-radius: 6px;
  padding: 10px 12px;
}

.empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

.pagination {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    overflow: visible;
  }

  .sidebar-toggle,
  .sidebar-resizer {
    display: none;
  }

  .app-shell.sidebar-collapsed .sidebar {
    padding: 18px 14px;
  }

  .app-shell.sidebar-collapsed .sidebar-header {
    align-items: flex-start;
    flex-direction: row;
  }

  .app-shell.sidebar-collapsed .brand {
    justify-content: flex-start;
    padding: 8px 10px 18px;
  }

  .app-shell.sidebar-collapsed .brand-label,
  .app-shell.sidebar-collapsed .nav-link span,
  .app-shell.sidebar-collapsed .nav-section {
    opacity: 1;
    pointer-events: auto;
    position: static;
  }

  .app-shell.sidebar-collapsed .nav-link {
    justify-content: flex-start;
    padding: 8px 10px;
  }

  .grid-2,
  .grid-3,
  .grid-4,
  .role-card-grid,
  .role-detail-grid,
  .form-grid,
  .filters {
    grid-template-columns: 1fr;
  }

  .topbar,
  .page-header,
  .form-section-header {
    align-items: stretch;
    flex-direction: column;
    height: auto;
    padding: 16px;
  }

  .form-section-header {
    padding: 0;
    gap: 6px;
  }

  .form-section-header p {
    max-width: none;
    text-align: left;
  }

  .content {
    padding: 16px;
  }

  .search {
    width: 100%;
  }
}

.recording-workspace {
  display: grid;
  gap: 16px;
}

.recording-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.recording-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.device-setup-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.device-setup-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.device-status {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding: 5px 10px;
  white-space: nowrap;
}

.device-status.ready {
  background: #e7f7ef;
  border-color: #b7e5c9;
  color: #11643b;
}

.device-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr)) auto;
  gap: 12px;
  align-items: end;
}

.device-diagnostics {
  margin-top: 10px;
  overflow-wrap: anywhere;
}

.device-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.device-preview-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.device-setup-modal .settings-modal-card {
  width: min(1040px, 96vw);
}

.device-preview-frame {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: #101816;
  line-height: 0;
}

.device-preview-wrap video {
  width: 100%;
  max-height: min(64vh, 620px);
  height: auto;
  background: #101816;
  display: block;
  transform: scaleX(-1);
}

.device-preview-wrap audio {
  width: 100%;
}

.device-recording-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: #b42318;
  font-weight: 800;
}

.device-recording-state[hidden] {
  display: none;
}

.device-aim-guide {
  position: absolute;
  top: 0;
  left: 50%;
  height: 100%;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  transform: translateX(-50%);
  border: 2px dashed rgba(255, 255, 255, .78);
  border-radius: 10px;
  pointer-events: none;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, .08);
}

.section-record-action {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.record-disabled-help {
  max-width: 240px;
  margin: 0;
  text-align: right;
  font-size: 12px;
}

.terp-source-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) 8px minmax(340px, .65fr);
  gap: 8px;
  align-items: stretch;
}

.display-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 10px;
}

.display-toolbar-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.terp-source-layout.display-hidden {
  grid-template-columns: minmax(0, 1fr);
}

.terp-source-layout.display-hidden .display-panel,
.terp-source-layout.display-hidden .layout-splitter {
  display: none;
}

.display-panel[hidden],
.layout-splitter[hidden] {
  display: none;
}

.display-panel .caption-panel {
  margin-top: 0;
}

.terp-source-layout.audio-prep-layout .caption-panel[hidden] {
  display: none;
}

.terp-source-layout.audio-prep-layout.transcript-mode .display-panel {
  display: grid;
  grid-template-rows: max-content;
  align-content: start;
}
.terp-source-layout.caption-mode .display-panel,
.recording-stage.caption-mode .modal-display-panel {
  display: grid;
  align-content: start;
}

.layout-splitter {
  width: 8px;
  min-height: 460px;
  cursor: col-resize;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent 3px, var(--line) 3px, var(--line) 5px, transparent 5px);
}

.layout-splitter:hover {
  background: linear-gradient(90deg, transparent 2px, var(--brand) 2px, var(--brand) 6px, transparent 6px);
}

.source-panel,
.transcript-panel {
  min-height: 460px;
}

.source-frame {
  width: 100%;
  min-height: 380px;
  display: grid;
  place-items: center;
  background: #101816;
  border-radius: 8px;
  overflow: hidden;
}

.source-frame.audio-source-frame {
  min-height: 90px;
  padding: 16px;
}

.source-frame audio {
  display: none;
}

.source-frame video {
  width: 100%;
  max-height: 68vh;
  background: #101816;
}

.audio-source-placeholder {
  display: grid;
  gap: 4px;
  place-items: center;
  width: min(680px, 92%);
  min-height: 52px;
  color: #f7fbfa;
  text-align: center;
}

.audio-source-placeholder strong {
  color: rgba(247, 251, 250, .86);
  font-size: 15px;
}

.source-frame.locked audio,
.source-frame.locked video {
  pointer-events: none;
}

.source-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: -1px;
  padding: 8px 10px 0;
}

.source-player-controls {
  display: grid;
  gap: 0;
  margin-top: 10px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.source-player-controls[hidden] {
  display: none;
}

.source-control-row {
  display: grid;
  grid-template-columns: auto auto minmax(160px, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 10px 12px;
  background: #f8fbfa;
}

.source-play-toggle {
  width: 42px;
  min-width: 42px;
  font-size: 12px;
  border-radius: 999px;
}

.source-time {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.source-timeline-wrap {
  position: relative;
  min-height: 36px;
  display: grid;
  align-items: center;
}

.source-seek {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 28px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  accent-color: var(--brand);
}

.source-seek:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 4px;
}

.source-seek::-webkit-slider-runnable-track {
  height: 10px;
  border-radius: 999px;
  background: transparent;
}

.source-seek::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  margin-top: -4px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--brand);
  box-shadow: 0 2px 8px rgba(23, 33, 29, .24);
}

.source-seek::-moz-range-track {
  height: 10px;
  border-radius: 999px;
  background: transparent;
}

.source-seek::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--brand);
  box-shadow: 0 2px 8px rgba(23, 33, 29, .24);
}

.source-section-controls {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.source-section-controls p {
  margin: 4px 0 0;
  max-width: 680px;
}

.caption-panel {
  margin-top: 8px;
  border-radius: 6px;
  padding: 9px 12px;
  text-align: center;
  min-height: var(--caption-panel-min-height, calc(2.85em + 18px));
}

.caption-text {
  display: grid;
  grid-template-rows: repeat(var(--caption-frame-count, 1), minmax(2.85em, auto));
  gap: 8px;
  line-height: 1.18;
  font-weight: 750;
  white-space: normal;
  align-items: stretch;
}

.caption-frame {
  display: grid;
  align-content: center;
  min-height: 2.85em;
  padding: 2px 0;
}

.caption-frame-upcoming {
  opacity: .7;
  font-size: .9em;
}

.caption-line {
  display: block;
  overflow-wrap: anywhere;
}

.audio-caption-panel {
  display: grid;
  place-items: center;
  min-height: 74px;
}

.transcript-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.transcript-scroll {
  height: 410px;
  overflow-y: auto;
  padding-right: 6px;
  line-height: 1.25;
}

.transcript-paragraph {
  margin: 0 0 10px;
}

.speaker-block {
  margin-bottom: 14px;
}

.speaker-label {
  display: inline-flex;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.transcript-word {
  display: inline;
  min-height: 0;
  border: 0;
  background: transparent;
  border-radius: 4px;
  color: var(--transcript-font-color, var(--ink));
  cursor: pointer;
  font: inherit;
  line-height: 1.25;
  margin: 0;
  padding: 0 1px;
  vertical-align: baseline;
}

.transcript-word:hover {
  background: #e8f1fb;
}

.transcript-word.active {
  background: var(--transcript-highlight, #ffe8a6);
  color: var(--transcript-font-color, var(--ink));
}

.transcript-sentence {
  display: inline;
  border-radius: 4px;
  color: var(--transcript-font-color, var(--ink));
  cursor: pointer;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.transcript-sentence:hover {
  background: #e8f1fb;
}

.transcript-sentence:hover .transcript-word {
  background: transparent;
}

.transcript-sentence.active {
  background: var(--transcript-highlight, #ffe8a6);
  color: var(--transcript-font-color, var(--ink));
}

.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 28;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(7, 12, 10, .56);
}

.settings-modal[hidden] {
  display: none;
}

.settings-modal-card {
  width: min(680px, 94vw);
  max-height: 90vh;
  overflow-y: auto;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.settings-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.settings-grid label {
  display: grid;
  gap: 6px;
  font-weight: 750;
}

.settings-grid .full {
  grid-column: 1 / -1;
}

.refined-settings-grid {
  gap: 12px 16px;
}

.color-setting {
  align-content: start;
}

.color-control {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.color-control input[type="color"] {
  width: 42px;
  height: 34px;
  flex: 0 0 auto;
  padding: 3px;
}

.color-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}

.color-swatch {
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .72);
}

.color-swatch.is-selected {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.modal-transcript .transcript-word,
.modal-transcript .transcript-sentence {
  cursor: default;
  pointer-events: none;
}

.recording-modal,
.uploading-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(7, 12, 10, .82);
}

.recording-modal[hidden],
.uploading-modal[hidden] {
  display: none;
}

.recording-modal-card {
  width: min(1440px, 97vw);
  max-height: 94vh;
  background: #0f1715;
  color: #f7fbfa;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .38);
}

.recording-statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #121d1a;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
  font-weight: 800;
}

.recording-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.recording-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: #e11d48;
  animation: recordPulse 1s infinite;
}

@keyframes recordPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .25; }
}

.recording-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr);
  gap: 14px;
  padding: 14px;
  position: relative;
}

.recording-stage.display-hidden {
  grid-template-columns: minmax(0, 1fr);
}

.recording-stage.display-hidden > .recording-source-panel {
  width: min(100%, 1180px);
  justify-self: center;
}

.recording-stage .modal-display-panel {
  align-self: stretch;
  min-height: min(70vh, 620px);
  overflow: auto;
}

.recording-stage .modal-caption-panel {
  min-height: var(--caption-panel-min-height, calc(2.85em + 18px));
  margin-top: 0;
  overflow: visible;
}

.recording-stage .modal-display-panel[hidden],
.recording-stage .modal-caption-panel[hidden],
.recording-stage .modal-transcript[hidden] {
  display: none;
}
.recording-stage .source-frame {
  min-height: min(70vh, 620px);
}

.recording-self-view {
  position: absolute;
  left: 26px;
  bottom: clamp(24px, 4vh, 48px);
  z-index: 4;
  width: clamp(140px, 12vw, 200px);
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, .68);
  background: #08100e;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .38);
  transform: scaleX(-1);
  pointer-events: none;
}

.recording-self-view[hidden] {
  display: none;
}

.recording-stage .source-frame.modal-audio-source-frame {
  min-height: 0;
  height: 0;
  overflow: hidden;
}

.recording-stage .modal-audio-source-frame {
  display: grid;
  place-items: center;
}


.recording-stage.audio-layout {
  grid-template-columns: minmax(0, 1fr) !important;
  min-height: min(70vh, 620px);
}

.recording-stage.audio-layout > .recording-source-panel {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.recording-stage.audio-layout > .modal-display-panel {
  width: min(900px, 88%);
  justify-self: center;
  align-self: stretch;
}

.recording-stage.audio-layout .recording-self-view {
  bottom: clamp(28px, 7vh, 78px);
  width: clamp(140px, 13vw, 200px);
}

.recording-stage .transcript-panel {
  background: #f7fbfa;
  color: var(--ink);
  min-height: min(70vh, 620px);
  padding: 14px;
  border-radius: 8px;
}

.recording-stage .transcript-scroll {
  height: min(64vh, 560px);
}

.countdown-overlay {
  position: absolute;
  inset: 14px;
  z-index: 3;
  display: grid;
  place-items: center;
  background: rgba(7, 12, 10, .64);
  color: #fff;
  font-size: clamp(42px, 10vw, 112px);
  font-weight: 900;
}

.countdown-overlay[hidden] {
  display: none;
}

.countdown-overlay.done {
  display: none;
}

.recording-status-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #dfe9e6;
  font-size: 14px;
  flex-wrap: wrap;
}

.modal-caption-panel {
  margin-top: 10px;
}

.modal-audio-caption-panel {
  min-height: 120px;
  margin-top: 0;
}

.uploading-card {
  width: min(420px, 92vw);
  padding: 24px;
  background: #fff;
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.upload-progress {
  width: 100%;
  height: 10px;
  margin-top: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2f0;
}

.upload-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--brand);
  transition: width .18s ease;
}

.recording-review video,
.recording-review audio {
  width: 100%;
  max-height: 520px;
  background: #101816;
  border-radius: 8px;
}

.section-planner-header,
.recording-section-header,
.take-row,
.take-actions,
.split-points {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.take-reviewer-note {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbfa;
  font-size: 14px;
}

.take-reviewer-note p {
  margin: 6px 0;
}

.reviewer-note-grid {
  display: grid;
  gap: 14px;
}

.reviewer-note-recorder {
  display: grid;
  gap: 10px;
}

.reviewer-note-recorder video {
  width: 100%;
  max-height: 340px;
  border-radius: 8px;
  background: #101816;
}

.reviewer-note-card {
  margin: 10px 0 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbfa;
}

.section-planner-header,
.recording-section-header {
  justify-content: space-between;
}

.split-points {
  margin: 0;
  padding: 0 12px 12px;
}

.integrated-split-timeline {
  position: relative;
  height: 34px;
  margin: 14px 0 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, #dfe7e3, #edf4f1);
  border: 1px solid var(--line);
}

.media-split-timeline {
  position: absolute;
  inset: 0;
  z-index: 2;
  height: auto;
  margin: 0;
  border: 0;
  background: linear-gradient(90deg, var(--brand) var(--source-progress, 0%), #dfe7e3 var(--source-progress, 0%));
  pointer-events: none;
}

.media-split-timeline::after {
  content: "";
  position: absolute;
  left: var(--source-progress, 0%);
  top: 50%;
  transform: translate(-50%, -50%);
  width: 18px;
  height: 18px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--brand-strong);
  box-shadow: 0 2px 8px rgba(23, 33, 29, .24);
}

.split-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 18px;
  height: 26px;
  border: 2px solid #fff;
  border-radius: 5px;
  background: var(--brand);
  box-shadow: var(--shadow);
  cursor: pointer;
  pointer-events: auto;
  z-index: 4;
}

.split-marker.readonly {
  cursor: default;
}

.split-marker:hover::after {
  content: attr(data-label);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 4px 6px;
  border-radius: 5px;
  background: #101816;
  color: #fff;
  font-size: 12px;
}

.split-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  background: #fff;
}

.source-player-controls .split-points {
  margin-top: 0;
}

.split-chip button {
  min-height: 24px;
  padding: 2px 7px;
}

.recording-sections {
  display: grid;
  gap: 16px;
}

.section-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.take-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.take-row {
  align-items: flex-start;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfc;
}

.take-main {
  display: grid;
  gap: 8px;
  min-width: min(420px, 100%);
}

.take-main video,
.take-main audio {
  width: min(560px, 100%);
  max-height: 260px;
  background: #101816;
  border-radius: 6px;
}

.take-playback-status {
  display: grid;
  place-items: center;
  width: min(560px, 100%);
  min-height: 96px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f3f7f6;
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

.take-playback-status.error {
  background: #fff7ed;
  color: #9a3412;
}
.signing-end-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.signing-end-controls input {
  width: 150px;
}

.recording-modal-actions {
  padding: 0 14px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.recording-device-summary {
  color: rgba(247, 251, 250, .78);
  font-size: 12px;
  font-weight: 800;
  max-width: min(620px, 72vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-workspace {
  display: grid;
  gap: 16px;
}

.review-take-list,
.feedback-card-list {
  display: grid;
  gap: 14px;
}

.review-take-card,
.feedback-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  padding: 14px;
}

.review-take-card video,
.review-take-card audio {
  width: 100%;
  max-height: 460px;
  background: #101816;
  border-radius: 8px;
}

.review-marker-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 34px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.review-marker {
  min-height: 28px;
  padding: 4px 8px;
  border-color: #ffd28a;
  background: #fff6df;
  color: #6f4307;
  font-size: 12px;
}

.review-marker::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--accent);
}

.feedback-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.feedback-edit-form {
  display: grid;
  gap: 8px;
}

.feedback-edit-form input {
  max-width: 180px;
}

@media (max-width: 980px) {
  .project-hero,
  .project-hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .project-hero-actions {
    min-width: 0;
  }

  .project-summary-grid,
  .grid-2,
  .grid-3,
  .grid-4,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .recording-hero,
  .recording-actions,
  .device-setup-strip,
  .settings-modal-header,
  .recording-modal-actions {
    flex-direction: column;
  }

  .terp-source-layout,
  .recording-stage {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .device-grid,
  .device-preview-wrap,
  .source-control-row,
  .settings-grid {
    grid-template-columns: 1fr;
  }


  .source-section-controls {
    flex-direction: column;
  }

  .layout-splitter {
    display: none;
  }

  .source-panel,
  .transcript-panel,
  .source-frame {
    min-height: 300px;
  }
}

.take-playback-version { margin: 6px 0; color: var(--muted, #667085); font-size: 0.84rem; font-weight: 600; }

.survey-stat{margin:12px 0}.survey-stat>div:first-child{display:flex;justify-content:space-between;gap:12px}.survey-stat-track{height:8px;background:#edf0ef;border-radius:9px;overflow:hidden}.survey-stat-track span{display:block;height:100%;background:var(--accent)}.survey-detail{display:grid;grid-template-columns:190px 1fr;gap:14px 20px}.survey-detail dt{font-weight:700}.survey-detail dd{margin:0}@media(max-width:700px){.survey-detail{grid-template-columns:1fr}.survey-detail dd{margin-bottom:8px}}
.upload-modal-panel {
  position: relative;
}

.upload-status-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(255, 255, 255, .94);
  border-radius: inherit;
}

.upload-status-overlay[hidden] {
  display: none;
}

.upload-status-card {
  width: min(440px, 100%);
  text-align: center;
}

.upload-status-card h3 {
  margin: 14px 0 6px;
}

.upload-status-card p {
  margin: 0;
  color: var(--muted);
}

.loading-spinner {
  display: inline-block;
  width: 38px;
  height: 38px;
  border: 4px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: loading-spin .8s linear infinite;
}

.indeterminate-progress {
  height: 6px;
  margin-top: 18px;
  overflow: hidden;
  background: var(--line);
  border-radius: 999px;
}

.indeterminate-progress span {
  display: block;
  width: 42%;
  height: 100%;
  background: var(--brand);
  border-radius: inherit;
  animation: loading-progress 1.3s ease-in-out infinite;
}

.upload-progress-track {
  height: 10px;
  margin-top: 18px;
  overflow: hidden;
  background: var(--line);
  border-radius: 999px;
}
.upload-progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--brand);
  border-radius: inherit;
  transition: width .2s ease;
}
.upload-progress-summary {
  margin-top: 10px !important;
  font-weight: 800;
  color: var(--text) !important;
}
.upload-active-files {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  font-size: .9rem;
  text-align: left;
}
.upload-failures {
  margin-top: 12px !important;
  color: var(--danger, #a52a22) !important;
}
.upload-retry-actions {
  justify-content: center;
  margin-top: 14px;
}
@keyframes loading-spin {
  to { transform: rotate(360deg); }
}

@keyframes loading-progress {
  from { transform: translateX(-110%); }
  to { transform: translateX(250%); }
}

.output-profile-field > label,
.reprocess-options > legend {
  font-weight: 800;
}

.output-profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
  margin-top: 8px;
}

.output-profile-group {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft, #f7f8f7);
}

.output-profile-group > strong {
  margin-bottom: 2px;
}

.output-profile-option {
  display: grid !important;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
  gap: 9px;
  margin: 0 !important;
  padding: 9px 10px;
  font-weight: 650 !important;
  line-height: 1.35;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
}

.output-profile-option:hover {
  border-color: var(--line);
  background: var(--panel);
}

.output-profile-option input[type="checkbox"] {
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 1px 0 0;
  accent-color: var(--brand);
}

.output-profile-option small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-weight: 400;
}

.reprocess-options {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.reprocess-options > .helptext {
  margin: 4px 0 10px;
}

.reprocess-extend-option {
  margin-top: 14px !important;
  border-color: var(--line);
  background: var(--panel);
}

@media (max-width: 720px) {
  .output-profile-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .loading-spinner,
  .indeterminate-progress span {
    animation-duration: 2.5s;
  }
}
.project-list-table {
  table-layout: fixed;
  min-width: 0;
}

.project-list-table th,
.project-list-table td {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
}

.project-list-table th:nth-child(1) { width: 18%; }
.project-list-table th:nth-child(2) { width: 12%; }
.project-list-table th:nth-child(3) { width: 11%; }
.project-list-table th:nth-child(4) { width: 14%; }
.project-list-table th:nth-child(5) { width: 9%; }
.project-list-table th:nth-child(6) { width: 12%; }
.project-list-table th:nth-child(7) { width: 10%; }
.project-list-table th:nth-child(8) { width: 6%; }
.project-list-table th:nth-child(9) { width: 8%; }

.project-list-name {
  display: inline-block;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.3;
}

.project-list-code {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.3;
}

@media (max-width: 760px) {
  .project-list-table {
    min-width: 760px;
  }
}
