:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f7f7f4;
  color: #1f2428;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
}

button,
select,
textarea {
  font: inherit;
}

button,
select {
  min-height: 42px;
  border: 1px solid #c8c9c4;
  border-radius: 6px;
  background: #ffffff;
  color: #1f2428;
}

button {
  padding: 0 16px;
  cursor: pointer;
}

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

button svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.shell {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.workspace {
  display: grid;
  gap: 22px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #d8d9d2;
  padding-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: #687073;
  font-size: 0.88rem;
  text-transform: uppercase;
}

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

h1 {
  font-size: clamp(2rem, 5vw, 4.4rem);
  line-height: 0.95;
}

h2 {
  font-size: 1rem;
}

.health,
.meta,
.auth-user {
  color: #5d6669;
  font-size: 0.92rem;
}

.auth-user {
  border: 1px solid #d8d9d2;
  border-radius: 6px;
  background: #ffffff;
  padding: 10px 12px;
  color: #1f2428;
}

.logout-button {
  width: 42px;
  min-width: 42px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-color: #b42318;
  background: #b42318;
  color: #ffffff;
}

.logout-button:hover {
  background: #8f1d15;
  border-color: #8f1d15;
}

.build-info {
  position: fixed;
  right: 12px;
  bottom: 10px;
  z-index: 10;
  border: 1px solid rgba(216, 217, 210, 0.9);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
  color: #5d6669;
  font-size: 0.78rem;
  padding: 6px 8px;
  pointer-events: none;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 180px;
}

.field span,
.toggle {
  color: #4f585b;
  font-size: 0.9rem;
}

.field select {
  width: 100%;
  padding: 0 12px;
}

.compact-field {
  min-width: 0;
}

.toggle {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
}

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

.panel,
.result-panel {
  border: 1px solid #d8d9d2;
  border-radius: 8px;
  background: #ffffff;
}

.panel {
  min-height: 184px;
  display: grid;
  gap: 14px;
  align-content: start;
  padding: 18px;
}

.dropzone {
  min-height: 76px;
  display: grid;
  place-items: center;
  border: 1px dashed #9ca4a7;
  border-radius: 8px;
  color: #4f585b;
  text-align: center;
  padding: 12px;
}

.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.primary {
  background: #1f2428;
  color: #ffffff;
  border-color: #1f2428;
}

.recorder {
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #4f585b;
}

.dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #9ca4a7;
}

.dot.active {
  background: #c7332c;
}

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

.result-panel {
  display: grid;
  gap: 12px;
  padding: 18px;
}

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

.text-actions,
.summary-actions {
  align-items: center;
}

.summary-actions {
  justify-content: flex-end;
}

.icon-button {
  width: 42px;
  min-width: 42px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

.summary-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

textarea {
  width: 100%;
  min-height: 320px;
  resize: vertical;
  border: 1px solid #d8d9d2;
  border-radius: 8px 8px 0 0;
  padding: 14px 14px 34px;
  line-height: 1.5;
  color: #1f2428;
  background: #fbfbf8;
}

.transcript-box {
  display: grid;
  gap: 0;
}

.text-area-wrap {
  position: relative;
  display: grid;
}

.text-area-wrap textarea {
  grid-area: 1 / 1;
}

.char-count {
  grid-area: 1 / 1;
  align-self: end;
  justify-self: end;
  z-index: 2;
  margin: 0 12px 10px 0;
  color: #81898c;
  font-size: 0.78rem;
  pointer-events: none;
}

.text-box-footer {
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
  margin-top: -1px;
}

.text-tabs {
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
}

.text-tab {
  min-height: 38px;
  padding: 0 14px;
  border-color: #d8d9d2;
  border-radius: 0;
  background: #f0f1ec;
  color: #4f585b;
}

.text-tab:first-child {
  border-bottom-left-radius: 8px;
}

.text-tab:last-child {
  border-bottom-right-radius: 8px;
  margin-left: -1px;
}

.text-tab.active {
  position: relative;
  z-index: 1;
  background: #ffffff;
  border-top-color: #ffffff;
  color: #1f2428;
  font-weight: 650;
}

.text-tab.loading {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: #f7f7f4;
  color: #4f585b;
  font-weight: 550;
}

.text-tab.loading::before {
  content: "";
  width: 18px;
  height: 18px;
  border: 2px solid rgba(47, 111, 115, 0.18);
  border-top-color: #2f6f73;
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

.status-animation {
  position: absolute;
  inset: 1px;
  min-height: 318px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(251, 251, 248, 0.94), rgba(246, 246, 241, 0.96)),
    repeating-linear-gradient(90deg, transparent 0 18px, rgba(31, 36, 40, 0.035) 18px 19px);
  pointer-events: none;
  opacity: 0;
  transition: opacity 160ms ease;
}

.status-animation.active {
  opacity: 1;
}

.status-animation p {
  margin: 0;
  color: #4f585b;
  font-size: 0.94rem;
}

.wave-bars {
  height: 82px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.wave-bars span {
  width: 9px;
  height: 26px;
  border-radius: 999px;
  background: #2f6f73;
  animation: wave 900ms ease-in-out infinite;
}

.wave-bars span:nth-child(2) {
  animation-delay: 90ms;
}

.wave-bars span:nth-child(3) {
  animation-delay: 180ms;
}

.wave-bars span:nth-child(4) {
  animation-delay: 270ms;
}

.wave-bars span:nth-child(5) {
  animation-delay: 360ms;
}

.orbit {
  width: 84px;
  height: 84px;
  position: relative;
  display: none;
  border: 1px solid rgba(47, 111, 115, 0.28);
  border-radius: 50%;
  animation: spin 1700ms linear infinite;
}

.orbit i {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #2f6f73;
}

.orbit i:nth-child(1) {
  left: 50%;
  top: -6px;
}

.orbit i:nth-child(2) {
  right: 4px;
  bottom: 12px;
}

.orbit i:nth-child(3) {
  left: 4px;
  bottom: 12px;
}

.scan-line {
  width: min(420px, 72%);
  height: 92px;
  display: none;
  border: 1px solid rgba(47, 111, 115, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(90deg, transparent, rgba(47, 111, 115, 0.22), transparent),
    linear-gradient(180deg, rgba(47, 111, 115, 0.08), transparent 45%, rgba(31, 36, 40, 0.06));
  background-size: 38% 100%, 100% 100%;
  background-repeat: no-repeat;
  animation: scan 1500ms ease-in-out infinite;
}

.status-animation.preparing .scan-line,
.status-animation.loading .orbit {
  display: block;
}

.status-animation.preparing .wave-bars,
.status-animation.loading .wave-bars,
.status-animation.postprocess .wave-bars {
  display: none;
}

.status-animation.transcribing .wave-bars,
.status-animation.postprocess .orbit {
  display: flex;
}

.status-animation.postprocess .orbit {
  display: block;
  border-radius: 8px;
  transform: rotate(45deg);
}

.status-animation.done,
.status-animation.error {
  opacity: 0;
}

.transcript-box.has-transcript {
  display: grid;
  gap: 0;
}

.transcript-box.has-transcript .text-area-wrap {
  row-gap: 8px;
}

.transcript-box.has-transcript .status-animation {
  display: none;
  grid-area: 2 / 1;
  position: static;
  inset: auto;
  min-height: 56px;
  grid-template-columns: auto 1fr;
  place-items: center start;
  align-content: center;
  justify-content: start;
  gap: 12px;
  border: 1px solid #d8d9d2;
  background: #f7f7f4;
  padding: 8px 12px;
  opacity: 0;
}

.transcript-box.has-transcript .status-animation.active {
  display: grid;
  opacity: 1;
}

.transcript-box.has-transcript .wave-bars {
  height: 34px;
  gap: 5px;
}

.transcript-box.has-transcript .wave-bars span {
  width: 6px;
  height: 18px;
}

.transcript-box.has-transcript .orbit {
  width: 34px;
  height: 34px;
}

.transcript-box.has-transcript .orbit i {
  width: 8px;
  height: 8px;
}

.transcript-box.has-transcript .orbit i:nth-child(1) {
  top: -4px;
}

.transcript-box.has-transcript .scan-line {
  width: 120px;
  height: 34px;
}

@keyframes wave {
  0%,
  100% {
    height: 22px;
  }
  50% {
    height: 78px;
  }
}

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

@keyframes scan {
  0% {
    background-position: -45% 0, 0 0;
  }
  100% {
    background-position: 145% 0, 0 0;
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(100vw - 20px, 1120px);
    padding: 18px 0;
  }

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

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

  .field {
    min-width: min(100%, 220px);
    flex: 1;
  }

  .text-actions,
  .summary-actions {
    width: 100%;
  }

  .summary-actions select,
  .summary-actions .summary-button {
    flex: 1 1 150px;
  }

  .text-box-footer {
    flex-wrap: wrap;
    gap: 0;
  }
}
