/* Customer-facing pages: survey (/survey, /r) and customer portal (/me) */
.cx-body {
  --cx-accent: var(--tc-e91e63);
  --cx-accent-d: var(--tc-c2185b);
  --cx-accent-rgb: var(--tr-e91e63);
  --cx-text: var(--tc-2a1a22);
  --cx-muted: var(--tc-7a5c68);
  --cx-line: var(--tc-e8d6de);
  --cx-soft: var(--tc-fff5f8);
  --cx-star: #f5b301;
  margin: 0;
  min-height: 100vh;
  font-family: Vazirmatn, "Segoe UI", Tahoma, sans-serif;
  color: var(--cx-text);
  background:
    radial-gradient(900px 420px at 100% -10%, rgba(var(--cx-accent-rgb), .10), transparent 60%),
    radial-gradient(700px 380px at -10% 110%, rgba(var(--cx-accent-rgb), .07), transparent 60%),
    var(--tc-faf6f8);
}
.cx-main {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 16px 56px;
}
.cx-body .num { font-variant-numeric: tabular-nums; }
.cx-body .sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- shared ---------- */
.cx-card {
  background: #fff;
  border: 1px solid var(--cx-line);
  border-radius: 24px;
  padding: 28px 24px;
  box-shadow: 0 18px 50px -28px rgba(var(--cx-accent-rgb), .35);
}
.cx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 14px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 700;
  font-size: .95rem;
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease, opacity .2s ease;
}
.cx-btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--cx-accent), var(--cx-accent-d));
  box-shadow: 0 10px 24px -12px rgba(var(--cx-accent-rgb), .8);
}
.cx-btn-primary:hover { transform: translateY(-1px); color: #fff; }
.cx-btn-primary:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.cx-btn-ghost {
  color: var(--cx-accent-d);
  background: var(--cx-soft);
  border-color: var(--cx-line);
}
.cx-btn-ghost:hover { background: #fff; color: var(--cx-accent-d); }
.cx-btn-sm { min-height: 38px; padding: 0 14px; border-radius: 11px; font-size: .85rem; }
.cx-alert {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #fff1f1;
  color: #b42318;
  font-size: .88rem;
}
.cx-alert.is-ok { background: #ecfdf3; color: #067647; }

/* ---------- survey ---------- */
.cx-survey { max-width: 480px; margin: 0 auto; }
.cx-survey-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 18px;
  font-weight: 700;
  color: var(--cx-muted);
}
.cx-brand-logo { width: 34px; height: 34px; border-radius: 10px; object-fit: cover; }
.cx-brand-mark {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, var(--cx-accent), var(--cx-accent-d));
}
.cx-survey h1 { margin: 0 0 6px; font-size: 1.45rem; font-weight: 800; text-align: center; }
.cx-lead { margin: 0 0 16px; text-align: center; color: var(--cx-muted); font-size: .92rem; line-height: 1.9; }
.cx-visit {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.cx-visit span {
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--cx-soft);
  border: 1px solid var(--cx-line);
  font-size: .8rem;
  color: var(--cx-muted);
}

.cx-rate {
  margin: 0 0 14px;
  padding: 18px 14px 14px;
  border: 1px solid var(--cx-line);
  border-radius: 18px;
  text-align: center;
}
.cx-rate legend {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 auto;
  padding: 0 8px;
  font-size: .93rem;
}
.cx-rate legend b { color: var(--cx-accent-d); }
.cx-rate-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px rgba(var(--cx-accent-rgb), .25);
}
/* DOM order 5→1; row-reverse in RTL puts 1 on the right so `~` fills from the right */
.cx-stars {
  display: inline-flex;
  flex-direction: row-reverse;
  gap: 4px;
  margin-top: 6px;
}
.cx-stars input { position: absolute; opacity: 0; pointer-events: none; }
.cx-stars label { cursor: pointer; padding: 2px; line-height: 0; }
.cx-stars svg {
  width: 38px; height: 38px;
  fill: #ece4e8;
  transition: fill .15s ease, transform .2s cubic-bezier(.34, 1.56, .64, 1);
}
.cx-stars label:hover svg,
.cx-stars label:hover ~ label svg,
.cx-stars input:checked ~ label svg { fill: var(--cx-star); }
.cx-stars:hover input:checked ~ label svg { fill: #ece4e8; }
.cx-stars:hover label:hover svg,
.cx-stars:hover label:hover ~ label svg { fill: var(--cx-star); }
.cx-stars label:hover svg { transform: scale(1.15); }
.cx-stars input:checked + label svg { animation: cx-pop .35s ease; }
.cx-stars input:focus-visible + label { outline: 2px solid var(--cx-accent); border-radius: 8px; }
@keyframes cx-pop { 50% { transform: scale(1.3); } }
.cx-rate-label {
  display: block;
  margin-top: 4px;
  min-height: 1.4em;
  font-size: .8rem;
  color: var(--cx-muted);
}
.cx-rate-label.is-set { color: var(--cx-accent-d); font-weight: 700; }

.cx-block { margin: 18px 0 0; position: relative; }
.cx-block-title { display: block; margin: 0 0 10px; font-size: .9rem; font-weight: 700; }
.cx-block-title small { font-weight: 400; color: var(--cx-muted); }
.cx-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.cx-tag {
  position: relative;
  cursor: pointer;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--cx-line);
  background: #fff;
  font-size: .82rem;
  color: var(--cx-muted);
  user-select: none;
  transition: all .18s ease;
}
.cx-tag input { position: absolute; opacity: 0; pointer-events: none; }
.cx-tag:hover { border-color: rgba(var(--cx-accent-rgb), .45); }
.cx-tag.is-on {
  color: var(--cx-accent-d);
  border-color: rgba(var(--cx-accent-rgb), .55);
  background: rgba(var(--cx-accent-rgb), .08);
  font-weight: 700;
}
.cx-tag.is-on::before { content: "✓ "; }
.cx-tags.is-static { justify-content: center; margin-top: 14px; }
.cx-tags.is-static .cx-tag { cursor: default; }
.cx-textarea {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  min-height: 92px;
  padding: 12px 14px;
  border: 1px solid var(--cx-line);
  border-radius: 14px;
  font: inherit;
  font-size: .9rem;
  color: var(--cx-text);
  background: var(--tc-fffafc);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.cx-textarea:focus {
  outline: none;
  border-color: var(--cx-accent);
  box-shadow: 0 0 0 4px rgba(var(--cx-accent-rgb), .12);
}
.cx-counter { position: absolute; left: 12px; bottom: 10px; font-size: .72rem; color: var(--cx-muted); }
.cx-submit { width: 100%; margin-top: 20px; }
.cx-note { margin: 12px 0 0; text-align: center; font-size: .74rem; color: var(--cx-muted); line-height: 1.8; }

.cx-thanks { text-align: center; }
.cx-thanks p { color: var(--cx-muted); margin: 0 0 16px; line-height: 1.9; }
.cx-thanks-check { width: 76px; height: 76px; margin: 0 auto 14px; }
.cx-thanks-check svg { width: 100%; height: 100%; }
.cx-thanks-check circle {
  stroke: var(--cx-accent); stroke-width: 3;
  stroke-dasharray: 151; stroke-dashoffset: 151;
  animation: cx-draw .7s ease forwards;
}
.cx-thanks-check path {
  stroke: var(--cx-accent); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 40; stroke-dashoffset: 40;
  animation: cx-draw .4s .55s ease forwards;
}
@keyframes cx-draw { to { stroke-dashoffset: 0; } }
.cx-thanks-scores { display: grid; gap: 8px; max-width: 300px; margin: 0 auto; }
.cx-thanks-scores > div {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 14px; border-radius: 12px; background: var(--cx-soft); font-size: .86rem;
}
.cx-mini-stars {
  --v: 0;
  letter-spacing: 2px;
  font-size: 1rem;
  background: linear-gradient(to left, var(--cx-star) calc(var(--v) * 20%), #e4dadf 0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.cx-quote {
  margin: 14px 0 0;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--tc-fffafc);
  border: 1px dashed var(--cx-line);
  font-size: .88rem;
  line-height: 1.9;
}
.cx-thanks-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 22px; }

/* ---------- portal: login / verify ---------- */
.cx-auth { max-width: 420px; margin: 4vh auto 0; }
.cx-auth-head { text-align: center; margin-bottom: 22px; }
.cx-auth-icon {
  width: 64px; height: 64px;
  margin: 0 auto 14px;
  display: grid; place-items: center;
  border-radius: 20px;
  color: #fff;
  background: linear-gradient(135deg, var(--cx-accent), var(--cx-accent-d));
  box-shadow: 0 14px 30px -14px rgba(var(--cx-accent-rgb), .9);
}
.cx-auth-icon svg { width: 30px; height: 30px; }
.cx-auth h1 { margin: 0 0 6px; font-size: 1.4rem; font-weight: 800; }
.cx-auth-head p { margin: 0; color: var(--cx-muted); font-size: .9rem; line-height: 1.9; }
.cx-field { display: block; margin-bottom: 16px; }
.cx-field > span { display: block; margin-bottom: 8px; font-size: .86rem; font-weight: 700; }
.cx-input {
  width: 100%;
  box-sizing: border-box;
  height: 54px;
  padding: 0 16px;
  border: 1px solid var(--cx-line);
  border-radius: 14px;
  font: inherit;
  font-size: 1.1rem;
  letter-spacing: 1px;
  text-align: center;
  color: var(--cx-text);
  background: var(--tc-fffafc);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.cx-input:focus { outline: none; border-color: var(--cx-accent); box-shadow: 0 0 0 4px rgba(var(--cx-accent-rgb), .12); }
.cx-input.is-otp { font-size: 1.6rem; letter-spacing: 14px; font-weight: 800; }
.cx-auth .cx-btn { width: 100%; }
.cx-auth-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  margin-top: 16px; font-size: .84rem; color: var(--cx-muted);
}
.cx-link { color: var(--cx-accent-d); font-weight: 700; text-decoration: none; background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.cx-link:disabled { color: var(--cx-muted); font-weight: 400; cursor: default; }
.cx-auth-back { display: block; text-align: center; margin-top: 18px; font-size: .84rem; color: var(--cx-muted); text-decoration: none; }

/* ---------- portal: dashboard ---------- */
.cx-hero {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 22px 24px;
  border-radius: 24px;
  color: #fff;
  background: linear-gradient(135deg, var(--cx-accent), var(--cx-accent-d));
  box-shadow: 0 22px 50px -26px rgba(var(--cx-accent-rgb), .9);
}
.cx-hero-avatar {
  width: 58px; height: 58px;
  display: grid; place-items: center;
  border-radius: 18px;
  background: rgba(255, 255, 255, .2);
  font-size: 1.5rem; font-weight: 800;
}
.cx-hero-info { flex: 1; min-width: 160px; }
.cx-hero-info h1 { margin: 0; font-size: 1.3rem; font-weight: 800; }
.cx-hero-info p { margin: 2px 0 0; opacity: .85; font-size: .88rem; }
.cx-hero .cx-btn { color: #fff; background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .3); }
.cx-hero .cx-btn:hover { background: rgba(255, 255, 255, .26); }

.cx-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 16px 0 6px; }
.cx-stat { padding: 16px; border-radius: 18px; background: #fff; border: 1px solid var(--cx-line); }
.cx-stat b { display: block; font-size: 1.45rem; font-weight: 800; color: var(--cx-accent-d); }
.cx-stat span { font-size: .8rem; color: var(--cx-muted); }

.cx-section { margin-top: 26px; }
.cx-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.cx-section-head h2 { margin: 0; font-size: 1.05rem; font-weight: 800; }
.cx-section-head span { font-size: .8rem; color: var(--cx-muted); }
.cx-empty {
  padding: 22px; border-radius: 18px; text-align: center;
  border: 1px dashed var(--cx-line); color: var(--cx-muted); font-size: .88rem; background: rgba(255, 255, 255, .6);
}

.cx-appts { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.cx-appt {
  display: flex; gap: 14px; align-items: center;
  padding: 14px; border-radius: 18px; background: #fff; border: 1px solid var(--cx-line);
}
.cx-appt-date {
  flex: 0 0 64px; height: 68px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 14px;
  background: rgba(var(--cx-accent-rgb), .08);
  color: var(--cx-accent-d);
}
.cx-appt-date b { font-size: 1.35rem; line-height: 1.1; }
.cx-appt-date small { font-size: .72rem; }
.cx-appt-body { flex: 1; min-width: 0; }
.cx-appt-body h3 { margin: 0 0 3px; font-size: .95rem; }
.cx-appt-body p { margin: 0; font-size: .8rem; color: var(--cx-muted); line-height: 1.8; }
.cx-badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .7rem; font-weight: 700;
  background: #ecfdf3; color: #067647;
}
.cx-badge.is-wait { background: #fff7e6; color: #b54708; }

.cx-surveys { display: grid; gap: 10px; }
.cx-survey-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 16px; border-radius: 18px;
  background: linear-gradient(90deg, rgba(var(--cx-accent-rgb), .07), #fff);
  border: 1px solid rgba(var(--cx-accent-rgb), .25);
}
.cx-survey-item p { margin: 0; font-size: .88rem; }
.cx-survey-item small { color: var(--cx-muted); }

.cx-salons { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.cx-salon {
  display: flex; flex-direction: column; gap: 6px;
  padding: 16px; border-radius: 18px; background: #fff; border: 1px solid var(--cx-line);
}
.cx-salon-top { display: flex; align-items: center; gap: 10px; }
.cx-salon-top img, .cx-salon-top .cx-brand-mark { width: 40px; height: 40px; border-radius: 12px; object-fit: cover; flex: 0 0 40px; }
.cx-salon h3 { margin: 0; font-size: .95rem; }
.cx-salon small { color: var(--cx-muted); font-size: .76rem; }
.cx-salon .cx-btn { margin-top: 6px; }

.cx-timeline { position: relative; display: grid; gap: 10px; padding-right: 18px; }
.cx-timeline::before {
  content: ""; position: absolute; top: 6px; bottom: 6px; right: 5px;
  width: 2px; border-radius: 2px; background: var(--cx-line);
}
.cx-tl-item {
  position: relative;
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center;
  padding: 12px 16px; border-radius: 16px; background: #fff; border: 1px solid var(--cx-line);
}
.cx-tl-item::before {
  content: ""; position: absolute; right: -18px; top: 50%;
  width: 12px; height: 12px; margin-top: -6px; border-radius: 50%;
  background: #fff; border: 3px solid var(--cx-accent);
}
.cx-tl-item h3 { margin: 0; font-size: .92rem; }
.cx-tl-item p { margin: 0; font-size: .78rem; color: var(--cx-muted); grid-column: 1; }
.cx-tl-meta { grid-row: 1 / span 2; grid-column: 2; text-align: left; font-size: .78rem; color: var(--cx-muted); }
.cx-tl-meta b { display: block; color: var(--cx-text); font-size: .86rem; }
.cx-tl-item.is-cancel { opacity: .6; }
.cx-tl-item.is-cancel::before { border-color: var(--cx-muted); }

@media (max-width: 640px) {
  .cx-main { padding: 18px 12px 44px; }
  .cx-card { padding: 22px 16px; border-radius: 20px; }
  .cx-stats { grid-template-columns: repeat(2, 1fr); }
  .cx-stars svg { width: 34px; height: 34px; }
  .cx-hero { padding: 18px; }
}
