:root {
  --bg: #fafafa;
  --panel: #ffffff;
  --line: #ececec;
  --text: #111111;
  --muted: #6b6b6b;
  --soft: #f3f3f3;
  --accent: #111111;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --warn-bg: #fffaeb;
  --warn: #b54708;
  --ok: #027a48;
  --shadow: 0 24px 80px rgba(17, 17, 17, 0.06);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font: inherit;
}

.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: var(--panel);
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

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

.mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--accent);
  color: white;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.eyebrow {
  margin: 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.sidebar h1,
.main h2 {
  margin: 4px 0 0;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.motto {
  margin: 2px 0 0;
  font-size: 0.72rem;
  color: var(--ok);
  font-weight: 500;
  letter-spacing: 0.01em;
}

.sidebar-meta {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.86rem;
  color: var(--muted);
}

.meta-row strong {
  color: var(--text);
  font-weight: 500;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  word-break: break-all;
}

.session-details {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.session-details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.86rem;
  margin-bottom: 12px;
}

.session-details label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 10px;
}

.session-details input {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--bg);
}

.main {
  padding: 48px clamp(24px, 5vw, 72px);
  max-width: 920px;
}

.main > .alert {
  margin-bottom: 20px;
}

.hero,
.workspace,
.results {
  animation: fade 0.35s ease;
}

@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.lede {
  max-width: 52ch;
  color: var(--muted);
  line-height: 1.7;
  margin: 14px 0 28px;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 12px 20px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.btn:hover:not(:disabled) {
  opacity: 0.86;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-dark {
  background: var(--accent);
  color: white;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

.mic-select-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  width: min(320px, 100%);
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--muted);
}

.mic-select-row select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.capture-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 36px 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.mic-btn {
  width: 96px;
  height: 96px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--soft);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: 0.2s ease;
}

.mic-btn svg {
  width: 34px;
  height: 34px;
  fill: currentColor;
}

.mic-btn:hover {
  transform: scale(1.03);
}

.mic-btn.recording {
  background: #111;
  border-color: #111;
  animation: pulse-ring 1.4s infinite;
}

.mic-btn.recording svg {
  fill: white;
}

@keyframes pulse-ring {
  0% {
    box-shadow: 0 0 0 0 rgba(17, 17, 17, 0.18);
  }
  70% {
    box-shadow: 0 0 0 16px rgba(17, 17, 17, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(17, 17, 17, 0);
  }
}

.capture-label {
  margin: 18px 0 6px;
  font-size: 0.95rem;
}

.timer {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.mic-meter {
  width: 160px;
  height: 6px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin: 10px auto 4px;
}

.mic-meter-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.1s ease;
}

.mic-hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.capture-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
  justify-content: center;
}

.divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  margin: 28px 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.divider::before,
.divider::after {
  content: '';
  height: 1px;
  background: var(--line);
}

.transcript-panel {
  display: grid;
  gap: 12px;
}

textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 18px;
  resize: vertical;
  min-height: 110px;
  background: var(--panel);
  line-height: 1.6;
}

textarea:focus {
  outline: 2px solid #d5d5d5;
  border-color: #d5d5d5;
}

.results {
  margin-top: 36px;
}

.results-top {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 20px;
}

.results-actions {
  display: flex;
  gap: 8px;
}

.alert {
  padding: 14px 16px;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.5;
  margin-bottom: 16px;
}

.alert-error {
  background: var(--danger-bg);
  color: var(--danger);
}

.alert-warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.note-card,
.note-grid > div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px 20px;
}

.note-card h3,
.note-grid h3 {
  margin: 0 0 12px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 500;
}

.note-card p {
  margin: 0;
  line-height: 1.7;
}

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

.compare-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
}

.compare-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.compare-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.compare-meta {
  font-size: 0.75rem;
  color: var(--muted);
}

.compare-model {
  margin: 0 0 10px;
  font-size: 0.78rem;
  color: var(--muted);
}

.compare-text {
  margin: 0 0 12px;
  line-height: 1.6;
  font-size: 0.92rem;
  min-height: 48px;
}

.compare-footer {
  display: flex;
  align-items: center;
  gap: 8px;
}

.provider-label {
  margin: 0 0 8px;
  font-size: 0.78rem;
  color: var(--muted);
}

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

.note-grid ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.note-grid li {
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 12px;
  font-size: 0.94rem;
  line-height: 1.5;
}

.tag {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  vertical-align: middle;
}

.tag-match {
  background: #ecfdf3;
  color: var(--ok);
}

.tag-custom {
  background: var(--soft);
  color: var(--muted);
}

.empty-line {
  color: var(--muted);
  font-size: 0.92rem;
}

.code-block {
  margin-top: 16px;
  padding: 18px;
  background: #101010;
  color: #f5f5f5;
  border-radius: 18px;
  overflow: auto;
  font-size: 0.78rem;
  line-height: 1.6;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(250, 250, 250, 0.72);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  gap: 14px;
  z-index: 20;
}

.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid #ddd;
  border-top-color: #111;
  animation: spin 0.8s linear infinite;
}

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

.overlay p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.hidden {
  display: none !important;
}

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

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .comparison-grid,
  .note-grid {
    grid-template-columns: 1fr;
  }

  .results-top {
    flex-direction: column;
    align-items: start;
  }
}

body.embed-mode .sidebar {
  display: none;
}

body.embed-mode .layout {
  grid-template-columns: 1fr;
}

body.embed-mode .hero {
  display: none;
}

body.embed-mode .workspace {
  display: block !important;
}

body.embed-mode .main {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 16px;
}

body.embed-mode .capture-panel {
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  text-align: center;
}

body.embed-mode .capture-actions {
  justify-content: center;
}

body.embed-mode .results,
body.embed-mode .alert {
  display: none !important;
}

body.embed-mode .mic-btn {
  margin: 0 auto;
}

body.embed-mode .overlay {
  background: rgba(255, 255, 255, 0.92);
}

body.embed-mode .overlay p {
  color: var(--text);
  font-weight: 500;
}

.medical-doc-preview {
  font-size: 0.9rem;
  line-height: 1.5;
  text-align: left;
  max-height: 280px;
  overflow-y: auto;
}

.medical-doc-preview ul {
  margin: 0.5rem 0;
  padding-left: 1.25rem;
}
