:root {
  --bg: #f5f6f2;
  --panel: #ffffff;
  --ink: #1f2728;
  --muted: #637071;
  --line: #d7ddd7;
  --line-strong: #aebbb4;
  --teal: #0d766d;
  --teal-dark: #075b55;
  --plum: #8b3d64;
  --amber: #b7791f;
  --red: #b63f35;
  --blue: #355f9f;
  --shadow: 0 18px 48px rgba(31, 45, 43, 0.09);
}

* {
  box-sizing: border-box;
}

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

body.loading {
  cursor: progress;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  min-height: 72px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(245, 246, 242, 0.94);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 860;
}

.mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

nav {
  display: flex;
  gap: 18px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 760;
}

main {
  width: min(1180px, calc(100vw - 36px));
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.72fr);
  gap: 32px;
  align-items: center;
  min-height: calc(100vh - 72px);
  padding: 54px 0 42px;
}

.hero-copy {
  max-width: 760px;
}

.eyebrow,
.section-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  margin-top: 12px;
  max-width: 850px;
  font-size: clamp(42px, 6vw, 72px);
  line-height: 0.98;
  letter-spacing: 0;
}

.subcopy {
  margin-top: 18px;
  max-width: 620px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.upload-surface,
.panel,
.lead-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.upload-surface {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.drop-zone {
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(13, 118, 109, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(13, 118, 109, 0.08) 1px, transparent 1px),
    #fbfcfb;
  background-size: 18px 18px;
}

.drop-zone input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.drop-zone label {
  display: grid;
  gap: 8px;
  min-height: 162px;
  align-content: center;
  padding: 22px;
  cursor: pointer;
}

.drop-zone strong {
  font-size: 22px;
}

.drop-zone span,
.form-note,
.muted,
.cta-copy,
.text-panel p,
td,
li {
  color: var(--muted);
}

.primary {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  cursor: pointer;
  font-weight: 850;
}

.secondary {
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 850;
}

.secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.primary:hover {
  background: var(--teal-dark);
}

.primary:disabled {
  opacity: 0.58;
  cursor: progress;
}

.form-note {
  font-size: 13px;
  line-height: 1.45;
}

.result-shell {
  display: grid;
  gap: 16px;
  padding: 22px 0 52px;
}

.result-head {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  align-items: flex-start;
}

h2 {
  margin-top: 8px;
  font-size: 34px;
  line-height: 1.1;
  letter-spacing: 0;
}

#paper-file {
  margin-top: 8px;
  color: var(--muted);
  word-break: break-word;
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.pill {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 11px;
  background: #fff;
  font-weight: 850;
}

.pill.ready {
  color: var(--teal-dark);
  border-color: rgba(13, 118, 109, 0.34);
}

.pill.review {
  color: var(--amber);
  border-color: rgba(183, 121, 31, 0.34);
}

.pill.blocked {
  color: var(--red);
  border-color: rgba(182, 63, 53, 0.34);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
}

.metrics div {
  min-height: 88px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.metrics strong {
  display: block;
  margin-top: 7px;
  font-size: 27px;
  line-height: 1;
  letter-spacing: 0;
}

.product-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 14px;
}

.panel,
.lead-panel {
  padding: 16px;
}

.clean-open {
  border-top: 3px solid var(--teal);
}

.flow,
.muted-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.flow-step,
.muted-item {
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 12px;
}

.flow-step span,
.muted-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.flow-step strong,
.muted-item strong {
  display: block;
  margin-top: 8px;
  font-size: 21px;
}

.flow-step.review strong {
  color: var(--amber);
}

.muted-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

audio {
  width: 100%;
  margin-top: 16px;
}

.preview-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 16px;
}

.audio-panel .muted {
  margin-top: 12px;
  font-size: 13px;
}

.cta-copy {
  margin: 12px 0 14px;
  line-height: 1.5;
}

.lead-panel {
  margin-top: 0;
}

#lead-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

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

textarea {
  resize: vertical;
}

.span-2 {
  grid-column: span 2;
}

.detail-grid {
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
}

.text-panel p {
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.7;
}

.audit {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 12px;
}

h3 {
  font-size: 14px;
  letter-spacing: 0;
}

ul {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

li {
  border-top: 1px solid var(--line);
  padding: 8px 0;
  font-size: 13px;
  line-height: 1.45;
}

li b {
  color: var(--blue);
}

.how {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(300px, 1fr);
  gap: 32px;
  padding: 52px 0 70px;
  border-top: 1px solid var(--line);
}

.how ol {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style-position: inside;
}

.how li {
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  color: var(--ink);
  font-weight: 760;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--ink);
  color: white;
  box-shadow: var(--shadow);
}

.admin {
  display: grid;
  gap: 18px;
  padding: 42px 0 70px;
}

.admin h1 {
  font-size: 44px;
  overflow-wrap: anywhere;
}

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

.admin-auth form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 13px;
}

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

th {
  color: var(--ink);
  font-size: 12px;
  text-transform: uppercase;
}

@media (max-width: 980px) {
  .hero,
  .product-grid,
  .detail-grid,
  .how,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .how ol {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin h1 {
    font-size: 38px;
    line-height: 1.08;
  }
}

@media (max-width: 680px) {
  .topbar {
    padding: 0 16px;
  }

  nav {
    gap: 10px;
    font-size: 13px;
  }

  main {
    width: min(100vw - 28px, 1180px);
  }

  h1 {
    font-size: 40px;
  }

  h2 {
    font-size: 26px;
  }

  .admin h1 {
    font-size: 28px;
    line-height: 1.08;
  }

  .result-head,
  .status-row {
    display: grid;
    justify-content: stretch;
  }

  .metrics,
  .flow,
  .muted-grid,
  #lead-form,
  .admin-auth form,
  .audit,
  .how ol {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }
}
