:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-2: #eef3f2;
  --text: #1c2426;
  --muted: #627071;
  --line: #d7dfdf;
  --accent: #006d77;
  --accent-strong: #005761;
  --warn: #a15c00;
  --danger: #b3261e;
  --ok: #24724b;
  --shadow: 0 18px 45px rgba(29, 45, 47, 0.08);
}

* {
  box-sizing: border-box;
}

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

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px clamp(16px, 4vw, 44px) 12px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

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

h1 {
  font-size: 28px;
}

h2 {
  font-size: 17px;
}

h3 {
  font-size: 15px;
}

.status-strip {
  min-width: 160px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.layout {
  display: grid;
  grid-template-columns: minmax(300px, 420px) minmax(260px, 360px) minmax(420px, 1fr);
  gap: 16px;
  padding: 12px clamp(16px, 4vw, 44px) 36px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.upload-panel,
.jobs-panel,
.detail-panel {
  padding: 18px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.limit,
.form-message {
  color: var(--muted);
  font-size: 13px;
}

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

.upload-form,
.settings-form {
  display: grid;
  gap: 14px;
}

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

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfd;
  color: var(--text);
  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(0, 109, 119, 0.14);
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 130px;
  gap: 12px;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 0 16px;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.ghost-button {
  min-height: 34px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  padding: 0 12px;
}

.ghost-button:hover {
  background: #e2ecea;
}

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

.job-item {
  width: 100%;
  min-height: unset;
  border: 1px solid var(--line);
  background: #fbfdfd;
  color: var(--text);
  padding: 12px;
  text-align: left;
}

.job-item:hover,
.job-item.active {
  border-color: var(--accent);
  background: #f2fbfa;
}

.job-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-weight: 800;
}

.job-meta,
.detail-meta {
  color: var(--muted);
  font-size: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 9px;
  background: #e7eeee;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.pill.completed {
  background: #e5f4ec;
  color: var(--ok);
}

.pill.uploaded {
  background: #e7eeee;
  color: var(--muted);
}

.pill.failed {
  background: #fdebea;
  color: var(--danger);
}

.pill.transcribing,
.pill.generating,
.pill.queued {
  background: #fff2db;
  color: var(--warn);
}

.detail-empty {
  display: grid;
  min-height: 220px;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.detail-stack {
  display: grid;
  gap: 18px;
}

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

.section:first-child {
  border-top: 0;
  padding-top: 0;
}

.document {
  overflow: auto;
  max-height: 48vh;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfd;
  padding: 14px;
}

.document h1 {
  font-size: 20px;
}

.document h2 {
  margin-top: 18px;
  font-size: 16px;
}

.document p,
.document li {
  line-height: 1.7;
}

.turns {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
}

.turn {
  display: grid;
  grid-template-columns: 76px 76px 1fr;
  gap: 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfd;
  padding: 10px;
  font-size: 13px;
}

.turn-time,
.turn-speaker {
  color: var(--muted);
  font-weight: 800;
}

.raw-text {
  max-height: 300px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfd;
  padding: 12px;
  line-height: 1.7;
}

.error {
  border: 1px solid #f1b4af;
  border-radius: 8px;
  background: #fff7f6;
  color: var(--danger);
  padding: 12px;
}

@media (max-width: 1180px) {
  .layout {
    grid-template-columns: minmax(300px, 420px) 1fr;
  }

  .detail-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .status-strip {
    text-align: left;
  }

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

  .two-col {
    grid-template-columns: 1fr;
  }

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