:root {
  --bg: #f5f7f9;
  --panel: #ffffff;
  --text: #182026;
  --muted: #66727d;
  --line: #dce3e8;
  --line-strong: #c6d0d8;
  --accent: #126c5a;
  --accent-strong: #0b5648;
  --accent-soft: #dff3ee;
  --warn: #9a4512;
  --warn-soft: #fff0de;
  --danger: #b42318;
  --danger-soft: #fee4e2;
  --shadow: 0 24px 70px rgba(32, 44, 54, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(18, 108, 90, 0.08), rgba(245, 247, 249, 0) 280px),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

.shell {
  width: min(1480px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 22px 0 36px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-link {
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #102a2f;
  color: #c7f6df;
}

.brand h1,
.brand p,
.section-heading h2,
.result-header h2,
.result-header p {
  margin: 0;
}

.brand h1 {
  font-size: 22px;
  line-height: 1.1;
}

.brand p,
.result-header p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.status-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nav a,
.nav button {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  color: #314048;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.nav form {
  margin: 0;
}

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

.flash {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #314048;
  font-size: 13px;
  font-weight: 750;
}

.flash.error {
  border-color: rgba(180, 35, 24, 0.25);
  background: var(--danger-soft);
  color: var(--danger);
}

.flash.success {
  border-color: rgba(18, 108, 90, 0.24);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--muted);
  font-size: 13px;
}

.status-pill svg {
  width: 16px;
  height: 16px;
}

.status-pill.is-ready {
  border-color: rgba(18, 108, 90, 0.24);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.status-pill.is-missing {
  border-color: rgba(154, 69, 18, 0.25);
  background: var(--warn-soft);
  color: var(--warn);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 480px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.auth-layout,
.single-column {
  display: grid;
  place-items: start center;
  min-height: calc(100vh - 150px);
}

.auth-panel,
.single-column > .panel {
  width: min(560px, 100%);
  padding: 22px;
}

.admin-layout,
.job-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 18px;
  align-items: start;
}

.job-layout {
  grid-template-columns: minmax(0, 1fr) 320px;
}

.stack {
  display: grid;
  gap: 12px;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.compact {
  margin: 14px 0 0;
  font-size: 13px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.controls {
  padding: 18px;
}

.section + .section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 13px;
  color: #29363d;
}

.section-heading svg {
  width: 18px;
  height: 18px;
  color: var(--accent);
}

.section-heading h2 {
  font-size: 14px;
  line-height: 1.2;
  font-weight: 700;
}

.dropzone {
  display: grid;
  place-items: center;
  gap: 9px;
  min-height: 126px;
  margin-bottom: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(18, 108, 90, 0.06), rgba(28, 96, 119, 0.04)),
    #fbfcfd;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.dropzone:hover,
.dropzone.is-dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dropzone input {
  display: none;
}

.drop-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #102a2f;
  color: #c7f6df;
}

.dropzone span:last-child {
  max-width: calc(100% - 28px);
  overflow: hidden;
  color: #314048;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.label-row,
.entity-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.help {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  border-radius: 999px;
  color: #52616b;
  cursor: help;
}

.help svg {
  width: 15px;
  height: 15px;
}

.help::after {
  position: absolute;
  right: 0;
  bottom: calc(100% + 9px);
  z-index: 20;
  width: min(300px, 78vw);
  padding: 10px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #102a2f;
  color: #f6fbfb;
  box-shadow: 0 14px 40px rgba(16, 42, 47, 0.22);
  content: attr(data-tip);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.help::before {
  position: absolute;
  right: 7px;
  bottom: calc(100% + 4px);
  z-index: 21;
  width: 10px;
  height: 10px;
  background: #102a2f;
  content: "";
  opacity: 0;
  pointer-events: none;
  transform: rotate(45deg) translateY(4px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.help:hover,
.help:focus-visible {
  color: var(--accent-strong);
  outline: none;
}

.help:hover::after,
.help:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.help:hover::before,
.help:focus-visible::before {
  opacity: 1;
  transform: rotate(45deg) translateY(0);
}

.field + .field,
.switch.wide,
.entity-group + .entity-group {
  margin-top: 12px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  outline: none;
  padding: 9px 10px;
  font-size: 14px;
}

.field textarea {
  resize: vertical;
  line-height: 1.45;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(18, 108, 90, 0.58);
  box-shadow: 0 0 0 3px rgba(18, 108, 90, 0.12);
}

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

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

.grid + .grid,
.grid + .switch-grid {
  margin-top: 12px;
}

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

.switch {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: #314048;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-control {
  position: relative;
  width: 34px;
  height: 20px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #cdd7de;
  transition: background 160ms ease;
}

.switch-control::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  content: "";
  transition: transform 160ms ease;
}

.switch input:checked + .switch-control {
  background: var(--accent);
}

.switch input:checked + .switch-control::after {
  transform: translateX(14px);
}

.switch-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.switch .help {
  margin-left: auto;
}

.entity-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.entity-title {
  width: 100%;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.entity-group label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #314048;
  font-size: 13px;
  font-weight: 700;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 46px;
  margin-top: 16px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}

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

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

.results {
  min-height: calc(100vh - 120px);
  padding: 20px;
}

.compact-panel {
  padding: 18px;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.result-header h2 {
  font-size: 18px;
}

.job-title-block {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.job-title-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.job-title-row h2 {
  overflow-wrap: anywhere;
}

.title-edit-button,
.small-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #314048;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.title-edit-button:hover,
.small-action:hover {
  border-color: var(--line-strong);
  background: #f8fafb;
}

.title-edit-button svg {
  width: 14px;
  height: 14px;
}

.title-edit-form {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.title-edit-form input {
  width: min(520px, 100%);
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: #182026;
  font-size: 14px;
  font-weight: 750;
}

.primary-small {
  border-color: rgba(18, 108, 90, 0.34);
  background: var(--accent);
  color: #fff;
}

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

.meter {
  width: min(240px, 32vw);
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7edf1;
}

.meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 260ms ease;
}

.detail-meter {
  width: 100%;
  margin: 14px 0;
}

.retry-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.empty-state,
.active-state,
.error-state {
  display: grid;
  place-items: center;
  min-height: 440px;
  color: var(--muted);
  text-align: center;
  font-weight: 700;
}

.compact-empty {
  min-height: 260px;
}

.empty-state svg {
  width: 60px;
  height: 60px;
  margin-bottom: 12px;
  color: #95a3ad;
}

.active-state {
  gap: 14px;
}

.spinner {
  width: 38px;
  height: 38px;
  border: 4px solid #dce3e8;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 760ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.error-state {
  min-height: 260px;
  padding: 24px;
  border-radius: 8px;
  background: var(--danger-soft);
  color: var(--danger);
}

.result-state {
  padding-top: 16px;
}

.warning-state {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid rgba(154, 69, 18, 0.22);
  border-radius: 8px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.45;
}

.inline-status {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: #314048;
  font-size: 13px;
  font-weight: 750;
}

.inline-status.error {
  border-color: rgba(180, 35, 24, 0.25);
  background: var(--danger-soft);
  color: var(--danger);
}

.inline-status.success {
  border-color: rgba(18, 108, 90, 0.24);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.warning-state svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  margin-top: 1px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

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

.metrics div {
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metrics strong {
  display: block;
  margin-top: 7px;
  font-size: 22px;
}

.artifact-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin: 14px 0 12px;
}

.toolbar-group,
.export-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.toolbar-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.download-button,
.tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #314048;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.tabs {
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.tab {
  border-color: transparent;
  background: transparent;
}

.download-button:hover,
.tab:hover {
  border-color: var(--line-strong);
  background: #fff;
}

.download-button:focus-visible,
.tab:focus-visible,
.title-edit-button:focus-visible,
.small-action:focus-visible,
.title-edit-form input:focus-visible {
  outline: 2px solid rgba(18, 108, 90, 0.38);
  outline-offset: 2px;
}

.primary-download {
  border-color: rgba(18, 108, 90, 0.34);
  background: var(--accent);
  color: #fff;
}

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

.tab.is-active {
  border-color: rgba(18, 108, 90, 0.36);
  background: #ffffff;
  color: var(--accent-strong);
  box-shadow: 0 1px 3px rgba(32, 44, 54, 0.08);
}

.download-menu {
  position: relative;
}

.download-menu summary {
  list-style: none;
}

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

.download-menu-trigger svg:last-child {
  width: 15px;
  height: 15px;
  transition: transform 160ms ease;
}

.download-menu[open] .download-menu-trigger {
  border-color: var(--line-strong);
  background: #fff;
}

.download-menu[open] .download-menu-trigger svg:last-child {
  transform: rotate(180deg);
}

.download-menu-panel {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  z-index: 30;
  width: 240px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 44px rgba(32, 44, 54, 0.18);
}

.download-menu-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border-radius: 8px;
  color: #314048;
  text-decoration: none;
}

.download-menu-item:hover {
  background: #f4f8f8;
}

.download-menu-item svg {
  color: var(--accent);
}

.download-menu-item span {
  display: grid;
  gap: 1px;
}

.download-menu-item strong {
  font-size: 13px;
  line-height: 1.2;
}

.download-menu-item small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.preview {
  max-height: calc(100vh - 360px);
  min-height: 360px;
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.prose {
  color: #243139;
  line-height: 1.55;
  white-space: pre-wrap;
}

.prose h2,
.prose h3,
.prose h4 {
  margin: 18px 0 8px;
  line-height: 1.2;
}

.prose h2:first-child,
.prose h3:first-child,
.prose h4:first-child {
  margin-top: 0;
}

.prose p {
  margin: 0 0 10px;
}

.prose ul {
  margin: 0 0 14px;
  padding-left: 20px;
}

.prose table {
  width: 100%;
  margin: 12px 0;
  border-collapse: collapse;
  font-size: 13px;
}

.prose td {
  border: 1px solid var(--line);
  padding: 8px;
  vertical-align: top;
}

.transcript {
  white-space: pre-wrap;
  color: #243139;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.6;
}

.visual-summary {
  display: grid;
  gap: 6px;
  padding: 0 10px 10px;
  background:
    linear-gradient(180deg, rgba(18, 108, 90, 0.05), rgba(248, 250, 251, 0) 180px),
    #f8fafb;
  white-space: normal;
}

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

.summary-section {
  overflow: hidden;
  border: 1px solid #d6e0e6;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 2px 10px rgba(32, 44, 54, 0.035);
}

.summary-section:first-child {
  margin-top: 0;
}

.summary-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 9px 14px;
  border-bottom: 1px solid #dbe5eb;
  background: #eef6f3;
  color: #203039;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
  margin: 0;
}

.summary-section-marker {
  width: 10px;
  height: 24px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--accent);
}

.action-section .summary-section-title {
  background: #e9f3f7;
}

.action-section .summary-section-marker {
  background: #1c6077;
}

.decision-section .summary-section-title {
  background: #e7f5ee;
}

.decision-section .summary-section-marker {
  background: var(--accent);
}

.risk-section .summary-section-title {
  background: #fff4e8;
}

.risk-section .summary-section-marker {
  background: var(--warn);
}

.question-section .summary-section-title {
  background: #f0edfa;
}

.question-section .summary-section-marker {
  background: #6956a5;
}

.summary-section-body {
  display: grid;
  gap: 0;
  padding: 2px 16px 4px;
  background: #ffffff;
}

.summary-section-body > p {
  margin: 0;
}

.summary-card {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 11px;
  padding: 12px 0;
  border: 0;
  border-bottom: 1px solid #e4ecef;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.summary-grid > .summary-card {
  padding: 10px 11px;
  border: 1px solid #cfdce3;
  border-radius: 8px;
  background: #ffffff;
}

.summary-section-body > .summary-card:last-child {
  border-bottom: 0;
}

.summary-card p {
  margin: 0;
  color: #243139;
  line-height: 1.42;
}

.summary-dot {
  width: 6px;
  height: 6px;
  margin-top: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.summary-table-wrap {
  overflow-x: auto;
  border: 1px solid #ccd8df;
  border-radius: 8px;
  background: #fff;
}

.summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.summary-table th,
.summary-table td {
  padding: 11px 12px;
  border-bottom: 1px solid #e3eaee;
  text-align: left;
  vertical-align: top;
}

.summary-table th {
  border-bottom-color: #c8d7de;
  background: #eff5f6;
  color: #243139;
  font-size: 12px;
  font-weight: 900;
}

.summary-table td {
  background: #ffffff;
  color: #2d3b43;
  line-height: 1.42;
}

.summary-table tr:nth-child(even) td {
  background: #f9fbfc;
}

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

.job-list {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.job-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: inherit;
  text-decoration: none;
}

.job-row:hover {
  border-color: var(--line-strong);
  background: #fff;
}

.job-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.job-main strong,
.job-main span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-state {
  display: grid;
  gap: 7px;
  justify-items: end;
}

.state-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.state-badge.completed {
  border-color: rgba(18, 108, 90, 0.24);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.state-badge.failed {
  border-color: rgba(180, 35, 24, 0.25);
  background: var(--danger-soft);
  color: var(--danger);
}

.state-badge.running,
.state-badge.queued {
  border-color: rgba(28, 96, 119, 0.24);
  background: #e4f2f6;
  color: #1c6077;
}

.row-meter {
  width: 160px;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7edf1;
}

.row-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 260ms ease;
}

.quota-ring {
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fbfcfd;
}

.quota-ring strong {
  font-size: 18px;
  line-height: 1;
}

.quota-ring span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.audio-player {
  margin: 16px 0 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.audio-player audio {
  width: 100%;
}

.synced-transcript {
  display: grid;
  gap: 8px;
  white-space: normal;
  font-family: inherit;
  font-size: 14px;
}

.segment {
  display: grid;
  grid-template-columns: 82px 120px minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #243139;
  text-align: left;
  cursor: pointer;
}

.segment:hover,
.segment.is-active {
  border-color: rgba(18, 108, 90, 0.36);
  background: var(--accent-soft);
}

.segment-time,
.segment-speaker {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.segment-text {
  line-height: 1.45;
}

.editor-panel {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.editor-panel summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 12px;
  color: #314048;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  list-style: none;
}

.editor-panel summary::-webkit-details-marker {
  display: none;
}

.editor-panel form {
  padding: 12px;
  border-top: 1px solid var(--line);
}

.button-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.transcript-editor {
  display: grid;
  gap: 12px;
  white-space: normal;
  font-family: inherit;
}

.editor-block {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.editor-block-heading {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.editor-block-heading h3 {
  margin: 0;
  font-size: 14px;
}

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

.segment-editor-list {
  display: grid;
  gap: 8px;
}

.segment-editor-row {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.compact-field {
  gap: 5px;
}

.compact-field span {
  font-size: 11px;
}

.transcript-text-field textarea {
  min-height: 58px;
  resize: vertical;
}

.sticky-actions {
  position: sticky;
  bottom: -18px;
  padding: 10px 0 0;
  background: linear-gradient(180deg, rgba(248, 250, 251, 0), #fbfcfd 30%);
}

.detail-list {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 10px;
  margin: 0;
  font-size: 13px;
}

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

.detail-list dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.detail-error {
  min-height: auto;
  display: flex;
  justify-content: flex-start;
  gap: 10px;
  text-align: left;
}

.subhead {
  margin: 20px 0 10px;
  font-size: 15px;
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

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

.data-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

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

.readiness-item {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.readiness-item span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.readiness-item strong {
  color: var(--accent-strong);
  font-size: 13px;
}

.readiness-item.missing strong {
  color: var(--danger);
}

.readiness-item small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.mini-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.small-heading {
  margin-bottom: 8px;
}

.small-heading h2 {
  font-size: 14px;
}

.task-list {
  display: grid;
  gap: 8px;
}

.task-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.task-item strong {
  display: block;
  color: #243139;
  font-size: 12.5px;
  line-height: 1.35;
}

.task-item small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.event-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.event-item {
  display: grid;
  gap: 3px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.event-item span,
.event-item small {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.event-item strong {
  color: #243139;
  font-size: 12px;
  line-height: 1.35;
}

.event-item.warning {
  border-color: rgba(154, 69, 18, 0.22);
  background: var(--warn-soft);
}

.event-item.error {
  border-color: rgba(180, 35, 24, 0.25);
  background: var(--danger-soft);
}

.danger-zone {
  color: var(--danger);
}

.danger-button {
  border-color: rgba(180, 35, 24, 0.25);
  color: var(--danger);
}

.danger-button:hover {
  background: var(--danger-soft);
}

.history-search {
  margin-top: 12px;
}

[hidden] {
  display: none !important;
}

svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

@media (max-width: 1080px) {
  .workspace,
  .admin-layout,
  .job-layout {
    grid-template-columns: 1fr;
  }

  .results {
    min-height: 520px;
  }
}

@media (max-width: 680px) {
  .shell {
    width: min(100vw - 24px, 1480px);
    padding-top: 14px;
  }

  .topbar,
  .result-header {
    align-items: stretch;
    flex-direction: column;
  }

  .job-title-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .title-edit-button {
    width: fit-content;
  }

  .grid.two,
  .switch-grid,
  .metrics,
  .admin-layout .metrics,
  .job-row,
  .segment,
  .summary-grid,
  .speaker-rename-grid,
  .segment-editor-row,
  .readiness-list {
    grid-template-columns: 1fr;
  }

  .job-state {
    justify-items: stretch;
  }

  .row-meter {
    width: 100%;
  }

  .meter {
    width: 100%;
  }

  .preview {
    max-height: 520px;
  }

  .artifact-toolbar,
  .toolbar-group {
    align-items: stretch;
  }

  .toolbar-group,
  .tabs,
  .export-actions {
    width: 100%;
  }

  .tabs,
  .export-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .tab,
  .download-button {
    justify-content: center;
  }

  .download-menu {
    width: 100%;
  }

  .download-menu-trigger {
    width: 100%;
  }

  .download-menu-panel {
    right: auto;
    left: 0;
    width: min(100%, 320px);
  }
}
