:root {
  --ink: #17130f;
  --muted: #6c6259;
  --paper: #fffdf9;
  --cream: #f7f1e8;
  --sand: #e9dfd2;
  --orange: #e95d25;
  --orange-dark: #b83b0c;
  --orange-soft: #fff0e8;
  --green: #1e7b56;
  --red: #a73a36;
  --shadow: 0 28px 80px rgba(65, 42, 24, 0.11);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--cream);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
}

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

.ambient {
  position: fixed;
  z-index: -1;
  width: 42rem;
  height: 42rem;
  border-radius: 50%;
  filter: blur(8px);
  opacity: 0.65;
  pointer-events: none;
}
.ambient-one { top: -24rem; right: -12rem; background: #ffd4be; }
.ambient-two { bottom: -34rem; left: -18rem; background: #f2d3b2; }

.site-header,
.site-footer,
.page-shell {
  width: min(1180px, calc(100% - 40px));
  margin-inline: auto;
}

.site-header {
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  font-family: "Sora", sans-serif;
  font-weight: 700;
  letter-spacing: -0.04em;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: white;
  background: var(--orange);
  border-radius: 12px;
  font-size: 20px;
}
.brand-copy { font-size: 21px; }

.account-actions { display: flex; align-items: center; gap: 18px; }
.account-name { color: var(--muted); font-size: 14px; }

.page-shell { min-height: calc(100vh - 170px); padding: 36px 0 80px; }
.site-footer {
  display: flex;
  gap: 28px;
  padding: 28px 0 38px;
  border-top: 1px solid rgba(80, 59, 40, 0.12);
  color: var(--muted);
  font-size: 13px;
}
.site-footer span { margin-right: auto; }

h1, h2, h3 {
  font-family: "Sora", sans-serif;
  letter-spacing: -0.045em;
  margin-top: 0;
}
h1 { font-size: clamp(42px, 6vw, 78px); line-height: 0.98; margin-bottom: 24px; }
h2 { font-size: 28px; margin-bottom: 10px; }
h3 { font-size: 19px; }
p { color: var(--muted); line-height: 1.7; }

.eyebrow {
  display: block;
  margin-bottom: 18px;
  color: var(--orange-dark);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.button:hover { transform: translateY(-1px); }
.button-primary {
  color: white;
  background: var(--orange);
  box-shadow: 0 12px 26px rgba(233, 93, 37, 0.24);
}
.button-primary:hover { background: var(--orange-dark); }
.button-secondary { color: var(--orange-dark); border-color: #efc8b5; background: var(--orange-soft); }
.button-quiet { padding-inline: 12px; color: var(--muted); background: transparent; }
.button-large { min-height: 54px; padding-inline: 24px; }
.button-wide { width: 100%; }

.login-layout {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  align-items: center;
  gap: 90px;
  min-height: 660px;
}
.login-story > p { max-width: 590px; font-size: 18px; }
.benefit-list { display: grid; gap: 14px; margin: 36px 0 0; padding: 0; list-style: none; }
.benefit-list li { display: flex; align-items: center; gap: 14px; font-weight: 500; }
.benefit-list span { color: var(--orange); font-size: 12px; letter-spacing: .1em; }

.auth-card,
.content-card {
  background: rgba(255, 253, 249, .92);
  border: 1px solid rgba(104, 72, 45, .14);
  border-radius: 24px;
  box-shadow: var(--shadow);
}
.auth-card { padding: 42px; }
.auth-card > p { margin-bottom: 28px; }
.auth-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 30px;
  color: var(--orange-dark);
  background: var(--orange-soft);
  border-radius: 16px;
  font-size: 24px;
}
.stack-form { display: grid; gap: 10px; }
.stack-form label, .field span { color: #4e453d; font-size: 13px; font-weight: 600; }
.stack-form input,
.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid #d9cdc0;
  border-radius: 11px;
  background: white;
  color: var(--ink);
  outline: none;
}
.stack-form input { height: 50px; padding: 0 14px; margin-bottom: 8px; }
.field input, .field select { height: 48px; padding: 0 13px; }
.field textarea { padding: 13px; resize: vertical; }
.stack-form input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(233, 93, 37, .1);
}
.form-message { min-height: 24px; margin-top: 14px; color: var(--green); font-size: 14px; }
.dev-box { display: grid; gap: 10px; margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--sand); }
.dev-box span { color: var(--muted); font-size: 12px; }

.dashboard-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 50px;
  padding: 30px 0 70px;
}
.dashboard-hero h1 { max-width: 800px; }
.dashboard-hero p { max-width: 640px; font-size: 17px; }

.metrics-grid { display: grid; grid-template-columns: 1.35fr 1fr 1fr; gap: 16px; margin-bottom: 22px; }
.metric-card {
  display: grid;
  min-height: 165px;
  padding: 25px;
  border: 1px solid rgba(104, 72, 45, .13);
  border-radius: 20px;
  background: rgba(255, 253, 249, .7);
}
.metric-highlight { background: var(--ink); color: white; }
.metric-label, .metric-caption { color: var(--muted); font-size: 13px; }
.metric-highlight .metric-label, .metric-highlight .metric-caption { color: #c9c0b7; }
.metric-card strong { align-self: center; font-family: "Sora", sans-serif; font-size: 44px; }

.referrals-card { padding: 32px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.section-heading .eyebrow { margin-bottom: 8px; }
.section-heading h2 { margin-bottom: 0; }
.section-heading.compact { margin-bottom: 30px; }
.text-link, .back-link { color: var(--orange-dark); font-weight: 600; text-decoration: none; }
.referrals-table-wrap { overflow-x: auto; }
.referrals-table { width: 100%; border-collapse: collapse; }
.referrals-table th { padding: 12px 14px; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-align: left; text-transform: uppercase; }
.referrals-table td { padding: 18px 14px; border-top: 1px solid #ebe2d8; font-size: 14px; }
.referrals-table td:first-child { display: grid; gap: 3px; }
.referrals-table td:first-child span { color: var(--muted); font-size: 12px; }
.status { display: inline-flex; padding: 6px 10px; border-radius: 999px; color: #76552c; background: #fff1d8; font-size: 12px; font-weight: 600; }
.status-won { color: var(--green); background: #e9f7f0; }
.status-lost, .status-sync_error { color: var(--red); background: #fceceb; }
.status-new, .status-qualified { color: #315a8c; background: #eaf2fb; }
.empty-state { padding: 56px 20px; text-align: center; }
.empty-symbol { display: grid; place-items: center; width: 54px; height: 54px; margin: 0 auto 20px; border-radius: 16px; color: var(--orange-dark); background: var(--orange-soft); font-size: 24px; }
.empty-state p { max-width: 450px; margin: 0 auto 24px; }

.form-page { display: grid; grid-template-columns: 350px 1fr; align-items: start; gap: 70px; }
.form-intro { position: sticky; top: 30px; padding-top: 28px; }
.form-intro .back-link { display: inline-block; margin-bottom: 65px; }
.form-intro h1 { font-size: clamp(38px, 4vw, 58px); }
.process-note { margin-top: 38px; padding: 20px 22px; border-left: 3px solid var(--orange); background: rgba(255,255,255,.45); }
.process-note > span { font-weight: 600; }
.process-note ol { display: grid; gap: 8px; margin: 13px 0 0; padding-left: 19px; color: var(--muted); font-size: 14px; }
.referral-form-card { padding: 38px; }
.step-indicator { display: inline-block; margin-bottom: 8px; color: var(--orange-dark); font-size: 12px; font-weight: 600; letter-spacing: .1em; }
.referral-form { display: grid; gap: 34px; }
.referral-form fieldset { margin: 0; padding: 0 0 30px; border: 0; border-bottom: 1px solid #e9dfd5; }
.referral-form legend { margin-bottom: 18px; font-family: "Sora", sans-serif; font-size: 16px; font-weight: 600; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field { display: grid; gap: 7px; }
.field-wide { grid-column: 1 / -1; }
.consent-field { display: grid; grid-template-columns: 20px 1fr; gap: 11px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.consent-field input { width: 18px; height: 18px; accent-color: var(--orange); }
.consent-field a { color: var(--orange-dark); }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; }
.error-box { margin-bottom: 25px; padding: 16px 18px; border: 1px solid #efc1be; border-radius: 12px; color: var(--red); background: #fff2f1; font-size: 14px; }
.error-box ul { margin: 8px 0 0; padding-left: 18px; }

.success-card { max-width: 700px; margin: 60px auto; padding: 55px; text-align: center; }
.success-card h1 { font-size: clamp(38px, 6vw, 64px); }
.success-card > p { max-width: 560px; margin: 0 auto 28px; font-size: 17px; }
.success-symbol { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 28px; border-radius: 20px; color: white; background: var(--green); font-size: 28px; }
.reference-box { display: grid; gap: 6px; margin: 30px 0; padding: 18px; border-radius: 14px; background: #f4eee6; }
.reference-box span { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.reference-box code { overflow-wrap: anywhere; }
.success-actions { display: flex; justify-content: center; gap: 12px; }

@media (max-width: 860px) {
  .login-layout, .form-page { grid-template-columns: 1fr; gap: 35px; }
  .login-layout { padding-top: 30px; }
  .form-intro { position: static; }
  .form-intro .back-link { margin-bottom: 35px; }
  .dashboard-hero { align-items: start; flex-direction: column; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .metric-highlight { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .site-header, .site-footer, .page-shell { width: min(100% - 24px, 1180px); }
  .site-header { height: 72px; }
  .account-name { display: none; }
  .page-shell { padding-top: 18px; }
  h1 { font-size: 42px; }
  .auth-card, .referral-form-card, .referrals-card, .success-card { padding: 25px 20px; border-radius: 18px; }
  .dashboard-hero { padding-bottom: 42px; }
  .dashboard-hero .button { width: 100%; }
  .metrics-grid, .form-grid { grid-template-columns: 1fr; }
  .metric-highlight { grid-column: auto; }
  .form-actions, .success-actions { align-items: stretch; flex-direction: column-reverse; }
  .site-footer { flex-wrap: wrap; gap: 14px; }
  .site-footer span { width: 100%; }
}

