:root {
  color-scheme: light;
  --background: #f7f7f4;
  --surface: #ffffff;
  --text: #242420;
  --muted: #65655d;
  --border: #d9d8cf;
  --accent: #276b5f;
}

* {
  box-sizing: border-box;
}

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

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 0.875rem 1.25rem;
}

.brand {
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.page-shell {
  width: min(960px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0;
}

.intro {
  max-width: 640px;
}

.intro h1 {
  margin: 0 0 0.75rem;
  font-size: 2rem;
}

.intro p {
  margin: 0;
  color: var(--muted);
}

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.page-heading h1,
.content-panel h1,
.content-panel h2 {
  margin: 0 0 0.75rem;
}

.content-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 1rem;
  padding: 1rem;
}

.content-panel.narrow {
  max-width: 420px;
}

.form-stack,
.inline-form {
  display: grid;
  gap: 0.75rem;
}

.inline-form {
  grid-template-columns: auto minmax(12rem, 1fr) auto;
  align-items: end;
}

label {
  font-weight: 650;
}

input,
select,
textarea,
button {
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  padding: 0.55rem 0.65rem;
}

.button-link {
  background: var(--accent);
  border-radius: 6px;
  color: white;
  display: inline-block;
  font-weight: 700;
  padding: 0.55rem 0.65rem;
  text-decoration: none;
}

button {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  cursor: pointer;
  font-weight: 700;
}

button.secondary {
  background: white;
  border-color: var(--border);
  color: var(--text);
}

button.danger {
  background: #9f2d2d;
  border-color: #9f2d2d;
}

table {
  border-collapse: collapse;
  margin-top: 1rem;
  width: 100%;
}

th,
td {
  border-top: 1px solid var(--border);
  padding: 0.7rem;
  text-align: left;
  vertical-align: top;
}

.section-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.actions {
  display: grid;
  gap: 0.5rem;
}

.actions form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.error {
  background: #fff0f0;
  border: 1px solid #e1adad;
  border-radius: 8px;
  color: #842020;
  padding: 0.75rem;
}

.success {
  color: #236044;
  font-weight: 700;
}

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

.extracted-text,
.generated-markdown {
  overflow: auto;
  white-space: pre-wrap;
}

.transcript {
  display: grid;
  gap: 0.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.message {
  border-left: 3px solid var(--border);
  padding-left: 0.75rem;
  white-space: pre-wrap;
}

.message.assistant {
  border-left-color: var(--accent);
}

.help-popover {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  height: 1.75rem;
  justify-content: center;
  margin-left: 0.4rem;
  padding: 0;
  position: relative;
  width: 1.75rem;
}

.help-popover span {
  background: #20201c;
  border-radius: 8px;
  color: white;
  display: none;
  font-size: 0.95rem;
  font-weight: 400;
  left: 0;
  line-height: 1.4;
  padding: 0.75rem;
  position: absolute;
  top: 2rem;
  width: min(22rem, calc(100vw - 2rem));
  z-index: 5;
}

.help-popover:hover span,
.help-popover:focus span,
.help-popover:focus-within span {
  display: block;
}

@media (max-width: 720px) {
  .page-heading,
  .inline-form {
    display: grid;
    grid-template-columns: 1fr;
  }

  th,
  td {
    padding: 0.55rem;
  }
}
