:root {
  color-scheme: light;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #eef1f4;
  --text: #1d252d;
  --muted: #607080;
  --line: #d7dde4;
  --accent: #16635d;
  --accent-2: #0f766e;
  --danger: #b42318;
  --warn: #9a5b00;
  --shadow: 0 18px 60px rgba(29, 37, 45, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 14px;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
}

button:hover:not(:disabled) {
  border-color: #9aa8b5;
}

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

button.primary {
  color: #ffffff;
  border-color: var(--accent);
  background: var(--accent);
}

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

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  font-weight: 760;
  line-height: 1.08;
}

h2 {
  font-size: 15px;
  font-weight: 730;
}

#health {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.status-pill {
  min-width: 104px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
  text-align: center;
  font-size: 14px;
  font-weight: 650;
}

.status-pill.live {
  color: #ffffff;
  border-color: var(--danger);
  background: var(--danger);
}

.control-band {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 14px;
  align-items: end;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
  text-transform: uppercase;
}

input[type="text"] {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  color: var(--text);
  background: var(--surface);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

.segmented {
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.segmented button {
  border-color: transparent;
  background: transparent;
}

.segmented button.selected {
  border-color: var(--line);
  background: var(--surface);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(340px, 0.8fr);
  gap: 18px;
  margin-top: 18px;
}

.transcript-panel,
.speaker-panel,
.notes-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.transcript-panel {
  min-height: 640px;
}

.side-panel {
  display: grid;
  gap: 18px;
  align-content: start;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

.panel-heading span {
  color: var(--muted);
  font-size: 13px;
}

.transcript {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 14px;
  height: min(62vh, 680px);
  min-height: 360px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.segment {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #edf0f2;
}

.speaker {
  color: var(--accent);
  font-weight: 760;
  overflow-wrap: anywhere;
}

.segment p {
  line-height: 1.45;
}

.speaker-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.speaker-row {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.speaker-key {
  color: var(--muted);
  font-weight: 720;
}

.notes {
  min-height: 330px;
  max-height: calc(100vh - 476px);
  margin: 0;
  padding: 14px;
  overflow: auto;
  white-space: pre-wrap;
  line-height: 1.42;
}

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

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: min(440px, calc(100vw - 40px));
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.toast.error {
  color: var(--danger);
}

.toast.warn {
  color: var(--warn);
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100vw - 20px, 760px);
    padding-top: 14px;
  }

  .topbar,
  .control-band,
  .workspace {
    grid-template-columns: 1fr;
  }

  .topbar,
  .segmented,
  .button-row {
    align-items: stretch;
  }

  .topbar,
  .segmented,
  .button-row {
    display: grid;
  }

  .workspace {
    display: grid;
  }

  .transcript-panel {
    min-height: 420px;
  }

  .transcript {
    height: 48vh;
    min-height: 320px;
  }

  .segment {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .notes {
    max-height: none;
  }
}
