:root {
  color-scheme: light;
  --bg: #eef3f8;
  --surface: #ffffff;
  --surface-soft: #f7fafc;
  --ink: #18212f;
  --muted: #5c6b7c;
  --line: #d8e1ea;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --accent-soft: #dff6f3;
  --warn: #b45309;
  --danger: #b91c1c;
  --shadow: 0 18px 45px rgba(25, 42, 70, 0.11);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.14), transparent 38%),
    linear-gradient(315deg, rgba(37, 99, 235, 0.10), transparent 36%),
    var(--bg);
  color: var(--ink);
}

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

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  width: min(1440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 2px 2px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(30px, 4vw, 52px);
  line-height: 1.02;
}

h2 {
  margin-bottom: 4px;
  font-size: 18px;
}

p {
  color: var(--muted);
}

.status-pill {
  flex: 0 0 auto;
  border: 1px solid rgba(15, 118, 110, 0.25);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  padding: 9px 14px;
  font-weight: 800;
}

.panel {
  border: 1px solid rgba(216, 225, 234, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  padding: 20px;
  backdrop-filter: blur(16px);
}

.compact {
  padding: 16px;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.collapsible-panel.is-collapsed .section-heading {
  margin-bottom: 0;
}

.collapsible-panel.is-collapsed .panel-body {
  display: none;
}

.panel-toggle {
  margin-left: auto;
  flex: 0 0 auto;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--accent-dark);
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.panel-toggle:hover {
  border-color: rgba(15, 118, 110, 0.45);
  background: var(--accent-soft);
}

.section-heading p {
  margin-bottom: 0;
}

.step-index {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  font-weight: 900;
}

.recording-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 56px;
  margin-bottom: 16px;
}

.icon-button {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--ink);
  cursor: pointer;
}

.icon-button.primary {
  background: var(--danger);
  color: white;
  box-shadow: 0 10px 22px rgba(185, 28, 28, 0.25);
}

.icon-button.recording {
  animation: pulse 1.2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.timer {
  min-width: 76px;
  color: var(--ink);
  font-size: 22px;
  font-weight: 900;
}

audio {
  width: min(520px, 100%);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.path-field {
  margin-top: 14px;
}

.vocabulary-field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.vocabulary-field > div {
  display: flex;
  flex: 1 1 100%;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.info-button {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: white;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  cursor: help;
}

.vocabulary-count {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.hint {
  margin: 8px 0 0;
  color: var(--warn);
  font-size: 13px;
  font-weight: 750;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.button-row,
.meeting-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}

.meeting-bar select {
  flex: 1 1 260px;
}

.button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 10px 15px;
  font-weight: 850;
  cursor: pointer;
}

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

.button.ghost {
  background: transparent;
}

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

.progress-card {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 8px;
  background: var(--accent-soft);
  margin-top: 14px;
  padding: 12px;
}

.progress-card[hidden] {
  display: none;
}

.progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--accent-dark);
  font-size: 13px;
}

.progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.15);
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 300ms ease;
}

.speaker-map {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.speaker-card {
  display: grid;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px;
}

.speaker-card strong {
  font-size: 13px;
}

.segments {
  display: grid;
  gap: 10px;
}

.segment-row {
  display: grid;
  grid-template-columns: 96px 150px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 10px;
}

.time {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  padding-top: 11px;
}

.summary {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.summary-settings {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.summary-settings [hidden] {
  display: none;
}

.summary-document-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding: 8px 2px 18px;
}

.summary-document-head h2 {
  margin: 4px 0 0;
  font-size: 24px;
}

.summary-kicker {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 900;
}

.summary-type {
  flex: 0 0 auto;
  border: 1px solid rgba(15, 118, 110, 0.24);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 850;
}

.summary-section {
  padding: 10px 2px 18px;
}

.summary-section + .summary-section {
  border-top: 1px solid var(--line);
}

.summary-section > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  list-style: none;
  cursor: pointer;
  padding: 2px 0 12px;
}

.summary-section > summary::-webkit-details-marker {
  display: none;
}

.summary-section > summary h3 {
  margin: 0;
  font-size: 18px;
}

.summary-chevron {
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 160ms ease;
}

.summary-section:not([open]) .summary-chevron {
  transform: rotate(-45deg);
}

.summary-section:not([open]) > summary {
  padding-bottom: 0;
}

.summary-section-body {
  min-width: 0;
}

.summary-lead {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.72;
}

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

.takeaway-list,
.chapter-list,
.highlight-list {
  display: grid;
  gap: 10px;
}

.takeaway-item {
  border-left: 3px solid var(--accent);
  padding: 2px 0 2px 14px;
}

.takeaway-item h4,
.chapter-item h4 {
  margin: 0;
  font-size: 15px;
}

.takeaway-item p,
.chapter-item > p {
  margin: 6px 0 0;
  color: var(--ink);
  line-height: 1.65;
}

.evidence-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.timestamp-link {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 0;
  border-radius: 6px;
  background: #e8f0fe;
  color: #1d4ed8;
  margin-left: 7px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.timestamp-link:first-child {
  margin-left: 0;
}

.chapter-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 14px;
}

.chapter-heading {
  display: flex;
  align-items: center;
  gap: 9px;
}

.chapter-detail {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  gap: 10px;
  border-top: 1px solid #e8eef4;
  margin-top: 12px;
  padding-top: 10px;
}

.chapter-detail strong {
  color: var(--muted);
  font-size: 13px;
}

.chapter-detail ul,
.decision-list {
  margin: 0;
  padding-left: 20px;
}

.chapter-detail li,
.decision-list li {
  margin: 4px 0;
  line-height: 1.55;
}

.highlight-item {
  margin: 0;
  border-left: 3px solid #d97706;
  background: #fffaf0;
  padding: 12px 14px;
}

.highlight-item blockquote {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.65;
}

.highlight-item figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.segment-row.is-source {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.summary-editable {
  border-radius: 4px;
  outline: 1px dashed rgba(37, 99, 235, 0.45);
  outline-offset: 3px;
  cursor: text;
}

.summary-editable:focus {
  outline: 2px solid #2563eb;
  background: #eff6ff;
}

.summary-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 14px;
}

.summary-block h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.summary-block p,
.summary-block li {
  color: var(--ink);
  line-height: 1.62;
}

.sidebar {
  display: grid;
  gap: 18px;
  align-content: start;
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 48px);
  overflow: auto;
}

.meeting-list {
  display: grid;
  gap: 8px;
}

.meeting-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 10px;
  cursor: pointer;
}

.meeting-item.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.meeting-item strong {
  display: block;
  margin-bottom: 4px;
}

.meeting-item span,
.log-entry {
  color: var(--muted);
  font-size: 13px;
}

.log {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
}

.log-entry {
  border-left: 3px solid var(--accent);
  background: var(--surface-soft);
  padding: 8px 10px;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 18px;
  text-align: center;
}

.vocabulary-dialog {
  width: min(820px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 24px;
  box-shadow: 0 30px 80px rgba(24, 33, 47, 0.28);
}

.vocabulary-dialog::backdrop {
  background: rgba(24, 33, 47, 0.55);
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.dialog-head h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

.dialog-head p {
  margin: 0;
  font-size: 13px;
}

.icon-close,
.icon-delete {
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.icon-close {
  width: 34px;
  height: 34px;
  font-size: 28px;
}

.vocabulary-table {
  display: grid;
  gap: 10px;
}

.vocabulary-table-head,
.vocabulary-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px 36px;
  gap: 12px;
  align-items: center;
}

.vocabulary-table-head {
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  padding: 0 0 10px;
  font-size: 13px;
  font-weight: 850;
}

.vocabularyRows {
  display: grid;
  gap: 10px;
  max-height: 300px;
  overflow: auto;
}

.icon-delete {
  width: 36px;
  height: 36px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 22px;
}

.icon-delete:hover,
.icon-close:hover {
  color: var(--danger);
}

.link-button {
  border: 0;
  background: transparent;
  color: #2563eb;
  margin-top: 14px;
  padding: 7px 2px;
  font-weight: 850;
  cursor: pointer;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 28px;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .sidebar {
    position: static;
    max-height: none;
  }
}

@media (max-width: 680px) {
  .topbar,
  .form-grid,
  .segment-row {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .segment-row {
    gap: 8px;
  }

  .vocabulary-table-head,
  .vocabulary-row {
    grid-template-columns: 1fr;
  }

  .time {
    padding-top: 0;
  }

  .summary-settings,
  .chapter-detail {
    grid-template-columns: 1fr;
  }

  .summary-document-head {
    display: grid;
  }
}
