:root {
  color-scheme: dark;
  --bg: #111416;
  --panel: #1d2224;
  --panel-2: #252b2d;
  --line: #3a4346;
  --text: #f3f7f6;
  --muted: #a8b5b1;
  --accent: #49c6b1;
  --accent-2: #e2bd62;
  --danger: #ef6f6c;
  --ok: #83d483;
  --shadow: rgba(0, 0, 0, 0.34);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(120deg, rgba(73, 198, 177, 0.08), transparent 32%),
    linear-gradient(260deg, rgba(226, 189, 98, 0.08), transparent 36%),
    var(--bg);
  color: var(--text);
}

button,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  padding: 16px;
}

.dictation-panel,
.review-panel {
  background: rgba(29, 34, 36, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 22px 80px var(--shadow);
}

.dictation-panel {
  overflow: hidden;
}

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

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  font-size: clamp(1.45rem, 2.4vw, 2.2rem);
  line-height: 1.1;
}

h2 {
  font-size: 1rem;
}

.status-pill {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  background: var(--panel-2);
  font-size: 0.88rem;
}

.status-pill.ok {
  color: var(--ok);
  border-color: rgba(131, 212, 131, 0.36);
}

.status-pill.error {
  color: var(--danger);
  border-color: rgba(239, 111, 108, 0.42);
}

.status-pill.warning {
  color: var(--accent-2);
  border-color: rgba(226, 189, 98, 0.48);
}

.workspace-grid {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  min-height: calc(100vh - 122px);
}

.control-column {
  padding: 18px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.scan-visual {
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #11191c;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.scan-frame {
  position: relative;
  width: 78%;
  aspect-ratio: 0.78;
  border: 1px solid rgba(166, 235, 226, 0.28);
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.026), rgba(255, 255, 255, 0.026) 1px, transparent 1px, transparent 8px),
    radial-gradient(circle at center 38%, rgba(111, 177, 184, 0.34), transparent 50%),
    #0b1113;
  box-shadow: inset 0 0 50px rgba(73, 198, 177, 0.16);
}

.scan-line {
  position: absolute;
  inset: 0;
  height: 3px;
  background: rgba(73, 198, 177, 0.86);
  box-shadow: 0 0 18px rgba(73, 198, 177, 0.86);
  animation: scan 3.8s ease-in-out infinite;
}

.lung {
  position: absolute;
  top: 22%;
  width: 30%;
  height: 47%;
  border: 2px solid rgba(214, 242, 238, 0.42);
  background: rgba(214, 242, 238, 0.06);
}

.lung.left {
  left: 18%;
  border-radius: 46% 30% 38% 52%;
}

.lung.right {
  right: 18%;
  border-radius: 30% 46% 52% 38%;
}

.spine {
  position: absolute;
  top: 15%;
  left: 50%;
  width: 12px;
  height: 66%;
  transform: translateX(-50%);
  background: repeating-linear-gradient(180deg, rgba(238, 224, 185, 0.56), rgba(238, 224, 185, 0.56) 7px, transparent 7px, transparent 14px);
  opacity: 0.72;
}

.ribs {
  position: absolute;
  top: 26%;
  width: 30%;
  height: 36%;
  border-top: 2px solid rgba(214, 242, 238, 0.2);
  border-bottom: 2px solid rgba(214, 242, 238, 0.2);
}

.ribs-left {
  left: 16%;
  transform: skewY(-16deg);
}

.ribs-right {
  right: 16%;
  transform: skewY(16deg);
}

@keyframes scan {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(256px);
  }
}

.control-block {
  display: grid;
  gap: 8px;
}

label,
.metric-label,
.phrase-head span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

select,
textarea {
  width: 100%;
  color: var(--text);
  background: #121718;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
}

select {
  height: 42px;
  padding: 0 12px;
}

select:focus,
textarea:focus {
  border-color: rgba(73, 198, 177, 0.72);
  box-shadow: 0 0 0 3px rgba(73, 198, 177, 0.14);
}

.mic-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 10px;
}

.primary-button,
.icon-button,
.toolbar-actions button,
.phrase-head button,
.tab {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: var(--panel-2);
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--accent);
  color: #071312;
  border-color: transparent;
  font-weight: 800;
}

.primary-button.recording {
  background: var(--danger);
  color: #fff;
}

.button-icon {
  font-size: 0.72rem;
}

.icon-button {
  font-size: 1.35rem;
  line-height: 1;
}

.confidence-card,
.phrase-card,
.help-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(37, 43, 45, 0.62);
}

.help-card {
  border-color: rgba(226, 189, 98, 0.34);
}

.help-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--accent-2);
  font-size: 0.88rem;
}

.help-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.48;
}

.confidence-card strong {
  display: block;
  margin-top: 6px;
  font-size: 1.45rem;
}

.meter {
  height: 8px;
  margin-top: 12px;
  border-radius: 999px;
  background: #111718;
  overflow: hidden;
}

.meter span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transition: width 180ms ease;
}

.phrase-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.phrase-head button,
.toolbar-actions button {
  padding: 0 12px;
}

.phrase-card p {
  color: var(--muted);
  margin: 10px 0 0;
  line-height: 1.5;
}

.editor-column {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(360px, 1fr) auto auto;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

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

.tab {
  padding: 0 12px;
  color: var(--muted);
}

.tab.active {
  color: #071312;
  background: var(--accent-2);
  border-color: transparent;
  font-weight: 800;
}

textarea {
  min-height: 100%;
  resize: none;
  border: 0;
  border-radius: 0;
  padding: 22px;
  line-height: 1.65;
  font-size: 1.05rem;
}

.live-draft {
  display: none;
  border-top: 1px solid var(--line);
  padding: 12px 18px;
  background: rgba(73, 198, 177, 0.08);
}

.live-draft.active {
  display: block;
}

.live-draft span {
  display: block;
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
}

.live-draft p {
  margin: 0;
  color: var(--text);
  line-height: 1.45;
}

.live-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: rgba(18, 23, 24, 0.88);
}

.pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--muted);
}

.pulse-dot.recording {
  background: var(--danger);
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    transform: scale(1.35);
    opacity: 0.58;
  }
}

.review-panel {
  padding: 18px;
  display: grid;
  grid-template-rows: minmax(180px, auto) minmax(0, 1fr);
  gap: 18px;
}

.review-panel section {
  min-width: 0;
}

.review-panel h2 {
  margin-bottom: 12px;
}

#correctionList {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

#correctionList li {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--muted);
  background: rgba(18, 23, 24, 0.7);
  font-size: 0.9rem;
}

#reportPreview {
  height: 100%;
  min-height: 300px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  white-space: pre-wrap;
  color: #dce7e4;
  background: #111718;
  border: 1px solid var(--line);
  border-radius: 8px;
  line-height: 1.55;
}

dialog {
  width: min(760px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--panel);
}

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

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

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

.terms-grid span {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--muted);
  background: #121718;
}

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

  .workspace-grid {
    min-height: auto;
  }

  .review-panel {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
  }
}

@media (max-width: 780px) {
  .app-shell {
    padding: 10px;
  }

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

  .status-pill {
    align-self: flex-start;
  }

  .workspace-grid,
  .review-panel {
    grid-template-columns: 1fr;
  }

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

  .scan-visual {
    min-height: 210px;
  }

  .terms-grid {
    grid-template-columns: 1fr;
  }
}
