@font-face {
  font-family: "Montserrat";
  src: url("assets/fonts/Montserrat-Regular.ttf") format("truetype");
  font-weight: 400;
}

@font-face {
  font-family: "Montserrat";
  src: url("assets/fonts/Montserrat-SemiBold.ttf") format("truetype");
  font-weight: 600;
}

@font-face {
  font-family: "Montserrat";
  src: url("assets/fonts/Montserrat-Black.ttf") format("truetype");
  font-weight: 900;
}

:root {
  --bg: #ebf2ff;
  --panel: #fcfeff;
  --ink: #151f27;
  --muted: #657b91;
  --line: #d9e7f7;
  --accent: #0086dd;
  --accent-strong: #3344bb;
  --accent-soft: #b7def7;
  --wave: #3ebdc6;
  --warn: #ff3333;
  --ready: #e7ffd8;
  --shadow: 0 10px 24px rgba(21, 31, 39, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(135deg, rgba(183, 222, 247, 0.7), rgba(252, 254, 255, 0.95) 45%, rgba(235, 242, 255, 0.95));
  color: var(--ink);
  font-family: "Montserrat", Arial, Helvetica, sans-serif;
}

button,
textarea {
  font: inherit;
}

button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 6px 10px;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

button.primary {
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  font-weight: 600;
}

.voice-start-btn {
  min-height: 38px;
  border-radius: 8px;
  padding: 8px 18px;
  background: linear-gradient(135deg, #006fd6, #3344bb);
  box-shadow: 0 8px 18px rgba(51, 68, 187, 0.24);
  font-size: 14px;
  font-weight: 900;
}

.voice-start-btn:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(51, 68, 187, 0.32);
}

button.danger,
button.danger-icon {
  border-color: rgba(255, 51, 51, 0.45);
  background: #fff0f0;
  color: var(--warn);
  font-weight: 700;
}

button.danger-icon {
  width: 34px;
  min-width: 34px;
  padding: 5px;
  font-size: 16px;
  line-height: 1;
}

button.danger:hover,
button.danger-icon:hover {
  border-color: var(--warn);
  background: #ffe1e1;
}

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 8px;
}

.deal__head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 6px;
}

.brand-mark {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 2px;
}

.brand-mark img {
  width: 128px;
  max-height: 42px;
  object-fit: contain;
  height: auto;
  display: block;
}

.brand-mark span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.brand-mark strong {
  color: var(--accent-strong);
  font-weight: 700;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  color: var(--accent-strong);
  font-size: 18px;
  font-weight: 900;
}

h2 {
  font-size: 15px;
}

h3 {
  font-size: 13px;
}

.status {
  border: 1px solid var(--accent-soft);
  border-radius: 6px;
  background: #fff;
  padding: 6px 10px;
  color: var(--accent-strong);
  min-width: 140px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
}

.status.is-recording {
  border-color: var(--warn);
  color: var(--warn);
  background: #fff5f5;
}

.notice-line {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  margin: 0 0 8px;
  border: 1px solid rgba(255, 51, 51, 0.3);
  border-left: 5px solid var(--warn);
  border-radius: 8px;
  background: linear-gradient(90deg, #fff0f0, #fffafa 68%, #fcfeff);
  padding: 9px 12px;
  overflow: hidden;
  text-align: center;
  box-shadow: 0 8px 18px rgba(255, 51, 51, 0.1);
}

.notice-line span {
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--warn);
  color: #fff;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.notice-line strong {
  min-width: 0;
  color: var(--warn);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
  white-space: normal;
}

.timeline {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfeff;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.timeline__bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--accent-strong);
  font-size: 14px;
  font-weight: 600;
}

.voice-widget {
  background: var(--panel);
}

.variant-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.variant-title h2 {
  color: #243b69;
  font-size: 16px;
  font-weight: 900;
}

.variant-title span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-align: right;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 270px;
  min-height: 560px;
}

.left-pane,
.right-pane {
  padding: 10px;
}

.left-pane {
  border-right: 1px solid var(--line);
}

.right-pane {
  background: linear-gradient(180deg, #f7fbff, #eef6ff);
  align-self: start;
  max-height: none;
  overflow: visible;
}

.recording-dock {
  position: sticky;
  top: 0;
  z-index: 45;
  margin: -2px -2px 10px;
  border: 1px solid rgba(0, 134, 221, 0.22);
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff, #f3f9ff);
  box-shadow: 0 12px 26px rgba(21, 31, 39, 0.1);
  overflow: hidden;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 0;
  padding: 9px 10px;
  border-bottom: 1px solid rgba(217, 231, 247, 0.9);
}

.protocol-btn {
  margin-left: auto;
}

.report-btn {
  border-color: rgba(51, 68, 187, 0.35);
  color: var(--accent-strong);
  font-weight: 600;
}

.report-btn:not(:disabled):hover {
  border-color: var(--accent-strong);
  background: #f1f4ff;
}

.auto-start-control {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 6px;
  color: #4d6073;
  font-size: 11px;
  white-space: nowrap;
  cursor: pointer;
}

.auto-start-control input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}

.capture-policy {
  margin: 0;
  padding: 4px 10px 5px;
  color: #64778a;
  font-size: 10px;
  line-height: 1.3;
}

.journal-capture-status {
  display: flex;
  width: 100%;
  min-height: 26px;
  align-items: center;
  gap: 7px;
  border: 0;
  border-top: 1px solid rgba(217, 231, 247, 0.75);
  border-bottom: 1px solid rgba(217, 231, 247, 0.75);
  border-radius: 0;
  background: #f8fbfe;
  padding: 5px 10px;
  color: #607387;
  text-align: left;
  font-size: 10px;
  font-weight: 600;
}

.journal-capture-status::before {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: #92a4b7;
  content: "";
}

.journal-capture-status[data-state="active"] {
  color: #177a45;
  background: #f2fbf5;
}

.journal-capture-status[data-state="active"]::before {
  background: #2fbd6b;
  box-shadow: 0 0 0 3px rgba(47, 189, 107, 0.14);
}

.journal-capture-status[data-state="action"],
.journal-capture-status[data-state="unavailable"] {
  color: #a64a4a;
  background: #fff7f7;
}

.journal-capture-status[data-state="action"]::before,
.journal-capture-status[data-state="unavailable"]::before {
  background: #ef6a6a;
}

.language-select {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 4px 7px;
}

.language-select span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.language-select select {
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  outline: none;
}

body.is-recording-active .toolbar {
  margin: 0;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(252, 254, 255, 0.96);
  backdrop-filter: blur(10px);
  box-shadow: none;
}

.live-card,
.summary-card,
.audio-card,
.editor-card,
.audio-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfeff;
}

.live-card,
.audio-card,
.summary-card {
  margin-bottom: 10px;
}

.audio-card {
  margin-bottom: 0;
  border: 0;
  border-radius: 0;
  padding: 8px 10px 10px;
  background: transparent;
}

body.is-recording-active .audio-card {
  border-color: rgba(0, 134, 221, 0.5);
  box-shadow: none;
}

body.is-recording-active .audio-title h2::after {
  content: " · закреплено";
  color: var(--warn);
  font-size: 11px;
  font-weight: 700;
}

.audio-strip {
  display: grid;
  grid-template-columns: 170px minmax(180px, 1fr) 160px auto;
  gap: 8px;
  align-items: center;
  min-height: 32px;
}

.audio-title h2 {
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 900;
}

.audio-title span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.audio-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.audio-controls strong {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.live-phrase {
  display: grid;
  grid-template-columns: 98px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  margin-top: 8px;
  border: 1px solid rgba(0, 134, 221, 0.32);
  border-radius: 7px;
  background: #f2f9ff;
  padding: 9px 10px;
  min-height: 72px;
}

.live-phrase span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.live-phrase textarea {
  display: block;
  width: 100%;
  min-height: 74px;
  height: 88px;
  max-height: 60vh;
  border: 0;
  outline: 0;
  resize: vertical;
  padding: 0 4px 4px 0;
  background: transparent;
  min-width: 0;
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  overflow: auto;
}

.live-phrase.is-active {
  border-color: rgba(0, 134, 221, 0.55);
  background: #eaf6ff;
}

.audio-mini-btn {
  min-height: 24px;
  min-width: 30px;
  border-radius: 6px;
  padding: 4px 7px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}

.process-indicator {
  min-height: 34px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fcff;
  padding: 6px 10px;
}

.process-indicator__icon {
  grid-row: 1 / span 2;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--accent-soft);
  background: #fff;
}

.process-indicator strong {
  color: var(--ink);
  font-size: 12px;
  line-height: 1.15;
}

.process-indicator small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
}

.process-indicator.is-recording {
  border-color: rgba(255, 51, 51, 0.45);
  background: #fff5f5;
}

.process-indicator.is-recording .process-indicator__icon {
  border-color: var(--warn);
  background: var(--warn);
  box-shadow: 0 0 0 5px rgba(255, 51, 51, 0.14);
  animation: recordPulse 1.1s ease-in-out infinite;
}

.process-indicator.is-processing {
  border-color: rgba(0, 134, 221, 0.4);
  background: #f2f9ff;
}

.process-indicator.is-processing .process-indicator__icon {
  border-color: var(--accent-soft);
  border-top-color: var(--accent-strong);
  background: #fff;
  animation: fastSpin 0.62s linear infinite;
}

.process-indicator.is-loaded {
  border-color: #8be36a;
  background: var(--ready);
}

.process-indicator.is-loaded .process-indicator__icon {
  border-color: #35b642;
  background: #35b642;
  position: relative;
}

.process-indicator.is-loaded .process-indicator__icon::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 5px;
  left: 4px;
  top: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg);
}

.process-indicator.is-paused {
  border-color: #ffd36d;
  background: #fff8e8;
}

.process-indicator.is-paused .process-indicator__icon {
  border-color: #f1a51b;
  background: linear-gradient(90deg, #f1a51b 0 35%, transparent 35% 65%, #f1a51b 65% 100%);
}

.process-indicator.is-error {
  border-color: rgba(255, 51, 51, 0.6);
  background: #fff0f0;
}

.process-indicator.is-error .process-indicator__icon {
  border-color: var(--warn);
  background: #fff;
}

@keyframes recordPulse {
  0%,
  100% {
    transform: scale(0.92);
    opacity: 0.85;
  }

  50% {
    transform: scale(1);
    opacity: 1;
  }
}

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

.waveform-bars {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 26px;
  border: 0;
  border-radius: 6px;
  padding: 2px 0;
  background: #fff;
  overflow: hidden;
  position: relative;
  width: 100%;
}

.waveform-bars::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 4px;
  border-radius: 999px;
  background: var(--accent);
  transform: translateY(-50%);
  opacity: 0.95;
}

.waveform-bars span {
  display: block;
  width: 2px;
  height: calc(var(--h) * 0.22px);
  border-radius: 999px;
  background: var(--wave);
  opacity: 0;
}

.process-indicator.is-speaking + .waveform-bars::before {
  opacity: 0;
}

.process-indicator.is-speaking + .waveform-bars span {
  opacity: 1;
  animation: pulseWave 0.72s ease-in-out infinite;
}

.waveform-bars span:nth-child(2n) {
  animation-delay: 0.08s;
}

.waveform-bars span:nth-child(3n) {
  animation-delay: 0.16s;
}

.waveform-bars span:nth-child(5n) {
  animation-delay: 0.24s;
}

@keyframes pulseWave {
  0%,
  100% {
    transform: scaleY(0.82);
  }

  50% {
    transform: scaleY(1.14);
  }
}

.audio-link-box {
  margin-top: 7px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: #fbfdfc;
  padding: 7px 8px;
  color: var(--muted);
  font-size: 12px;
  word-break: break-all;
}

.section-title,
.checklist-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, #fcfeff, #ebf2ff);
}

.section-title span,
.checklist-head span {
  color: var(--muted);
  font-size: 13px;
}

.transcript-card,
.collapsible-card {
  overflow: hidden;
}

.transcript-summary,
.collapsible-summary {
  cursor: pointer;
  list-style: none;
}

.transcript-summary::-webkit-details-marker,
.collapsible-summary::-webkit-details-marker {
  display: none;
}

.transcript-summary::after,
.collapsible-summary::after {
  content: "Развернуть";
  border: 1px solid var(--accent-soft);
  border-radius: 6px;
  background: #fff;
  color: var(--accent-strong);
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 600;
}

.transcript-card[open] .transcript-summary::after,
.collapsible-card[open] .collapsible-summary::after {
  content: "Свернуть";
}

#requiredCounter {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fcfeff;
  color: var(--muted);
  padding: 4px 7px;
  font-weight: 700;
}

#missingCount,
#additionalCount {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  border: 1px solid rgba(255, 51, 51, 0.24);
  border-radius: 999px;
  background: #fff7f7;
  padding: 3px 8px;
  color: var(--warn);
  white-space: nowrap;
}

#missingCount strong,
#additionalCount strong {
  color: var(--warn);
  font-size: 14px;
  line-height: 1;
}

#missingCount small,
#additionalCount small {
  color: #6d7b8a;
  font-size: 11px;
}

#missingCount.is-complete,
#additionalCount.is-complete {
  border-color: #a8ead5;
  background: #edf9f4;
}

#missingCount.is-complete strong,
#additionalCount.is-complete strong {
  color: #2c9b32;
}

#requiredCounter.is-complete {
  border-color: #a8ead5;
  background: #edf9f4;
}

.counter-percent {
  color: var(--accent-strong);
}

.counter-missing {
  color: var(--warn);
}

.counter-done {
  color: #2c9b32;
}

.summary-preview {
  display: grid;
  gap: 8px;
  min-height: 54px;
  padding: 10px 12px;
  background: #fcfeff;
  line-height: 1.42;
  cursor: text;
}

.summary-preview:focus {
  outline: 2px solid rgba(0, 134, 221, 0.22);
  outline-offset: -2px;
  background: #f8fcff;
}

.summary-line strong {
  color: var(--accent-strong);
  font-weight: 700;
}

.summary-empty,
.empty-transcript {
  color: var(--muted);
}

.transcript {
  min-height: 180px;
  max-height: 300px;
  overflow: auto;
  padding: 10px;
  background: #fcfeff;
  line-height: 1.55;
}

.speech {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 9px;
}

.speech--doctor {
  background: #ebf2ff;
  border-color: #b7def7;
}

.speech--patient {
  background: #f1fffb;
  border-color: #a8ead5;
}

.speech--active {
  border-color: var(--warn);
  box-shadow: 0 0 0 3px rgba(255, 51, 51, 0.18);
}

.speech__role {
  display: inline-flex;
  justify-content: center;
  border-radius: 6px;
  padding: 4px 7px;
  background: #fff;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
}

.field-editor {
  display: grid;
  gap: 8px;
  padding: 8px;
  background: #eef5fb;
}

.field-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfeff;
  overflow: hidden;
}

.field-section__head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  list-style: none;
}

.field-section__head::-webkit-details-marker {
  display: none;
}

.field-section__head h3 {
  flex: 1;
  color: #526477;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.field-section__head > span {
  color: #8a98a8;
  font-size: 12px;
}

.field-section__toggle {
  width: 18px;
  height: 18px;
  border: 1px solid var(--accent-soft);
  border-radius: 4px;
  background: #fff;
  color: var(--accent-strong);
  position: relative;
  flex: 0 0 auto;
}

.field-section__toggle::before,
.field-section__toggle::after {
  content: "";
  position: absolute;
  background: currentColor;
  border-radius: 2px;
  left: 4px;
  right: 4px;
  top: 8px;
  height: 2px;
}

.field-section__toggle::after {
  top: 4px;
  bottom: 4px;
  left: 8px;
  right: auto;
  width: 2px;
  height: auto;
}

.field-section[open] .field-section__toggle::after {
  opacity: 0;
}

.field-section:not([open]) .field-section__head {
  border-bottom: 0;
}

.section-progress {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  border: 1px solid rgba(0, 134, 221, 0.18);
  border-radius: 999px;
  background: #f4f9ff;
  color: var(--accent-strong);
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.section-progress.is-complete {
  border-color: #a8ead5;
  background: #edf9f4;
  color: #2c9b32;
}

.field-section__body {
  display: grid;
  gap: 3px;
  padding: 8px 10px 10px;
}

.field-row {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 0 0 4px;
  border: 0;
  border-bottom: 1px solid rgba(217, 231, 247, 0.65);
  border-radius: 0;
  background: transparent;
  scroll-margin-top: 84px;
  transition: background 0.2s ease, box-shadow 0.2s ease, padding 0.2s ease;
}

.field-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.field-row--missing {
  box-shadow: none;
  padding-left: 0;
}

.field-row--missing .field-label strong::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin: 0 6px 1px 0;
  border: 1px solid #aab7c4;
  border-radius: 50%;
  background: #fff;
}

.field-row.confidence-high {
  box-shadow: inset 2px 0 0 #57bd69;
  padding-left: 6px;
}

.field-row.confidence-medium {
  box-shadow: inset 2px 0 0 #d9a329;
  padding-left: 6px;
}

.field-row.confidence-low {
  box-shadow: inset 2px 0 0 #d9a329;
  padding-left: 6px;
}

.field-row--active {
  background: #f2f7ff;
  box-shadow: inset 3px 0 0 var(--accent-strong), 0 0 0 2px rgba(51, 68, 187, 0.12);
  padding: 8px;
  border-radius: 8px;
}

.field-label strong {
  display: inline-block;
  color: #96a4b2;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
}

.field-label small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 400;
}

.field-control {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.field-input-shell {
  position: relative;
  min-width: 0;
}

.field-input-shell textarea {
  padding-right: 38px;
}

.field-dot-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 26px;
  min-width: 26px;
  min-height: 26px;
  height: 26px;
  border-color: #cbd9e6;
  border-radius: 5px;
  background: #f7fafc;
  color: #607589;
  padding: 0 0 7px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}

.field-dot-btn:hover,
.field-dot-btn:focus-visible {
  border-color: #77bce9;
  background: #edf7ff;
  color: var(--accent-strong);
  outline: 0;
}

.field-history {
  max-height: 190px;
  overflow: auto;
  border: 1px solid #cfe0ef;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(32, 68, 104, 0.12);
  padding: 5px;
}

.field-history[hidden] {
  display: none;
}

.field-history__head {
  padding: 3px 5px 6px;
  color: #607589;
  font-size: 10px;
  font-weight: 600;
}

.field-history__list {
  display: grid;
  gap: 3px;
}

.field-history__option {
  width: 100%;
  min-height: 28px;
  border: 0;
  border-radius: 4px;
  background: #f7fafc;
  color: var(--ink);
  padding: 6px 8px;
  text-align: left;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.3;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.field-history__option:hover,
.field-history__option:focus-visible {
  background: #eaf5ff;
  color: #173b61;
  outline: 0;
}

.field-history__empty {
  color: #7b8d9e;
  padding: 6px 7px;
  font-size: 10px;
  line-height: 1.35;
}

.field-control small {
  display: none;
  color: #8a98a8;
  font-size: 10px;
  line-height: 1.25;
}

.field-control:focus-within small {
  display: block;
}

textarea {
  width: 100%;
  max-width: 100%;
  min-height: 36px;
  resize: vertical;
  border: 1px solid #d6e2ee;
  border-radius: 6px;
  background: #fff;
  padding: 7px 9px;
  color: var(--ink);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

textarea:focus {
  outline: 0;
  border-color: rgba(0, 134, 221, 0.72);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0, 134, 221, 0.1);
}

textarea.is-empty {
  border-color: #dce5ee;
  background: #fff;
}

textarea.is-empty::placeholder {
  color: #a6b1bc;
}

.checklist-head {
  margin: 0 0 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.checklist-head--additional {
  margin-top: 12px;
  border-top: 1px solid var(--line);
}

.checklist {
  display: grid;
  gap: 5px;
  margin-bottom: 12px;
}

.checklist-hint {
  margin: 8px 0;
  border: 1px solid #d9e7f7;
  border-radius: 6px;
  background: #f7fbff;
  color: #657b91;
  padding: 6px 8px;
  font-size: 10px;
  line-height: 1.25;
}

.check-item {
  width: 100%;
  min-height: 30px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  text-align: left;
  border: 1px solid #d9e3ed;
  border-radius: 6px;
  background: #fff;
  padding: 5px 7px;
  box-shadow: none;
}

.check-item strong {
  display: block;
  color: #151f27;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.18;
  text-transform: none;
}

.check-state {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--warn);
  border-radius: 50%;
  color: var(--warn);
  background: #fff;
  font-size: 8px;
  font-weight: 700;
}

.check-item--done {
  border-color: #8be36a;
  background: var(--ready);
  box-shadow: inset 2px 0 0 #4fc132;
}

.check-item--done strong {
  color: #236a1d;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.check-item--done .check-state {
  border-color: #35b642;
  background: #35b642;
}

.check-item--missing:hover {
  border-color: #9fc8e8;
  background: #f4f9ff;
}

.done-box {
  border-top: 1px solid var(--line);
  margin-top: 10px;
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.right-pane > .done-box:first-child {
  border-top: 0;
  margin-top: 0;
  margin-bottom: 12px;
}

.done-box summary {
  cursor: pointer;
  color: var(--ink);
  margin-bottom: 8px;
  font-size: 15px;
  font-weight: 700;
  list-style: none;
}

.done-box summary::-webkit-details-marker {
  display: none;
}

.done-list {
  display: grid;
  gap: 4px;
}

.done-item {
  border: 1px solid #8be36a;
  border-radius: 5px;
  background: var(--ready);
  padding: 4px 6px;
  color: #236a1d;
  font-size: 11px;
  box-shadow: inset 2px 0 0 #4fc132;
}

.done-item--button {
  width: 100%;
  min-height: 28px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  text-align: left;
  cursor: pointer;
  padding: 4px 6px;
}

.done-item--button small {
  color: #6d7d8a;
  font-size: 9px;
  font-weight: 400;
}

.done-item--button.confidence-high {
  border-color: #8be36a;
  background: var(--ready);
}

.done-item--button.confidence-medium {
  border-color: #ffd36d;
  background: #fff8e8;
  box-shadow: inset 2px 0 0 #f1a51b;
}

.done-item--button.confidence-low {
  border-color: rgba(255, 51, 51, 0.45);
  background: #fff0f0;
  box-shadow: inset 2px 0 0 var(--warn);
}

.done-item--button:hover {
  border-color: #4fc132;
  background: #dcffc9;
}

.done-item--button strong {
  font-size: 11px;
  font-weight: 400;
  line-height: 1.18;
  text-transform: none;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.done-item--button .check-state {
  border-color: #35b642;
  background: #35b642;
  color: #fff;
}

.done-item--empty {
  border-color: #8be36a;
  background: var(--ready);
  color: #236a1d;
  font-weight: 400;
}

.confidence-legend {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.confidence-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid currentColor;
}

.legend-dot--high {
  color: #35b642;
}

.legend-dot--medium {
  color: #f1a51b;
}

.legend-dot--low {
  color: var(--warn);
}

.audio-box {
  margin-top: 16px;
  padding: 12px;
}

.audio-placeholder {
  margin-top: 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 14px;
  color: var(--muted);
  background: #fcfeff;
}

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

dialog {
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.25);
  max-width: 480px;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.35);
}

.dialog-content {
  padding: 20px;
}

.dialog-content p {
  color: var(--muted);
  line-height: 1.45;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.report-dialog {
  width: min(1180px, calc(100vw - 32px));
  max-width: 1180px;
  max-height: calc(100vh - 32px);
  overflow: hidden;
}

.report-dialog__content {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 32px);
  padding: 18px;
}

.report-dialog__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.report-dialog__head h2 {
  margin: 0 0 5px;
  font-size: 20px;
}

.report-dialog__head p,
.report-status,
.report-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.report-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  padding: 14px 0;
}

.report-filters label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.report-filters input {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 5px 8px;
  font: inherit;
}

.report-totals {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f7fbff;
  overflow: hidden;
}

.report-totals span {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
  border-right: 1px solid var(--line);
  padding: 10px 12px;
}

.report-totals span:last-child {
  border-right: 0;
}

.report-totals strong {
  color: var(--accent-strong);
  font-size: 18px;
}

.report-totals small {
  color: var(--muted);
  font-size: 11px;
}

.report-status {
  min-height: 28px;
  padding: 8px 1px 5px;
}

.report-table-wrap {
  min-height: 180px;
  max-height: 58vh;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: auto;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  white-space: nowrap;
}

.report-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef6ff;
  color: #4d6175;
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.report-table th,
.report-table td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
}

.report-table tbody tr:hover {
  background: #f7fbff;
}

.report-table td:not(:nth-child(2)) {
  text-align: center;
}

.report-table th:not(:nth-child(2)) {
  text-align: center;
}

.report-empty {
  height: 140px;
  color: var(--muted);
  text-align: center !important;
}

.report-note {
  padding-top: 9px;
}

.training-btn {
  border-color: #7b8ce8;
  background: #f0f3ff;
  color: #3344bb;
  font-weight: 600;
}

.training-btn:hover {
  border-color: #3344bb;
  background: #e6ebff;
}

.training-dialog {
  width: min(1120px, calc(100vw - 28px));
  max-width: 1120px;
  max-height: calc(100vh - 28px);
  overflow: hidden;
}

.training-dialog__content {
  max-height: calc(100vh - 28px);
  overflow: auto;
  padding: 18px;
}

.training-system-status {
  margin: 14px 0;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  background: #f7fbff;
  padding: 10px 12px;
  color: #42586e;
  font-size: 12px;
  line-height: 1.45;
}

.training-system-status.is-ready {
  border-left-color: #31b54a;
  background: #f1ffec;
}

.training-system-status.is-warning {
  border-left-color: #f39b23;
  background: #fff9ec;
}

.training-dialect {
  display: grid;
  grid-template-columns: auto minmax(180px, 280px) minmax(220px, 1fr);
  align-items: center;
  gap: 8px;
  margin: -4px 0 14px;
  color: #52697f;
  font-size: 11px;
  font-weight: 600;
}

.training-dialect select {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 6px 9px;
  font: inherit;
}

.training-dialect small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 400;
  line-height: 1.35;
}

.training-tool {
  border-top: 1px solid var(--line);
  padding: 16px 0;
}

.training-tool__head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}

.training-tool__head > span {
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-strong);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
}

.training-tool__head h3 {
  color: #293b4e;
  font-size: 14px;
}

.training-tool__head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

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

.training-form-grid label,
.training-search,
.training-field__body label {
  display: grid;
  gap: 5px;
  color: #52697f;
  font-size: 10px;
  font-weight: 600;
}

.training-form-grid__wide {
  grid-column: 1 / -1;
}

.training-form-grid textarea,
.training-form-grid select,
.training-search input,
.training-field__body textarea,
.training-field__body select {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
  font: inherit;
  font-size: 12px;
  resize: vertical;
}

.training-form-grid textarea,
.training-field__body textarea {
  min-height: 64px;
}

.training-recorder,
.training-submit-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.training-recorder audio {
  width: min(360px, 100%);
  height: 34px;
}

.training-inline-status {
  min-height: 18px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.training-submit-row {
  justify-content: space-between;
}

.training-search {
  max-width: 420px;
  margin-bottom: 10px;
}

.training-field-list {
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
}

.training-field {
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.training-field:last-child {
  border-bottom: 0;
}

.training-field > summary {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 7px 10px;
  cursor: pointer;
  list-style: none;
}

.training-field > summary::-webkit-details-marker {
  display: none;
}

.training-field > summary::before {
  content: "+";
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid var(--accent-soft);
  border-radius: 4px;
  color: var(--accent-strong);
}

.training-field[open] > summary::before {
  content: "−";
}

.training-field > summary strong {
  color: #354a60;
  font-size: 11px;
  font-weight: 600;
}

.training-field > summary small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 400;
}

.training-field__body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  border-top: 1px solid var(--line);
  background: #f9fcff;
  padding: 10px 42px 12px;
}

.training-field__body p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.training-field__actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.learning-report {
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfdff;
  padding: 12px;
}

.learning-report > header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.learning-report h3 {
  font-size: 14px;
}

.learning-report header p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.learning-delta {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  padding: 5px 8px;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.learning-delta.is-positive {
  border-color: #9ddc8b;
  background: #f1ffec;
  color: #25803a;
}

.learning-delta.is-negative {
  border-color: #ffb0b0;
  background: #fff2f2;
  color: #c22b2b;
}

.learning-report-totals {
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  gap: 1px;
  margin-top: 10px;
  background: var(--line);
}

.learning-report-totals span {
  display: grid;
  gap: 2px;
  background: #fff;
  padding: 8px 10px;
}

.learning-report-totals strong {
  color: var(--accent-strong);
  font-size: 16px;
}

.learning-report-totals small {
  color: var(--muted);
  font-size: 9px;
}

.learning-chart-wrap {
  position: relative;
  min-height: 190px;
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.learning-chart-wrap canvas {
  display: block;
  width: 100%;
  height: 190px;
}

.learning-chart-wrap p {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 25px;
  color: var(--muted);
  text-align: center;
  font-size: 11px;
}

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

  .left-pane {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .audio-strip,
  .field-row {
    grid-template-columns: 1fr;
  }

  .deal__head,
  .timeline__bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .report-totals {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .report-totals span:nth-child(2) {
    border-right: 0;
  }

  .report-totals span:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .learning-report-totals,
  .training-form-grid,
  .training-field__body {
    grid-template-columns: 1fr;
  }

  .training-dialect {
    grid-template-columns: 1fr;
  }

  .training-form-grid__wide,
  .training-field__body p,
  .training-field__actions {
    grid-column: 1;
  }
}

@media (max-width: 760px) {
  .page {
    padding: 0;
  }

  .deal__head {
    padding: 8px;
    margin-bottom: 0;
  }

  .timeline {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  h1 {
    font-size: 16px;
  }

  .brand-mark img {
    width: 92px;
    max-height: 32px;
  }

  .report-dialog {
    width: calc(100vw - 12px);
    max-height: calc(100vh - 12px);
  }

  .report-dialog__content {
    max-height: calc(100vh - 12px);
    padding: 12px;
  }

  .report-dialog__head h2 {
    font-size: 16px;
  }

  .training-dialog {
    width: calc(100vw - 12px);
    max-height: calc(100vh - 12px);
  }

  .training-dialog__content {
    max-height: calc(100vh - 12px);
    padding: 12px;
  }

  .training-field__body {
    padding: 10px 12px 12px;
  }

  .report-filters label,
  .report-filters input,
  .report-filters button {
    flex: 1 1 140px;
  }
}

body.placement-activity {
  background: transparent;
}

body.placement-activity .page {
  max-width: none;
  padding: 0;
}

body.placement-activity .deal__head,
body.placement-activity .timeline__bar {
  display: none;
}

body.placement-activity .timeline {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

body.placement-activity .voice-widget {
  background: transparent;
}

body.placement-activity .workspace {
  grid-template-columns: minmax(0, 1fr) 240px;
  min-height: auto;
}

body.placement-activity .left-pane,
body.placement-activity .right-pane {
  padding: 8px;
}

body.placement-activity .toolbar {
  margin-bottom: 0;
  padding: 8px;
}

body.placement-activity .recording-dock {
  top: 0;
  margin: 0 0 8px;
  border-radius: 8px;
}

body.placement-activity .audio-card {
  padding: 7px 8px 8px;
}

body.placement-activity .audio-strip {
  grid-template-columns: 150px minmax(150px, 1fr) 130px auto;
  min-height: 30px;
}

body.placement-activity .summary-card,
body.placement-activity .live-card,
body.placement-activity .editor-card,
body.placement-activity .audio-card,
body.placement-activity .audio-box {
  border-radius: 8px;
}

body.placement-activity .transcript {
  max-height: 180px;
}

body.placement-activity .footer-actions {
  padding: 8px;
}

@media (max-width: 820px) {
  body.placement-activity .workspace {
    grid-template-columns: 1fr;
  }
}
