/* ── Google Fonts ─────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400&family=DM+Sans:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Design tokens ────────────────────────────────────────────────────────── */
:root {
  --crimson:       #B01C2E;
  --crimson-dark:  #8A1524;
  --crimson-light: #D4243A;
  --gold:          #C9A84C;
  --gold-light:    #E2C47A;
  --gold-dim:      rgba(201,168,76,.12);
  --cream:         #FAF8F4;
  --warm-white:    #FFFFFF;
  --ink:           #1C1208;
  --ink-muted:     #6B5B45;
  --border:        #E4DACC;
  --shadow-sm:     0 1px 4px rgba(28,18,8,.07);
  --shadow-md:     0 4px 20px rgba(28,18,8,.10);
  --shadow-lg:     0 12px 40px rgba(28,18,8,.14);
  --radius:        12px;
  --radius-sm:     8px;
}

/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--cream);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ───────────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, .display {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
}

.mono {
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.04em;
}

/* ── Navbar ───────────────────────────────────────────────────────────────── */
.cnss-nav {
  background: var(--crimson-dark);
  background-image:
    repeating-linear-gradient( 45deg, transparent, transparent 18px, rgba(201,168,76,.06) 18px, rgba(201,168,76,.06) 19px),
    repeating-linear-gradient(-45deg, transparent, transparent 18px, rgba(201,168,76,.06) 18px, rgba(201,168,76,.06) 19px);
  padding: 0 1.25rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(28,18,8,.25);
}

.cnss-nav__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.cnss-nav__logo {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(201,168,76,.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .65rem;
  color: var(--gold-light);
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  letter-spacing: .03em;
}

.cnss-nav__title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: .01em;
}

.cnss-nav__title span {
  color: var(--gold-light);
  font-weight: 400;
  font-size: 1rem;
  margin-left: 4px;
}

.cnss-nav__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-profile-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  color: #fff;
  padding: 5px 12px 5px 6px;
  border-radius: 50px;
  font-size: .82rem;
  font-weight: 500;
  text-decoration: none;
  transition: background .2s, border-color .2s;
}

.nav-profile-btn:hover {
  background: rgba(255,255,255,.18);
  border-color: var(--gold-light);
  color: #fff;
}

.nav-profile-btn__avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--crimson-dark);
  font-size: .72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.lang-toggle {
  display: flex;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 50px;
  overflow: hidden;
}

.lang-toggle a {
  padding: 4px 10px;
  color: rgba(255,255,255,.7);
  font-size: .78rem;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s, color .15s;
}

.lang-toggle a.active,
.lang-toggle a:hover {
  background: rgba(255,255,255,.18);
  color: #fff;
}

/* ── Flash messages ───────────────────────────────────────────────────────── */
.flash-wrap { padding: .5rem 1rem 0; }

.flash {
  padding: .65rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  border: 1px solid transparent;
}

.flash--success { background: #f0fdf4; border-color: #86efac; color: #166534; }
.flash--warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }

/* ── Main layout ──────────────────────────────────────────────────────────── */
main { min-height: calc(100vh - 60px - 56px); padding: 1.5rem 1rem 2rem; max-width: 640px; margin: 0 auto; }

/* ── Profile banner ───────────────────────────────────────────────────────── */
.profile-banner {
  background: var(--warm-white);
  border: 1px solid var(--border);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-sm);
  animation: slideUp .4s ease both;
}

.profile-banner__avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--crimson), var(--crimson-dark));
  color: #fff;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.3rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(176,28,46,.3);
}

.profile-banner__info { flex: 1; min-width: 0; }

.profile-banner__name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-banner__meta {
  font-size: .78rem;
  color: var(--ink-muted);
  margin-top: 1px;
}

.profile-banner__meta strong { color: var(--ink); font-weight: 600; }

.btn-edit {
  background: var(--cream);
  border: 1px solid var(--border);
  color: var(--ink-muted);
  font-size: .78rem;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 50px;
  text-decoration: none;
  transition: border-color .2s, color .2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-edit:hover { border-color: var(--crimson); color: var(--crimson); }

/* ── No profile CTA ───────────────────────────────────────────────────────── */
.setup-cta {
  background: linear-gradient(135deg, var(--crimson-dark), var(--crimson));
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-md);
  animation: slideUp .4s ease both;
}

.setup-cta__icon { font-size: 2rem; flex-shrink: 0; }

.setup-cta__text { flex: 1; }

.setup-cta__title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: .2rem;
}

.setup-cta__sub { font-size: .82rem; color: rgba(255,255,255,.75); }

.btn-cta {
  background: var(--gold);
  color: var(--crimson-dark);
  font-weight: 700;
  font-size: .85rem;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background .2s, transform .15s;
}

.btn-cta:hover { background: var(--gold-light); transform: translateY(-1px); }

/* ── Section heading ──────────────────────────────────────────────────────── */
.section-title {
  font-family: 'DM Sans', sans-serif;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 1.5rem 0 .75rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Form cards ───────────────────────────────────────────────────────────── */
.form-cards { display: flex; flex-direction: column; gap: .65rem; }

.form-card {
  background: var(--warm-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
  color: inherit;
  transition: border-color .2s, box-shadow .2s, transform .15s;
  animation: slideUp .4s ease both;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.form-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(to bottom, var(--gold), var(--crimson));
  opacity: 0;
  transition: opacity .2s;
}

.form-card:hover {
  border-color: var(--gold);
  box-shadow: var(--shadow-md), 0 0 0 1px var(--gold-dim);
  transform: translateY(-2px);
  color: inherit;
}

.form-card:hover::before { opacity: 1; }

.form-card--locked { opacity: .45; pointer-events: none; }

.form-card__icon {
  font-size: 1.8rem;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cream);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.form-card__body { flex: 1; min-width: 0; }

.form-card__title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
}

.form-card__desc { font-size: .78rem; color: var(--ink-muted); line-height: 1.4; }

.form-card__arrow {
  color: var(--border);
  font-size: 1rem;
  flex-shrink: 0;
  transition: color .2s, transform .2s;
}

.form-card:hover .form-card__arrow { color: var(--gold); transform: translateX(3px); }

/* ── Stagger animations ───────────────────────────────────────────────────── */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.form-card:nth-child(1) { animation-delay: .05s; }
.form-card:nth-child(2) { animation-delay: .10s; }
.form-card:nth-child(3) { animation-delay: .15s; }
.form-card:nth-child(4) { animation-delay: .20s; }
.form-card:nth-child(5) { animation-delay: .25s; }
.form-card:nth-child(6) { animation-delay: .30s; }

/* ── Form inputs ──────────────────────────────────────────────────────────── */
.field { margin-bottom: 1.25rem; }

.field__label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--ink-muted);
  margin-bottom: .4rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.field__label .req { color: var(--crimson); margin-left: 2px; }

.field__input,
.field__select {
  width: 100%;
  padding: .75rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--warm-white);
  color: var(--ink);
  font-family: 'DM Sans', sans-serif;
  font-size: .95rem;
  transition: border-color .2s, box-shadow .2s;
  outline: none;
  -webkit-appearance: none;
}

.field__input:focus,
.field__select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
}

.field__input--lg { font-size: 1.1rem; padding: .9rem 1.1rem; font-family: 'JetBrains Mono', monospace; letter-spacing: .04em; }

.field__hint { font-size: .75rem; color: var(--ink-muted); margin-top: .35rem; }

.field__row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }

.field__divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0 1.25rem;
}

.field__optional-label {
  font-size: .75rem;
  font-weight: 500;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 1rem;
  display: block;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  width: 100%;
  padding: .9rem;
  background: linear-gradient(135deg, var(--crimson), var(--crimson-dark));
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: .95rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: transform .15s, box-shadow .2s, opacity .2s;
  box-shadow: 0 4px 14px rgba(176,28,46,.35);
  letter-spacing: .01em;
}

.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(176,28,46,.4); color: #fff; }
.btn-primary:active { transform: translateY(0); }

.btn-primary--gold {
  background: linear-gradient(135deg, var(--gold), #B8922A);
  color: var(--crimson-dark);
  box-shadow: 0 4px 14px rgba(201,168,76,.35);
}
.btn-primary--gold:hover { box-shadow: 0 6px 20px rgba(201,168,76,.4); color: var(--crimson-dark); }

.btn-success {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  width: 100%;
  padding: 1rem;
  background: linear-gradient(135deg, #1a7a4a, #155f39);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: transform .15s, box-shadow .2s;
  box-shadow: 0 4px 14px rgba(26,122,74,.3);
  letter-spacing: .01em;
}
.btn-success:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(26,122,74,.4); color: #fff; }

.btn-ghost {
  display: block;
  text-align: center;
  padding: .6rem;
  color: var(--ink-muted);
  font-size: .85rem;
  text-decoration: none;
  transition: color .2s;
  margin-top: .5rem;
}
.btn-ghost:hover { color: var(--crimson); }

/* ── Profile summary card (on form page) ─────────────────────────────────── */
.profile-card {
  background: var(--warm-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.profile-card__name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
  font-weight: 600;
}

.profile-card__meta { font-size: .78rem; color: var(--ink-muted); line-height: 1.5; }
.profile-card__meta strong { color: var(--ink); }

/* ── Form header ──────────────────────────────────────────────────────────── */
.form-header {
  display: flex;
  align-items: flex-start;
  gap: .9rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.form-header__icon {
  font-size: 2.2rem;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #fff5f5, #ffe4e6);
  border: 1px solid #fecdd3;
  border-radius: var(--radius);
  flex-shrink: 0;
}

.form-header__title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 2px;
}

.form-header__desc { font-size: .82rem; color: var(--ink-muted); }

/* ── Beneficiary selector ─────────────────────────────────────────────────── */
.benef-options { display: flex; flex-direction: column; gap: .55rem; margin-bottom: 1.25rem; }

.benef-option {
  background: var(--warm-white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .9rem 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  cursor: pointer;
  transition: border-color .2s, background .2s, box-shadow .15s;
  user-select: none;
}

.benef-option:hover { border-color: var(--gold); background: #fffcf5; }

.benef-option.selected {
  border-color: var(--crimson);
  background: linear-gradient(135deg, #fff5f5, #fff);
  box-shadow: 0 0 0 1px rgba(176,28,46,.1);
}

.benef-option__radio {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color .2s;
}

.benef-option.selected .benef-option__radio {
  border-color: var(--crimson);
  background: var(--crimson);
}

.benef-option.selected .benef-option__radio::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
}

.benef-option__label { flex: 1; }
.benef-option__name { font-weight: 600; font-size: .92rem; color: var(--ink); }
.benef-option__sub { font-size: .75rem; color: var(--ink-muted); margin-top: 1px; }

/* ── Dependent fields card ────────────────────────────────────────────────── */
.dependent-card {
  background: #fffcf5;
  border: 1.5px solid #f0e4c8;
  border-radius: var(--radius);
  padding: 1.1rem;
  margin-bottom: 1.25rem;
  animation: slideUp .25s ease both;
}

/* ── Info note ────────────────────────────────────────────────────────────── */
.info-note {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: #f0f7ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  padding: .65rem 1rem;
  font-size: .8rem;
  color: #1e40af;
  margin-bottom: 1.25rem;
}

/* ── Page title ───────────────────────────────────────────────────────────── */
.page-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: .2rem;
}

.page-subtitle { font-size: .83rem; color: var(--ink-muted); margin-bottom: 1.75rem; }

/* ── Footer ───────────────────────────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 1rem;
  font-size: .72rem;
  color: var(--ink-muted);
  border-top: 1px solid var(--border);
  background: var(--warm-white);
}

/* ── RTL ──────────────────────────────────────────────────────────────────── */
[dir="rtl"] .form-card::before { left: auto; right: 0; }
[dir="rtl"] .profile-banner { border-left: none; border-right: 4px solid var(--gold); }
[dir="rtl"] .form-card__arrow { transform: scaleX(-1); }
[dir="rtl"] .form-card:hover .form-card__arrow { transform: scaleX(-1) translateX(-3px); }
[dir="rtl"] .section-title::after { display: none; }
[dir="rtl"] .section-title::before { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── Mobile ───────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  main { padding: 1.1rem .75rem 2rem; }
  .setup-cta { flex-direction: column; text-align: center; }
  .btn-cta { width: 100%; text-align: center; }
}
