:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --text: #172026;
  --muted: #667085;
  --line: #d7dee8;
  --line-soft: #ebeff5;
  --accent: #176c5f;
  --accent-strong: #0c4f47;
  --accent-soft: #e7f4f1;
  --focus: #b45309;
  --shadow: 0 14px 34px rgba(20, 36, 55, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #eef4fa 0, var(--bg) 260px),
    var(--bg);
  color: var(--text);
  font-family: Inter, Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin: 0;
}

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

.wide-shell {
  width: min(1280px, calc(100vw - 32px));
}

.app-shell {
  width: min(1320px, calc(100vw - 32px));
}

.auth-shell {
  width: min(460px, calc(100vw - 32px));
  margin: 64px auto;
}

.topbar,
.session-header,
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.topbar h1,
.session-header h1,
.app-header h1 {
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: 0;
}

.topbar p,
.session-header p,
.app-header p,
.panel header span {
  color: var(--muted);
  font-size: 14px;
  margin-top: 4px;
}

.eyebrow {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.list-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
  margin: 16px 0;
  overflow: auto;
}

.sessions-panel {
  padding: 0;
}

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

.list-header h2 {
  font-size: 18px;
}

.list-header p {
  color: var(--muted);
  font-size: 14px;
  margin-top: 4px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.metric-card {
  min-height: 96px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
  display: grid;
  align-content: space-between;
}

.metric-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric-card strong {
  color: var(--text);
  font-size: 30px;
  line-height: 1;
}

.messages {
  border: 1px solid #b7d7cf;
  background: #eef8f5;
  color: #0f4d44;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 12px 0;
}

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

.settings-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 14px;
  align-items: end;
}

.session-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.session-table th,
.session-table td {
  border-bottom: 1px solid var(--line-soft);
  padding: 14px 16px;
  text-align: left;
  vertical-align: middle;
}

.session-table th {
  background: #f8fafc;
  color: #475467;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
}

.session-table tbody tr:hover {
  background: #f8fbfd;
}

.row-subtext {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

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

.row-actions a,
.session-table a {
  color: var(--accent-strong);
  font-weight: 700;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f8fafc;
  color: #344054;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
  text-transform: capitalize;
}

.status-complete {
  border-color: #a7d6c8;
  background: #eaf8f2;
  color: #0f5b49;
}

.status-error {
  border-color: #f1b8b8;
  background: #fff0f0;
  color: #a12c2c;
}

.status-streaming,
.status-starting {
  border-color: #b8c8f1;
  background: #eff4ff;
  color: #2b4a9b;
}

.grid-two {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
}

.field {
  display: grid;
  gap: 8px;
}

label {
  color: #344054;
  font-size: 14px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--text);
  background: #ffffff;
  font: inherit;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus,
a:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.toggle {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.toggle input {
  width: 18px;
  height: 18px;
}

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

button,
.export-links a {
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  padding: 10px 14px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.export-links a:hover {
  background: var(--accent-strong);
}

.secondary-action,
.export-links a:not(.primary-action) {
  border-color: var(--line);
  background: #ffffff;
  color: #344054;
}

.secondary-action:hover,
.export-links a:not(.primary-action):hover {
  border-color: #b9c5d4;
  background: #f8fafc;
  color: #1f2937;
}

.primary-action {
  box-shadow: 0 8px 18px rgba(23, 108, 95, 0.18);
}

.export-links form {
  margin: 0;
}

.session-shell {
  width: min(1600px, calc(100vw - 24px));
  margin: 16px auto;
}

.export-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.scroll-toggle {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: #344054;
  padding: 8px 10px;
  font-size: 14px;
}

.scroll-toggle input {
  width: 16px;
  height: 16px;
}

.player-bar {
  display: grid;
  grid-template-columns: minmax(240px, 520px) minmax(260px, auto) minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.player-bar audio {
  width: 100%;
  height: 38px;
}

.share-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.filter-dialog {
  width: min(560px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 24px 72px rgba(13, 27, 42, 0.28);
}

.filter-dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
}

.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.46);
  backdrop-filter: blur(3px);
  padding: 24px;
}

.busy-overlay[hidden] {
  display: none;
}

.busy-card {
  width: min(420px, 100%);
  background: #ffffff;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  box-shadow: 0 24px 72px rgba(13, 27, 42, 0.28);
  padding: 24px;
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
}

.busy-card strong {
  font-size: 18px;
}

.busy-card p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.busy-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid #dce8e5;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.busy-progress {
  width: 100%;
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2f7;
}

.busy-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.2s ease;
}

.busy-progress-text {
  min-height: 20px;
}

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

.filter-modal {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.modal-header,
.modal-actions {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.modal-header h2 {
  font-size: 20px;
}

.modal-header p {
  color: var(--muted);
  font-size: 14px;
  margin-top: 4px;
}

.modal-actions {
  align-items: center;
  justify-content: flex-end;
}

.modal-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.icon-button {
  width: 36px;
  height: 36px;
  padding: 0;
  border-color: var(--line);
  background: #ffffff;
  color: #344054;
  font-size: 22px;
  line-height: 1;
}

.share-strip a {
  color: var(--accent-strong);
  overflow-wrap: anywhere;
}

#openai-status {
  color: var(--muted);
  font-size: 14px;
}

.live-meter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.live-meter span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: #ffffff;
  color: #344054;
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 800;
}

#live-state {
  border-color: #a7d6c8;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.display-modal input[type="color"] {
  min-height: 42px;
  padding: 4px;
}

.display-modal input[type="range"] {
  min-height: 42px;
}

.panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  height: calc(100vh - 98px);
}

.session-shell[data-notes-enabled="true"] .panels {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel {
  min-width: 0;
  min-height: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.panel header {
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
}

.panel h2 {
  font-size: 16px;
}

.panel-body {
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-rows: auto 1fr;
}

.transcript {
  overflow: visible;
  padding: 18px 20px;
  line-height: 1.65;
  font-size: 16px;
}

.segment,
.section {
  margin: 0 0 12px;
  padding-bottom: 0;
  border-bottom: 0;
}

.segment {
  max-width: 76ch;
}

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

.word-button {
  display: inline;
  width: auto;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: inherit;
  padding: 1px;
  font: inherit;
  font-weight: inherit;
  cursor: pointer;
}

.word-button:hover,
.word-button:focus {
  background: #e6f2ef;
  color: var(--accent-strong);
}

.markdown-body {
  white-space: normal;
}

.markdown-body h3,
.markdown-body h4,
.markdown-body h5 {
  margin: 16px 0 8px;
  color: #111827;
  font-size: 17px;
  line-height: 1.35;
}

.markdown-body h3:first-child,
.markdown-body h4:first-child,
.markdown-body h5:first-child {
  margin-top: 0;
}

.markdown-body p {
  margin: 0 0 10px;
}

.markdown-body ul,
.markdown-body ol {
  margin: 0 0 12px 22px;
  padding: 0;
}

.markdown-body li {
  margin: 4px 0;
}

.markdown-body strong {
  font-weight: 700;
}

.markdown-body em {
  font-style: italic;
}

.partial-wrap {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f9fafb;
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
}

.partial-label,
.note-timestamp {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
  margin-bottom: 4px;
}

.partial {
  color: #344054;
  min-height: 28px;
  font-size: 15px;
  line-height: 1.4;
}

.notes {
  white-space: pre-wrap;
}

.note-section {
  border-bottom: 1px solid #edf0f4;
  padding-bottom: 12px;
}

@media (max-width: 980px) {
  .panels,
  .session-shell[data-notes-enabled="true"] .panels {
    grid-template-columns: 1fr;
    height: auto;
  }

  .panel {
    min-height: 420px;
  }

  .grid-two,
  .topbar,
  .session-header,
  .app-header,
  .list-header {
    grid-template-columns: 1fr;
    display: grid;
  }

  .actions,
  .export-links {
    justify-content: start;
  }

  .player-bar {
    grid-template-columns: 1fr;
  }

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

  .metric-grid,
  .modal-grid {
    grid-template-columns: 1fr;
  }

  .session-table {
    min-width: 700px;
  }
}
