:root {
  --ink: #17201c;
  --muted: #63716b;
  --paper: #f7f2e8;
  --panel: #fffaf0;
  --line: #d9cdb8;
  --red: #b33f2f;
  --green: #1f6f5b;
  --gold: #d79b31;
  --blue: #1e5a7a;
  --shadow: 0 24px 70px rgba(45, 35, 20, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Avenir Next, Trebuchet MS, Verdana, sans-serif;
  background:
    radial-gradient(circle at 12% 18%, rgba(215, 155, 49, 0.24), transparent 28rem),
    linear-gradient(135deg, rgba(179, 63, 47, 0.14), transparent 34rem),
    var(--paper);
}

button,
input,
textarea {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 42px 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 520px);
  gap: 34px;
  align-items: end;
  min-height: 430px;
  padding: 42px;
  border: 1px solid rgba(23, 32, 28, 0.12);
  background:
    linear-gradient(120deg, rgba(255, 250, 240, 0.94), rgba(255, 250, 240, 0.76)),
    repeating-linear-gradient(90deg, rgba(30, 90, 122, 0.07) 0 1px, transparent 1px 18px);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 720px;
  font-family: Georgia, Times New Roman, serif;
  font-size: clamp(2.8rem, 7vw, 6.2rem);
  line-height: 0.94;
}

h2 {
  font-size: clamp(1.35rem, 2.4vw, 2.1rem);
}

.lede {
  max-width: 610px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.65;
}

.generator-panel,
.status-card,
.results {
  border: 1px solid var(--line);
  background: rgba(255, 250, 240, 0.94);
  box-shadow: 0 18px 50px rgba(45, 35, 20, 0.12);
}

.generator-panel {
  padding: 24px;
}

.generator-panel label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 10px;
}

input,
textarea {
  width: 100%;
  border: 1px solid #c7baa3;
  border-radius: 4px;
  color: var(--ink);
  background: #fffdf7;
  outline: none;
}

input {
  min-height: 48px;
  padding: 0 14px;
}

textarea {
  min-height: 150px;
  padding: 12px 14px;
  resize: vertical;
  line-height: 1.45;
}

input:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(30, 90, 122, 0.15);
}

.transcript-label {
  margin-top: 18px;
}

button {
  min-height: 48px;
  border: 0;
  border-radius: 4px;
  padding: 0 18px;
  color: #fffdf7;
  background: var(--ink);
  cursor: pointer;
  font-weight: 800;
}

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

.status-card {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-top: 24px;
  padding: 24px;
}

.spinner {
  width: 42px;
  height: 42px;
  border: 4px solid rgba(31, 111, 91, 0.2);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

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

.results {
  margin-top: 24px;
  padding: 24px;
}

.results-head {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
}

.download-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.download-actions a {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 13px;
  color: var(--ink);
  background: #fffdf7;
  text-decoration: none;
  font-weight: 800;
}

.toolbar {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  margin: 24px 0 14px;
}

.tabs {
  display: inline-grid;
  grid-template-columns: repeat(2, 1fr);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}

.tab {
  min-width: 112px;
  min-height: 42px;
  border-radius: 0;
  color: var(--ink);
  background: #fffdf7;
}

.tab.active {
  color: #fffdf7;
  background: var(--green);
}

#table-search {
  max-width: 310px;
  min-height: 42px;
}

.table-frame {
  overflow: auto;
  max-height: 620px;
  border: 1px solid var(--line);
  background: #fffdf7;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th,
td {
  min-width: 150px;
  border-bottom: 1px solid #eadfcd;
  padding: 11px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #fffdf7;
  background: var(--blue);
  font-size: 0.78rem;
  text-transform: uppercase;
}

td {
  line-height: 1.45;
}

.table-meta {
  margin: 12px 0 0;
  color: var(--muted);
}

.hidden {
  display: none;
}

@media (max-width: 860px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding: 18px 0;
  }

  .hero {
    grid-template-columns: 1fr;
    min-height: 0;
    padding: 24px;
  }

  .input-row {
    grid-template-columns: 1fr;
  }

  .results-head,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .download-actions {
    justify-content: flex-start;
  }

  #table-search {
    max-width: none;
  }
}
