:root {
  --orange: #ef772e;
  --orange-dark: #d9631d;
  --indigo: #5852e3;
  --ink: #0e1116;
  --muted: #6b7280;
  --line: #ececf1;
  --bg: #f6f6f9;
  --card: #ffffff;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 17, 22, 0.04), 0 8px 24px rgba(16, 17, 22, 0.06);
  --maxw: 720px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: 'Inter', 'Noto Sans Thai', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 26px; }
h2 { font-size: 16px; }
p { margin: 0; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.link { text-decoration: none; }
.link:hover { text-decoration: underline; }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 12px 18px;
  transition: transform 0.04s ease, background 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 8px 14px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover { background: var(--orange-dark); }
.btn-primary.is-copied { background: #1f9d55; }
.btn-secondary { background: var(--indigo); color: #fff; }
.btn-secondary:hover { filter: brightness(0.95); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: #f0f0f4; color: var(--ink); }

/* --- Auth --- */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 28px;
  text-align: center;
}
.auth-logo { height: 30px; margin-bottom: 20px; }
.sent-mark { font-size: 40px; line-height: 1; margin-bottom: 8px; }
.auth-card h1 { font-size: 22px; margin-bottom: 6px; }
.auth-card .muted { margin-bottom: 20px; }

.stack { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.field span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  background: #fff;
  outline: none;
}
.field input:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(239, 119, 46, 0.15); }
.otp-input { letter-spacing: 8px; text-align: center; font-size: 22px; font-weight: 700; }

.demo-panel { display: flex; flex-direction: column; gap: 10px; text-align: center; }
.demo-panel h2 { font-size: 15px; }
.demo-panel form { margin: 0; }

.banner { border-radius: var(--radius-sm); padding: 10px 12px; font-size: 14px; margin-bottom: 16px; text-align: left; }
.banner.notice { background: #fff5ee; color: var(--orange-dark); border: 1px solid #f6d6bf; }
.banner.error { background: #fdecec; color: #c0392b; border: 1px solid #f5c6c6; }

.lang-toggle { margin-top: 22px; font-size: 13px; color: var(--muted); display: flex; gap: 8px; justify-content: center; }
.lang-toggle a { color: var(--muted); text-decoration: none; }
.lang-toggle a.active { color: var(--ink); font-weight: 700; }

/* --- Topbar --- */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-logo { height: 22px; }
.brand-sub {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border-left: 1px solid var(--line);
  padding-left: 10px;
}

/* --- Page layout --- */
.page { max-width: var(--maxw); margin: 0 auto; padding: 24px 20px 64px; display: flex; flex-direction: column; gap: 16px; }
.hero { margin: 6px 2px 2px; }

.code-card, .bonus-card, .chart-card, .how-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

/* --- Promo code --- */
.code-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.code-card .label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.code-row { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.promo {
  font-family: 'Inter', monospace;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: linear-gradient(180deg, #fff6f0, #ffe9d9);
  border: 1px dashed #f0b98e;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
}
.pill { background: #f0f0f4; color: var(--muted); font-size: 13px; font-weight: 600; padding: 8px 12px; border-radius: 999px; white-space: nowrap; }

/* --- Tiles --- */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tile-num { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.tile-label { font-size: 12px; color: var(--muted); }
.tile-accent { background: linear-gradient(160deg, var(--orange), var(--orange-dark)); border: 0; }
.tile-accent .tile-num, .tile-accent .tile-label { color: #fff; }
.tile-accent .tile-label { opacity: 0.9; }

/* --- Bonus --- */
.bonus-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.bonus-badge { font-size: 14px; font-weight: 800; color: var(--orange); background: #fff4ec; padding: 4px 12px; border-radius: 999px; }
.progress { height: 14px; background: #f0f0f4; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--orange), #ff9d5c); border-radius: 999px; transition: width 0.4s ease; }
.bonus-msg { margin-top: 12px; font-size: 14px; color: var(--ink); }

/* --- Chart --- */
.chart-card h2, .bonus-card h2, .how-card h2 { margin-bottom: 14px; }
.chart { display: flex; align-items: flex-end; gap: 14px; height: 160px; padding-top: 8px; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; }
.bars { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 5px; }
.bar { width: 42%; max-width: 22px; border-radius: 6px 6px 0 0; }
.bar-signups { background: #cdd0f7; }
.bar-qual { background: var(--orange); }
.chart-label { font-size: 12px; color: var(--muted); }
.legend { display: flex; gap: 18px; margin-top: 14px; font-size: 13px; color: var(--muted); }
.legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.dot-signups { background: #cdd0f7; }
.dot-qual { background: var(--orange); }

/* --- How it works --- */
.how-list { margin: 0 0 12px; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.how-list li::marker { color: var(--orange); font-weight: 700; }

/* --- Paused / terminated --- */
.status-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px 24px;
  text-align: center;
}
.status-card h2 { font-size: 20px; margin-bottom: 8px; }

/* --- Responsive --- */
@media (max-width: 560px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .promo { font-size: 24px; }
  h1 { font-size: 22px; }
}

/* --- Landing --- */
/* Warm, soft background inspired by finn-app.com (cream + peach blobs). */
.lp-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-color: #fff7f1;
  background-image:
    radial-gradient(55% 45% at 12% 8%, rgba(239, 119, 46, 0.12) 0%, rgba(239, 119, 46, 0) 60%),
    radial-gradient(45% 40% at 92% 16%, rgba(88, 82, 227, 0.07) 0%, rgba(88, 82, 227, 0) 60%),
    radial-gradient(60% 50% at 85% 88%, rgba(239, 119, 46, 0.10) 0%, rgba(239, 119, 46, 0) 62%),
    radial-gradient(50% 45% at 20% 95%, rgba(239, 119, 46, 0.06) 0%, rgba(239, 119, 46, 0) 60%);
}
.landing-header {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
}
.landing-nav { display: flex; align-items: center; gap: 14px; }
.landing-nav .lang-toggle { margin: 0; }
.landing { max-width: 960px; margin: 0 auto; padding: 0 20px 64px; }

.lp-hero { text-align: center; padding: 48px 0 40px; }
.lp-hero h1 { font-size: 40px; line-height: 1.1; max-width: 640px; margin: 0 auto 16px; }
.lp-sub { color: var(--muted); font-size: 18px; max-width: 560px; margin: 0 auto 28px; }
.lp-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.lp-cta .btn { padding: 14px 24px; }

.lp-steps { padding: 32px 0; }
.lp-steps h2, .lp-earn h2 { text-align: center; font-size: 22px; margin-bottom: 24px; }
.lp-step-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.lp-step {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.lp-step-n {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: #fff4ec;
  color: var(--orange);
  font-weight: 800;
  margin-bottom: 12px;
}
.lp-step h3 { font-size: 16px; margin-bottom: 6px; }

.lp-earn { text-align: center; padding: 32px 0; }
.lp-earn-body { font-size: 18px; max-width: 560px; margin: 0 auto; }

.lp-band {
  text-align: center;
  background: linear-gradient(160deg, var(--orange), var(--orange-dark));
  color: #fff;
  border-radius: var(--radius);
  padding: 40px 24px;
  margin: 32px 0;
}
.lp-band h2 { color: #fff; font-size: 24px; margin-bottom: 18px; }
.lp-band .btn-primary { background: #fff; color: var(--orange-dark); }

.lp-footer { text-align: center; padding-top: 24px; }

@media (max-width: 640px) {
  .lp-hero h1 { font-size: 30px; }
  .lp-step-grid { grid-template-columns: 1fr; }

  /* Stack "Ambassador" under the FINN logo so the header doesn't overlap. */
  .landing-header { padding: 12px 16px; }
  .landing-header .brand { flex-direction: column; align-items: flex-start; gap: 2px; }
  .landing-header .brand-sub {
    border-left: none;
    padding-left: 0;
    font-size: 11px;
  }
  .landing-nav { gap: 10px; }
}
