:root {
  /* Build RH brand colors, sampled from the company logo */
  --bg: #fdf7f9;
  --card-bg: #ffffff;
  --primary: #d2158d;
  --primary-dark: #6d0e56;
  --secondary: #a0208d;
  --accent: #fdecd1;
  --danger: #c65a5a;
  --text: #2a1522;
  --muted: #8a6b80;
  --border: #f2dfe9;
  --radius: 20px;
  --gradient-brand: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  --shadow-soft: 0 8px 30px rgba(109, 14, 86, 0.08);
  --shadow-lift: 0 14px 34px rgba(109, 14, 86, 0.16);
  font-family: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

* { box-sizing: border-box; }

a { color: var(--primary); }
a:hover { color: var(--primary-dark); }

input, textarea, select { accent-color: var(--primary); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.bg-decor {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(480px circle at 8% 0%, rgba(210, 21, 141, 0.14), transparent 60%),
    radial-gradient(520px circle at 100% 15%, rgba(160, 32, 141, 0.12), transparent 60%),
    radial-gradient(420px circle at 50% 100%, rgba(253, 236, 209, 0.55), transparent 65%);
}

/* ===== Topbar ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  background: linear-gradient(120deg, var(--primary-dark), var(--secondary) 65%, var(--primary));
  color: white;
  padding: 14px 24px;
  box-shadow: 0 6px 24px rgba(109, 14, 86, 0.25);
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 1.05rem; letter-spacing: -0.01em; }
.brand-text { font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em; }
.brand-sep { opacity: 0.5; font-weight: 400; }

.home-logo { text-align: center; margin-bottom: 4px; }
.home-logo img { height: 44px; width: auto; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; }

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: white;
  padding: 9px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  transition: background 0.18s ease, transform 0.15s ease, box-shadow 0.18s ease;
}
.tab-ico { font-size: 0.95em; }
.tab-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.2); transform: translateY(-1px); }
.tab-btn.active {
  background: white;
  border-color: white;
  color: var(--primary-dark);
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}
.tab-btn:disabled { opacity: 0.38; cursor: not-allowed; }

main { max-width: 880px; margin: 0 auto; padding: 32px 16px 72px; }

.view { display: none; }
.view.active { display: block; animation: fadeSlideIn 0.35s ease both; }

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Cards ===== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-soft);
}

.intro { text-align: center; }
.eyebrow {
  display: inline-block;
  background: var(--accent);
  color: var(--primary-dark);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.intro h1 { margin: 0 0 6px; color: var(--text); font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.intro p { max-width: 620px; margin-left: auto; margin-right: auto; color: var(--muted); }
.text-gradient {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.notice {
  background: linear-gradient(135deg, var(--accent), #fff6e8);
  border: 1px solid #f4dfb8;
  padding: 16px 18px;
  border-radius: 14px;
  font-size: 0.92rem;
  margin: 20px 0;
  text-align: left;
}

.consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 18px 0;
  font-size: 0.92rem;
  text-align: left;
  background: #fbf4f8;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
}
.consent input { margin-top: 4px; width: 16px; height: 16px; flex-shrink: 0; }

/* ===== Buttons ===== */
.btn {
  border: none;
  border-radius: 999px;
  padding: 12px 24px;
  font-size: 0.95rem;
  cursor: pointer;
  font-weight: 700;
  font-family: inherit;
  transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.15s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn.primary {
  background: var(--gradient-brand);
  color: white;
  box-shadow: 0 10px 24px rgba(210, 21, 141, 0.3);
}
.btn.primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(210, 21, 141, 0.38); }
.btn.primary:disabled { background: #eec9e0; box-shadow: none; cursor: not-allowed; }
.btn.ghost { background: white; color: var(--primary-dark); border: 1px solid var(--border); }
.btn.ghost:hover { border-color: var(--primary); background: #fdf4fa; }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid #edc7c7; }
.btn.danger:hover { background: #fdf2f2; }
.file-btn { display: inline-flex; align-items: center; }

/* ===== Survey progress & steps ===== */
.progress-wrap { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.progress-bar { flex: 1; height: 10px; background: var(--border); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--gradient-brand); width: 20%; border-radius: 99px; transition: width 0.3s ease; }
#progressLabel { font-size: 0.85rem; color: var(--muted); font-weight: 600; white-space: nowrap; }

.step { display: none; }
.step.active { display: block; animation: fadeSlideIn 0.3s ease both; }
.step h2 { color: var(--text); font-size: 1.35rem; font-weight: 800; letter-spacing: -0.01em; margin: 0 0 22px; }

.question { margin-bottom: 28px; }
.question > label.qlabel { display: block; font-weight: 600; margin-bottom: 12px; color: var(--text); }

.scale-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.scale-option {
  flex: 1;
  min-width: 90px;
  text-align: center;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 12px;
  padding: 12px 6px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  transition: all 0.18s ease;
}
.scale-option input { display: none; }
.scale-option:hover { border-color: var(--primary); transform: translateY(-1px); }
.scale-option.checked {
  background: var(--gradient-brand);
  color: white;
  border-color: transparent;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(210, 21, 141, 0.28);
  transform: translateY(-1px);
}

.radio-options, .select-native { display: flex; flex-direction: column; gap: 8px; }
.radio-option {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: all 0.18s ease;
}
.radio-option:hover { border-color: var(--primary); }
.radio-option input { margin-right: 8px; }
.radio-option.checked { background: var(--accent); border-color: var(--primary); font-weight: 700; }

input[type="text"], textarea, select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.95rem;
  font-family: inherit;
  background: white;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input[type="text"]:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(210, 21, 141, 0.12);
}
textarea { min-height: 80px; resize: vertical; }

.form-nav { display: flex; justify-content: space-between; margin-top: 28px; gap: 10px; }

.muted { color: var(--muted); font-size: 0.9rem; }

/* ===== Results ===== */
.score-hero { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.score-ring {
  --pct: 0;
  --ring-color: var(--primary);
  width: 130px; height: 130px; border-radius: 50%;
  background: conic-gradient(var(--ring-color) calc(var(--pct) * 3.6deg), #f1e0eb 0);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-soft);
}
.score-ring-inner {
  width: 100px; height: 100px; border-radius: 50%;
  background: white;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 1.6rem; font-weight: 800; color: var(--text);
}
.score-ring-inner span { font-size: 0.68rem; font-weight: 600; color: var(--muted); margin-top: 2px; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  margin: 3px 6px 3px 0;
}
.badge.risk { background: #fbe4e4; color: #a13c3c; }
.badge.watch { background: #fdf1dc; color: #96690f; }
.badge.ok { background: #e2f2ea; color: #1f6b4f; }

.plan-block {
  margin-bottom: 20px;
  padding: 18px 20px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #fff;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.plan-block:hover { box-shadow: var(--shadow-soft); }
.plan-block.urgent { background: #fdf2f2; border-color: #f0c6c6; }
.plan-block h3 { margin-top: 0; color: var(--primary-dark); font-size: 1.05rem; font-weight: 800; }
.plan-block ul { margin: 8px 0; padding-left: 20px; }
.plan-block li { margin-bottom: 7px; }

.disclaimer { font-size: 0.82rem; color: var(--muted); margin-top: 18px; border-top: 1px dashed var(--border); padding-top: 12px; }

/* ===== Trends ===== */
.trend-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.trend-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.stat-card {
  text-align: center;
  background: linear-gradient(160deg, #fff, #fdf6fa);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 12px;
}
.stat-num { font-size: 2.1rem; font-weight: 800; background: var(--gradient-brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-label { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }
canvas { max-height: 280px; }

footer { text-align: center; color: var(--muted); font-size: 0.82rem; padding: 28px 16px; }
footer a { font-weight: 600; }

@media (max-width: 600px) {
  .topbar { flex-direction: column; align-items: flex-start; }
  .card { padding: 20px; }
  .intro h1 { font-size: 1.6rem; }
  .score-hero { justify-content: center; text-align: center; }
}
