:root {
  --page: #f4f6f4;
  --surface: #ffffff;
  --surface-soft: #eef2ef;
  --ink: #17201d;
  --muted: #66736d;
  --line: #d9e0dc;
  --line-strong: #c4cec8;
  --teal: #00b9aa;
  --teal-dark: #08796f;
  --amber: #d4952b;
  --red: #cf3d55;
  --green: #2d9d69;
  --nav: #101615;
  --nav-soft: #1a2422;
  --shadow: 0 18px 42px rgba(23, 32, 29, 0.12);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--page);
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(0, 185, 170, 0.08), transparent 260px),
    var(--page);
}

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

button {
  cursor: pointer;
}

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

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  margin-bottom: 0;
  line-height: 1.1;
}

.noscript {
  margin: 20px;
  padding: 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.top-banner {
  position: fixed;
  top: 16px;
  left: 50%;
  z-index: 50;
  max-width: min(560px, calc(100vw - 32px));
  transform: translateX(-50%);
  padding: 12px 16px;
  color: #fff;
  background: rgba(16, 22, 21, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  padding: 32px;
  place-items: center;
}

.auth-panel {
  width: min(1120px, 100%);
  min-height: 640px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.web-auth {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  overflow: hidden;
}

.auth-copy {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  padding: 42px;
  color: #eef7f4;
  background:
    linear-gradient(135deg, rgba(0, 185, 170, 0.18), transparent 40%),
    var(--nav);
}

.brand-lockup,
.brand-inline,
.panel-heading,
.profile-row,
.button-row,
.topbar-actions,
.page-heading,
.workspace-title {
  display: flex;
  align-items: center;
}

.brand-lockup {
  gap: 14px;
}

.brand-icon {
  width: 58px;
  height: 58px;
  border-radius: 14px;
}

.mini-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.auth-copy h1 {
  max-width: 620px;
  font-size: clamp(2.4rem, 5vw, 4.6rem);
}

.auth-lead {
  max-width: 520px;
  margin: 24px 0;
  color: rgba(238, 247, 244, 0.72);
  font-size: 1.08rem;
  line-height: 1.55;
}

.auth-preview {
  max-width: 620px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
}

.preview-toolbar {
  display: flex;
  gap: 7px;
  margin-bottom: 14px;
}

.preview-toolbar span {
  width: 9px;
  height: 9px;
  background: rgba(255, 255, 255, 0.34);
  border-radius: 999px;
}

.preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.preview-block,
.preview-line {
  min-height: 70px;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 6px;
}

.preview-block.wide {
  grid-column: 1 / -1;
  min-height: 92px;
  background: linear-gradient(90deg, rgba(0, 185, 170, 0.42), rgba(212, 149, 43, 0.34));
}

.preview-line {
  grid-column: 1 / -1;
  min-height: 12px;
}

.preview-line.short {
  width: 70%;
}

.auth-points {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.auth-points span {
  padding: 8px 10px;
  color: rgba(238, 247, 244, 0.86);
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 800;
}

.auth-card {
  display: grid;
  align-content: center;
  gap: 14px;
  padding: 42px;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.segment {
  min-height: 38px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-weight: 850;
}

.segment.active {
  color: #fff;
  background: var(--nav);
}

.auth-form,
.field,
.account-grid,
.editor-grid {
  display: grid;
  gap: 12px;
}

.field span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 850;
}

.field input,
.field select,
textarea {
  width: 100%;
  min-width: 0;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  outline: none;
}

.field input,
.field select {
  height: 42px;
  padding: 0 12px;
}

.field input:focus,
.field select:focus,
textarea:focus {
  border-color: var(--teal-dark);
  box-shadow: 0 0 0 3px rgba(0, 185, 170, 0.16);
}

.check-row {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

.primary-button,
.secondary-button,
.danger-button,
.ghost-button,
.subtle-button,
.file-button,
.icon-text-button,
.format-button,
.choice-button,
.rail-button {
  min-height: 40px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-weight: 850;
}

.primary-button {
  color: #fff;
  background: var(--teal-dark);
  border-color: var(--teal-dark);
}

.secondary-button,
.ghost-button,
.subtle-button,
.icon-text-button,
.format-button,
.choice-button {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line-strong);
}

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

.primary-button,
.secondary-button,
.danger-button,
.ghost-button,
.file-button,
.icon-text-button,
.subtle-button {
  padding: 0 14px;
}

.full {
  width: 100%;
}

.feedback {
  min-height: 22px;
  margin-bottom: 0;
  color: var(--red);
  font-weight: 750;
}

.app-shell {
  min-height: 100vh;
  padding: 16px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(210px, 0.8fr) minmax(220px, 1fr) auto;
  gap: 14px;
  align-items: center;
  max-width: 1440px;
  min-height: 64px;
  margin: 0 auto 14px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 26px rgba(23, 32, 29, 0.06);
}

.brand-inline {
  min-width: 0;
  gap: 10px;
}

.brand-inline div,
.workspace-title {
  min-width: 0;
}

.brand-inline strong,
.brand-inline span,
.workspace-title strong,
.workspace-title span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-inline span,
.workspace-title span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

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

.workspace-title strong {
  max-width: 100%;
  font-size: 1.05rem;
}

.topbar-actions {
  justify-content: flex-end;
  gap: 8px;
}

.service-pill {
  display: grid;
  grid-template-columns: auto auto auto;
  gap: 8px;
  align-items: center;
  min-height: 40px;
  padding: 7px 12px;
  color: var(--ink);
  background: rgba(238, 242, 239, 0.82);
  border: 1px solid rgba(196, 206, 200, 0.72);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 850;
  white-space: nowrap;
}

.service-pill strong {
  position: relative;
  padding-left: 10px;
  color: var(--muted);
  font-size: 0.78rem;
}

.service-pill strong::before {
  position: absolute;
  left: 0;
  top: 50%;
  width: 1px;
  height: 14px;
  content: "";
  background: var(--line-strong);
  transform: translateY(-50%);
}

.service-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(212, 149, 43, 0.13);
}

.service-dot.online {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(45, 157, 105, 0.14);
}

.service-dot.offline {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(207, 61, 85, 0.14);
}

.status-pill,
.badge,
.timer {
  border-radius: 999px;
  font-weight: 850;
  white-space: nowrap;
}

.status-pill {
  max-width: 260px;
  overflow: hidden;
  padding: 9px 12px;
  color: var(--teal-dark);
  text-overflow: ellipsis;
  background: rgba(0, 185, 170, 0.10);
  border: 1px solid rgba(0, 185, 170, 0.22);
}

.workspace {
  display: grid;
  grid-template-columns: 226px minmax(0, 1fr);
  gap: 14px;
  max-width: 1440px;
  margin: 0 auto;
  align-items: start;
}

.rail {
  position: sticky;
  top: 16px;
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: calc(100vh - 96px);
  padding: 12px;
  color: rgba(255, 255, 255, 0.76);
  background: var(--nav);
  border-radius: var(--radius);
}

.nav-label {
  margin: 2px 8px 6px;
  color: rgba(255, 255, 255, 0.48);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.rail-button {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  justify-items: start;
  min-height: 44px;
  padding: 0 10px;
  color: rgba(255, 255, 255, 0.72);
  background: transparent;
  border-color: transparent;
}

.rail-button.active {
  color: #fff;
  background: var(--nav-soft);
  border-color: rgba(255, 255, 255, 0.10);
}

.rail-icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.10);
  font-size: 0.72rem;
}

.sidebar-note {
  display: grid;
  gap: 5px;
  margin-top: auto;
  padding: 12px;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: var(--radius);
}

.sidebar-note strong {
  color: #fff;
  font-size: 0.88rem;
}

.sidebar-note span {
  font-size: 0.8rem;
  line-height: 1.35;
}

.page {
  display: none;
  min-width: 0;
}

.page.active {
  display: block;
}

#convertPage.page.active {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 14px;
  align-items: start;
}

#convertPage .tool-grid {
  display: contents;
}

#convertPage .recorder-panel {
  grid-column: 1;
}

#convertPage .options-panel {
  position: sticky;
  top: 16px;
  grid-column: 2;
  grid-row: 1 / span 2;
}

#convertPage .editor-grid {
  grid-column: 1;
}

.panel {
  min-width: 0;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 26px rgba(23, 32, 29, 0.06);
}

.panel-heading,
.page-heading {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-heading.slim {
  margin-bottom: 12px;
}

.panel-heading h2 {
  font-size: 1.35rem;
}

.panel-heading h3 {
  font-size: 1rem;
}

.timer {
  min-width: 78px;
  padding: 8px 12px;
  text-align: center;
  color: #fff;
  background: var(--nav);
}

.recorder-meter {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  height: 96px;
  align-items: end;
  padding: 12px;
  margin: 12px 0 16px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.recorder-meter span {
  display: block;
  min-height: 12px;
  border-radius: 5px 5px 0 0;
  background: linear-gradient(180deg, var(--teal), var(--teal-dark));
  transform-origin: bottom;
  transition: height 160ms ease;
}

.recorder-meter span:nth-child(1) { height: 28%; }
.recorder-meter span:nth-child(2) { height: 62%; }
.recorder-meter span:nth-child(3) { height: 44%; }
.recorder-meter span:nth-child(4) { height: 72%; }
.recorder-meter span:nth-child(5) { height: 36%; }
.recorder-meter span:nth-child(6) { height: 54%; }

.recorder-meter.active span {
  animation: meter 820ms infinite ease-in-out;
}

.recorder-meter.active span:nth-child(2) { animation-delay: 90ms; }
.recorder-meter.active span:nth-child(3) { animation-delay: 180ms; }
.recorder-meter.active span:nth-child(4) { animation-delay: 270ms; }
.recorder-meter.active span:nth-child(5) { animation-delay: 360ms; }
.recorder-meter.active span:nth-child(6) { animation-delay: 450ms; }

@keyframes meter {
  0%, 100% { transform: scaleY(0.45); }
  50% { transform: scaleY(1); }
}

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

.button-row.tight {
  display: grid;
  grid-template-columns: 1fr;
}

.file-button {
  display: inline-grid;
  place-items: center;
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line-strong);
}

.file-button input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

#audioPreview {
  width: 100%;
  margin-top: 14px;
}

.process-status {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--teal-dark);
  font-size: 0.9rem;
  font-weight: 800;
}

.processing-panel {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 12px;
  background:
    linear-gradient(180deg, rgba(0, 185, 170, 0.08), rgba(255, 255, 255, 0)),
    var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.progress-meta,
.progress-details {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.progress-meta strong {
  color: var(--ink);
}

.progress-track {
  height: 9px;
  overflow: hidden;
  background: rgba(23, 32, 29, 0.10);
  border-radius: 999px;
}

.progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--teal-dark), var(--teal));
  border-radius: inherit;
  transition: width 420ms ease;
}

.choice-grid {
  display: grid;
  gap: 10px;
}

.choice-button {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 13px;
  text-align: left;
}

.choice-button span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
}

.choice-button.active,
.format-button.active {
  color: #fff;
  background: var(--nav);
}

.export-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0;
}

.editor-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.editor-panel {
  display: grid;
  grid-template-rows: auto minmax(430px, 1fr);
}

textarea,
.markdown-preview {
  min-height: 430px;
  padding: 14px;
  line-height: 1.55;
  resize: vertical;
}

.markdown-preview {
  overflow: auto;
  margin: 0;
  color: #edf6f3;
  background: var(--nav);
  border-radius: var(--radius);
  white-space: pre-wrap;
}

.badge {
  padding: 6px 9px;
  color: var(--teal-dark);
  background: rgba(0, 185, 170, 0.10);
  font-size: 0.74rem;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 16px;
  align-items: center;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.history-card h3 {
  font-size: 1rem;
}

.history-card p {
  grid-column: 1;
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.history-actions {
  grid-column: 2;
  grid-row: 1 / span 3;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.empty-state {
  padding: 24px;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}

.account-grid {
  grid-template-columns: minmax(0, 0.85fr) minmax(340px, 1.15fr);
  gap: 14px;
}

.profile-row {
  gap: 12px;
  margin-bottom: 16px;
}

.avatar {
  display: grid;
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  place-items: center;
  color: #fff;
  background: var(--teal-dark);
  border-radius: 8px;
  font-size: 1.2rem;
  font-weight: 900;
}

.profile-row p {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 750;
}

.profile-dialog {
  width: min(420px, calc(100vw - 24px));
  padding: 0;
  background: transparent;
  border: 0;
}

.profile-dialog::backdrop {
  background: rgba(0, 0, 0, 0.54);
}

.dialog-panel {
  display: grid;
  gap: 12px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

@media (max-width: 1120px) {
  #convertPage.page.active,
  .workspace,
  .account-grid {
    grid-template-columns: 1fr;
  }

  .rail,
  #convertPage .options-panel {
    position: static;
  }

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

  .nav-label,
  .sidebar-note {
    display: none;
  }

  #convertPage .recorder-panel,
  #convertPage .options-panel,
  #convertPage .editor-grid {
    grid-column: 1;
  }

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

@media (max-width: 860px) {
  .web-auth,
  .topbar,
  .editor-grid {
    grid-template-columns: 1fr;
  }

  .auth-copy,
  .auth-card {
    padding: 24px;
  }

  .auth-panel {
    min-height: 0;
  }

  .topbar-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

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

  .panel {
    padding: 14px;
  }

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

  .rail-button {
    grid-template-columns: 30px minmax(0, 1fr);
    justify-items: start;
  }

  .panel-heading,
  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .button-row > *,
  .button-row.tight > * {
    width: 100%;
  }

  .button-row.tight {
    grid-template-columns: 1fr;
  }

  .history-card,
  .history-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .history-actions {
    grid-column: 1;
    grid-row: auto;
  }

  .service-pill {
    width: 100%;
    grid-template-columns: auto minmax(0, 1fr) auto;
  }
}
