:root {
  --bg: #f6f0e6;
  --surface: rgba(253, 249, 241, 0.9);
  --surface-strong: rgba(255, 255, 255, 0.98);
  --ink: #1d2433;
  --muted: #6a6452;
  --accent: #b8862b;
  --accent-deep: #835e16;
  --accent-soft: rgba(184, 134, 43, 0.14);
  --border: rgba(29, 36, 51, 0.1);
  --shadow: 0 24px 60px rgba(131, 94, 22, 0.16);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --success: #1f7a57;
  --warning: #b9721d;
  --danger: #c3382f;
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(224, 184, 110, 0.6), transparent 28%),
    radial-gradient(circle at 85% 20%, rgba(200, 140, 70, 0.28), transparent 22%),
    linear-gradient(145deg, #fbf6ec 0%, #f3ead9 48%, #efe3cf 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.2) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.2) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.35), transparent 75%);
}

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

.hero,
.workspace {
  display: grid;
  gap: 24px;
}

.hero {
  grid-template-columns: 1.6fr 0.9fr;
  align-items: stretch;
  margin-bottom: 24px;
}

.hero-copy,
.hero-card,
.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 32px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-deep);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
}

h1 {
  max-width: 12ch;
  font-size: clamp(2.5rem, 5vw, 4.6rem);
  line-height: 0.96;
}

.hero-text {
  max-width: 62ch;
  margin: 18px 0 28px;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.65;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.hero-metrics article,
.hero-card {
  position: relative;
  overflow: hidden;
}

.hero-metrics article {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  border: 1px solid rgba(184, 134, 43, 0.14);
}

.hero-metrics span,
.hero-card .card-kicker {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* The rule above is shared with .hero-metrics span, which sits on a LIGHT
   card — so the colour cannot be changed there. This kicker is the only member
   on the dark hero-card gradient, where var(--muted) is a dark brown on dark
   brown and the heading is effectively invisible. */
.hero-card .card-kicker {
  color: rgba(248, 242, 230, 0.72);
}

.hero-metrics strong {
  font-size: 1rem;
}

.hero-card {
  padding: 28px;
  background:
    linear-gradient(160deg, rgba(131, 94, 22, 0.96), rgba(74, 51, 11, 0.96)),
    linear-gradient(140deg, rgba(255, 255, 255, 0.12), transparent);
  color: #fbf2df;
}

.hero-card::after {
  content: "";
  position: absolute;
  inset: auto -60px -60px auto;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(255, 222, 157, 0.18);
}

.hero-card ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 14px;
  line-height: 1.6;
}

.workspace {
  grid-template-columns: minmax(350px, 0.95fr) minmax(420px, 1.05fr);
}

.panel {
  padding: 28px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.panel-heading h2 {
  font-size: 1.9rem;
}

.scenario-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.scenario-chip,
.status-pill,
.badge {
  border-radius: 999px;
}

.scenario-chip {
  border: 1px solid rgba(184, 134, 43, 0.16);
  background: var(--surface-strong);
  color: var(--accent-deep);
  padding: 10px 14px;
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.scenario-chip:hover,
.scenario-chip:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(184, 134, 43, 0.4);
  background: #fdf8ee;
}

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

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

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

input,
textarea,
select {
  width: 100%;
  border: 1px solid rgba(29, 36, 51, 0.12);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.95);
  padding: 14px 16px;
  color: var(--ink);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(184, 134, 43, 0.65);
  box-shadow: 0 0 0 4px rgba(184, 134, 43, 0.14);
}

textarea {
  resize: vertical;
  min-height: 122px;
}

.full-span {
  grid-column: 1 / -1;
}

.primary-button {
  border: 0;
  padding: 16px 20px;
  color: white;
  border-radius: 18px;
  cursor: pointer;
  background: linear-gradient(135deg, #b8862b, #835e16);
  box-shadow: 0 18px 30px rgba(131, 94, 22, 0.24);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.primary-button:hover,
.primary-button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 22px 34px rgba(131, 94, 22, 0.28);
}

.status-pill {
  padding: 10px 14px;
  min-width: 132px;
  text-align: center;
  background: rgba(29, 36, 51, 0.06);
  color: var(--muted);
  font-size: 0.92rem;
}

.status-pill.success {
  background: rgba(31, 122, 87, 0.12);
  color: var(--success);
}

.status-pill.error {
  background: rgba(195, 56, 47, 0.12);
  color: var(--danger);
}

.status-pill.loading {
  background: rgba(185, 114, 29, 0.14);
  color: var(--warning);
}

.result-shell {
  min-height: 540px;
}

.result-shell.empty {
  display: grid;
  place-items: center;
  border: 1px dashed rgba(29, 36, 51, 0.12);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.55);
}

.placeholder {
  max-width: 340px;
  text-align: center;
  color: var(--muted);
}

.result-grid {
  display: grid;
  gap: 18px;
}

.summary-banner {
  padding: 22px;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(184, 134, 43, 0.12), rgba(255, 255, 255, 0.92)),
    linear-gradient(45deg, rgba(255, 255, 255, 0.5), transparent);
  border: 1px solid rgba(184, 134, 43, 0.16);
}

.summary-banner p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.metric-card,
.stream-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(29, 36, 51, 0.08);
}

.metric-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric-card strong {
  font-size: 1.15rem;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.badge {
  padding: 8px 12px;
  font-size: 0.84rem;
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.stream-card h3 {
  margin-bottom: 16px;
  font-size: 1.2rem;
}

.timeline,
.journal {
  display: grid;
  gap: 12px;
}

.timeline-item,
.journal-item {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(248, 242, 230, 0.9);
  border: 1px solid rgba(29, 36, 51, 0.08);
}

.timeline-item strong,
.journal-item strong {
  display: block;
  margin-bottom: 6px;
}

.timeline-item small,
.journal-item small {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.draft-body {
  white-space: pre-wrap;
  line-height: 1.6;
}

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

.error-card {
  padding: 20px;
  border-radius: var(--radius-lg);
  background: rgba(195, 56, 47, 0.08);
  border: 1px solid rgba(195, 56, 47, 0.16);
  color: var(--danger);
}

/* The property-facts fieldset is a nested two-column grid inside the form's
   own grid, so it needs its own template rather than inheriting one column. */
.form-grid fieldset {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
  padding: 18px;
  border: 1px solid rgba(29, 36, 51, 0.12);
  border-radius: 20px;
}

.form-grid fieldset legend {
  padding: 0 8px;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

@media (max-width: 720px) {
  .form-grid fieldset {
    grid-template-columns: 1fr;
  }
}

/* --- offer-automation additions ------------------------------------ */

/* The review gate is the point of the demo, so it is styled as a standing
   state rather than an error: amber, always present, never "resolved" here. */
.gate-banner {
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  background: rgba(199, 138, 34, 0.1);
  border: 1px solid rgba(199, 138, 34, 0.24);
}

.gate-banner strong {
  display: block;
  margin-bottom: 6px;
}

.flag-item {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(248, 242, 230, 0.9);
  border: 1px solid rgba(29, 36, 51, 0.08);
  border-left: 4px solid rgba(29, 36, 51, 0.2);
}

.flag-item.critical {
  background: rgba(195, 56, 47, 0.08);
  border-color: rgba(195, 56, 47, 0.18);
  border-left-color: var(--danger);
}

.flag-item.urgent {
  background: rgba(199, 138, 34, 0.1);
  border-color: rgba(199, 138, 34, 0.22);
  border-left-color: rgba(199, 138, 34, 0.85);
}

.badge.gate-clear {
  background: rgba(47, 133, 90, 0.12);
  color: #1f5f40;
}

.badge.gate-attention {
  background: rgba(199, 138, 34, 0.16);
  color: #7a5410;
}

/* Derived form fields: a two-column key/value grid that stays readable when a
   value is the NEEDS_REVIEW marker rather than real data. */
.field-table {
  display: grid;
  grid-template-columns: minmax(140px, 32%) 1fr;
  gap: 1px;
  background: rgba(29, 36, 51, 0.08);
  border: 1px solid rgba(29, 36, 51, 0.08);
  border-radius: 16px;
  overflow: hidden;
}

.field-table > div {
  padding: 10px 14px;
  background: rgba(248, 242, 230, 0.92);
}

.field-table .field-key {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.76rem;
  letter-spacing: 0.08em;
}

.field-table .needs-review {
  color: var(--danger);
  font-weight: 600;
}

.provision-excerpt {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(29, 36, 51, 0.04);
  font-size: 0.92rem;
  line-height: 1.55;
}

.policy-note {
  margin: 12px 0 0;
  font-size: 0.86rem;
  color: var(--muted);
}

@media (max-width: 1080px) {
  .hero,
  .workspace {
    grid-template-columns: 1fr;
  }

  .panel-heading {
    flex-direction: column;
  }

  .scenario-row {
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 20px, 100%);
    padding-top: 18px;
  }

  .hero-copy,
  .hero-card,
  .panel {
    padding: 22px;
    border-radius: 24px;
  }

  .hero-metrics,
  .metric-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: clamp(2.25rem, 12vw, 3.4rem);
  }
}
