@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'Inter', system-ui, sans-serif; background: #fdf6f9; color: #1e0f1a; -webkit-text-size-adjust: 100%; padding-bottom: 72px; }
a { color: inherit; text-decoration: none; }
button { border: none; cursor: pointer; font-family: inherit; }

:root {
  --primary: #c4578a;
  --primary-dark: #9b3d6b;
  --primary-light: #e87fb5;
  --primary-bg: #fce7f3;
  --text: #1e0f1a;
  --text-muted: #7a5d70;
  --border: #e8d5e2;
  --bg: #fdf6f9;
  --surface: #fff;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,.07);
  --shadow-md: 0 4px 16px rgba(0,0,0,.1);
}

/* ── Page header ─────────────────────────────────────────────────────────── */
.cli-header {
  background: white; border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  display: flex; align-items: center; gap: 12px;
  position: sticky; top: 0; z-index: 100;
}
.cli-header-logo { font-size: 1rem; font-weight: 800; color: var(--primary); }
.cli-header-title { font-size: 1rem; font-weight: 700; }
.cli-header-back { width: 36px; height: 36px; border-radius: 50%; background: var(--bg); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 18px; cursor: pointer; flex-shrink: 0; transition: .15s; }
.cli-header-back:hover { background: var(--primary-bg); }

/* ── Body ────────────────────────────────────────────────────────────────── */
.cli-body { padding: 16px 16px 24px; max-width: 540px; margin: 0 auto; }

/* ── Bottom nav ──────────────────────────────────────────────────────────── */
.cli-bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #1e0f1a; z-index: 200;
  padding: 6px 0 env(safe-area-inset-bottom, 6px);
  box-shadow: 0 -2px 12px rgba(0,0,0,.2);
  display: flex;
}
.cli-bottom-nav-items { display: flex; width: 100%; justify-content: space-around; align-items: center; }
.cli-nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 12px; color: rgba(255,255,255,.5);
  font-size: .6rem; font-weight: 600; cursor: pointer; min-width: 58px;
  text-decoration: none; border-radius: 8px; transition: .15s;
  min-height: 50px; justify-content: center;
}
.cli-nav-item .nav-icon { font-size: 22px; line-height: 1; }
.cli-nav-item.active { color: var(--primary-light); }
.cli-nav-item:active { background: rgba(255,255,255,.08); }

/* ── Card ────────────────────────────────────────────────────────────────── */
.cli-card {
  background: white; border-radius: var(--radius); border: 1px solid var(--border);
  padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.cli-card-title { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: 12px; }

/* ── Profile hero card ───────────────────────────────────────────────────── */
.cli-profile-hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: var(--radius); padding: 22px 20px; margin-bottom: 16px; color: white;
  display: flex; align-items: center; gap: 16px;
}
.cli-avatar {
  width: 60px; height: 60px; border-radius: 50%;
  background: rgba(255,255,255,.25); display: flex; align-items: center;
  justify-content: center; font-size: 1.3rem; font-weight: 800; flex-shrink: 0;
  border: 2.5px solid rgba(255,255,255,.5);
}
.cli-profile-name { font-size: 1.1rem; font-weight: 800; }
.cli-profile-phone { font-size: .78rem; opacity: .8; margin-top: 2px; }
.cli-tier-badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 12px; border-radius: 99px; background: rgba(255,255,255,.2); font-size: .76rem; font-weight: 700; margin-top: 6px; }

/* ── Tier progress ───────────────────────────────────────────────────────── */
.cli-tier-card {
  background: white; border-radius: var(--radius); padding: 16px; margin-bottom: 12px;
  border: 1.5px solid var(--border); position: relative; overflow: hidden;
}
.cli-tier-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.cli-tier-badge-lg { font-size: .85rem; font-weight: 700; padding: 5px 14px; border-radius: 99px; color: white; }
.cli-progress-bar { height: 8px; background: var(--border); border-radius: 99px; overflow: hidden; margin-bottom: 6px; }
.cli-progress-fill { height: 100%; border-radius: 99px; transition: width .6s ease; }
.cli-progress-label { font-size: .72rem; color: var(--text-muted); display: flex; justify-content: space-between; }

/* ── Stat row ────────────────────────────────────────────────────────────── */
.cli-stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.cli-stat-item { background: white; border-radius: 10px; border: 1px solid var(--border); padding: 14px 10px; text-align: center; }
.cli-stat-val { font-size: 1.35rem; font-weight: 800; color: var(--primary); }
.cli-stat-lbl { font-size: .65rem; color: var(--text-muted); font-weight: 600; margin-top: 2px; text-transform: uppercase; letter-spacing: .04em; }

/* ── Appointment list item ───────────────────────────────────────────────── */
.cli-apt {
  background: white; border-radius: var(--radius); border: 1px solid var(--border);
  padding: 14px 16px; margin-bottom: 10px;
  display: flex; align-items: flex-start; gap: 12px; box-shadow: var(--shadow);
}
.cli-apt-time { text-align: center; min-width: 44px; flex-shrink: 0; }
.cli-apt-time-h { font-size: .95rem; font-weight: 800; }
.cli-apt-time-d { font-size: .65rem; color: var(--text-muted); }
.cli-apt-divider { width: 3px; border-radius: 2px; flex-shrink: 0; min-height: 40px; }
.cli-apt-info { flex: 1; min-width: 0; }
.cli-apt-name { font-size: .9rem; font-weight: 700; }
.cli-apt-svc { font-size: .76rem; color: var(--text-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cli-apt-prof { font-size: .72rem; color: var(--primary); font-weight: 500; margin-top: 2px; }

/* ── Status badge ────────────────────────────────────────────────────────── */
.cli-badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 99px; font-size: .72rem; font-weight: 600; }
.cli-badge-scheduled   { background: #dbeafe; color: #1d4ed8; }
.cli-badge-confirmed   { background: #dcfce7; color: #166534; }
.cli-badge-completed   { background: #f3f4f6; color: #374151; }
.cli-badge-canceled    { background: #fee2e2; color: #991b1b; }
.cli-badge-waiting     { background: #fef9c3; color: #854d0e; }
.cli-badge-in_progress { background: #ffedd5; color: #9a3412; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.cli-form-group { margin-bottom: 16px; }
.cli-label { display: block; font-size: .8rem; font-weight: 600; color: var(--text-muted); margin-bottom: 7px; }
.cli-input {
  width: 100%; padding: 13px 16px; border: 1.5px solid var(--border);
  border-radius: 10px; font-size: 16px; font-family: inherit; color: var(--text);
  background: white; outline: none; transition: .15s; min-height: 50px;
}
.cli-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(196,87,138,.12); }
.cli-input::placeholder { color: #b0909f; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.cli-btn-primary {
  width: 100%; padding: 15px; border-radius: 12px;
  background: var(--primary); color: white; font-size: .95rem; font-weight: 700;
  border: none; cursor: pointer; min-height: 52px; transition: .15s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.cli-btn-primary:hover { background: var(--primary-dark); }
.cli-btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.cli-btn-outline {
  width: 100%; padding: 13px; border-radius: 12px;
  background: transparent; color: var(--primary);
  font-size: .9rem; font-weight: 600; border: 1.5px solid var(--primary);
  cursor: pointer; min-height: 50px; transition: .15s; margin-top: 10px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.cli-btn-outline:hover { background: var(--primary-bg); }
.cli-btn-danger { background: #fee2e2; color: #991b1b; border-color: #fecaca; }

/* ── Referral ────────────────────────────────────────────────────────────── */
.cli-referral-box {
  background: linear-gradient(135deg, var(--primary-bg), #fff5fb);
  border: 1.5px dashed var(--primary-light);
  border-radius: var(--radius); padding: 20px; text-align: center; margin-bottom: 16px;
}
.cli-referral-code {
  font-size: 1.8rem; font-weight: 800; color: var(--primary-dark);
  letter-spacing: .12em; margin: 10px 0;
  background: white; border-radius: 10px; padding: 12px 20px; display: inline-block;
}
.cli-copy-btn {
  background: var(--primary); color: white;
  padding: 10px 22px; border-radius: 99px; font-size: .84rem; font-weight: 700;
  cursor: pointer; transition: .15s; display: inline-flex; align-items: center; gap: 8px;
}
.cli-copy-btn:hover { background: var(--primary-dark); }

/* ── Referral item ───────────────────────────────────────────────────────── */
.ref-item { background: white; border-radius: 10px; border: 1px solid var(--border); padding: 12px 14px; margin-bottom: 8px; display: flex; align-items: center; gap: 12px; }
.ref-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--primary-bg); display: flex; align-items: center; justify-content: center; font-size: .85rem; font-weight: 700; color: var(--primary-dark); flex-shrink: 0; }
.ref-info { flex: 1; }
.ref-name { font-size: .88rem; font-weight: 700; }
.ref-phone { font-size: .72rem; color: var(--text-muted); }
.ref-status-pending     { color: #854d0e; background: #fef9c3; }
.ref-status-converted   { color: #166534; background: #dcfce7; }
.ref-status-rewarded    { color: #9b3d6b; background: var(--primary-bg); }

/* ── Empty state ─────────────────────────────────────────────────────────── */
.cli-empty { text-align: center; padding: 50px 20px; color: var(--text-muted); }
.cli-empty-icon { font-size: 3rem; display: block; margin-bottom: 14px; }
.cli-empty-title { font-size: .95rem; font-weight: 700; margin-bottom: 6px; color: var(--text); }

/* ── Next appt banner ────────────────────────────────────────────────────── */
.next-apt-banner {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: var(--radius); padding: 18px 20px; color: white; margin-bottom: 14px;
  display: flex; align-items: center; gap: 14px;
}
.next-apt-icon { font-size: 2rem; flex-shrink: 0; }
.next-apt-label { font-size: .72rem; opacity: .8; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.next-apt-name { font-size: 1rem; font-weight: 800; margin-top: 2px; }
.next-apt-detail { font-size: .78rem; opacity: .85; margin-top: 2px; }

/* ── Section heading ─────────────────────────────────────────────────────── */
.cli-section-title { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin: 20px 0 10px; }

/* ── Spinner ─────────────────────────────────────────────────────────────── */
.cli-loading { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 50px 20px; color: var(--text-muted); }
.spinner-cli { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Auth gate ───────────────────────────────────────────────────────────── */
.auth-gate { max-width: 420px; margin: 0 auto; padding: 40px 20px; }
.auth-gate-logo { text-align: center; font-size: 3rem; margin-bottom: 8px; }
.auth-gate-title { text-align: center; font-size: 1.3rem; font-weight: 800; margin-bottom: 6px; }
.auth-gate-sub { text-align: center; color: var(--text-muted); font-size: .88rem; margin-bottom: 28px; line-height: 1.5; }
.auth-tabs { display: flex; border: 1.5px solid var(--border); border-radius: 10px; overflow: hidden; margin-bottom: 24px; }
.auth-tab { flex: 1; padding: 12px; text-align: center; font-size: .84rem; font-weight: 600; cursor: pointer; background: white; color: var(--text-muted); transition: .15s; border: none; }
.auth-tab.active { background: var(--primary); color: white; }

/* ── History item ────────────────────────────────────────────────────────── */
.hist-item { background: white; border-radius: var(--radius); border: 1px solid var(--border); padding: 14px 16px; margin-bottom: 10px; display: flex; gap: 12px; align-items: flex-start; }
.hist-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; }
.hist-info { flex: 1; min-width: 0; }
.hist-svc { font-size: .9rem; font-weight: 700; }
.hist-meta { font-size: .74rem; color: var(--text-muted); margin-top: 3px; }
.hist-price { font-size: .88rem; font-weight: 700; color: var(--primary-dark); white-space: nowrap; }
