/* ── MEND STYLES ─────────────────────────────────────────────────────────── */

:root {
  --cream:     #F7F3EE;
  --parchment: #EDE8E0;
  --sage:      #7A9E87;
  --sage-dark: #5C7A68;
  --charcoal:  #2C2C2C;
  --muted:     #8A8078;
  --border:    #DDD8D0;
  --white:     #FFFFFF;
  --rose:      #C4876A;
  --safe-area-top: env(safe-area-inset-top, 0px);
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { height: 100%; }
body {
  min-height: 100%;
  background: var(--cream);
  font-family: 'Jost', sans-serif;
  font-weight: 300;
  color: var(--charcoal);
  font-size: 15px;
  line-height: 1.6;
  padding-top: var(--safe-area-top);
  padding-bottom: var(--safe-area-bottom);
}

/* ── TYPOGRAPHY ─────────────────────────────────────────────────────────── */
.serif { font-family: 'Cormorant Garant', serif; }
h1, .h1 { font-family: 'Cormorant Garant', serif; font-size: 36px; font-weight: 300; line-height: 1.2; margin-bottom: 12px; }
h2, .h2 { font-family: 'Cormorant Garant', serif; font-size: 26px; font-weight: 300; margin-bottom: 8px; }
h1 em, .h1 em { font-style: italic; color: var(--sage); }
.sub { color: var(--muted); font-size: 15px; margin-bottom: 28px; }
a { color: var(--sage); text-decoration: none; }
a:hover { color: var(--sage-dark); }

/* ── LAYOUT ─────────────────────────────────────────────────────────────── */
.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 16px 80px;
}

.content {
  width: 100%;
  max-width: 480px;
  margin-top: 40px;
  animation: fadeUp 0.35s ease both;
}

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

/* ── HEADER ─────────────────────────────────────────────────────────────── */
.app-header {
  width: 100%;
  background: var(--cream);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo { font-family: 'Cormorant Garant', serif; font-size: 26px; font-weight: 300; letter-spacing: 0.08em; color: var(--charcoal); }
.logo span { color: var(--sage); }
.header-right { display: flex; align-items: center; gap: 16px; font-size: 13px; }
.back-btn { color: var(--muted); font-size: 20px; padding: 4px 8px; }

/* ── CARDS ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 14px;
}
.card-parchment { background: var(--parchment); }

/* ── FORM ELEMENTS ──────────────────────────────────────────────────────── */
.field { margin-bottom: 16px; }
.field-label { font-size: 11px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; display: block; }
input[type=text], input[type=email], input[type=password], input[type=tel], textarea, select {
  width: 100%;
  background: var(--parchment);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 15px;
  font-family: 'Jost', sans-serif;
  font-size: 15px;
  font-weight: 300;
  color: var(--charcoal);
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--sage); }
textarea { resize: none; min-height: 130px; line-height: 1.6; }

/* ── BUTTONS ────────────────────────────────────────────────────────────── */
.btn {
  display: block;
  width: 100%;
  padding: 15px;
  border-radius: 12px;
  font-family: 'Jost', sans-serif;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0.04em;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-align: center;
  -webkit-appearance: none;
}
.btn + .btn { margin-top: 10px; }
.btn-primary { background: var(--sage); color: white; }
.btn-primary:hover, .btn-primary:active { background: var(--sage-dark); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--muted); }
.btn-ghost:hover { border-color: var(--sage); color: var(--sage); }
.btn-danger { background: transparent; border: 1px solid #e57373; color: #c62828; }

/* ── BADGE ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--parchment);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 5px 14px 5px 5px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 22px;
}
.av {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 500; color: white;
}
.av-a { background: var(--sage); }
.av-b { background: var(--rose); }
.av-sm { width: 20px; height: 20px; font-size: 9px; }

/* ── ALERTS ─────────────────────────────────────────────────────────────── */
.alert { padding: 14px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; }
.alert-error   { background: #fce4e4; border: 1px solid #f5c6c6; color: #c62828; }
.alert-success { background: #e4f0e8; border: 1px solid #b2d8bc; color: #2e7d32; }

/* ── QUESTION BUBBLE ────────────────────────────────────────────────────── */
.q-bubble {
  background: var(--parchment);
  border-left: 3px solid var(--sage);
  border-radius: 0 12px 12px 0;
  padding: 14px 18px;
  margin-bottom: 14px;
  font-size: 15px;
  animation: fadeUp 0.3s ease both;
}

/* ── PROGRESS DOTS ──────────────────────────────────────────────────────── */
.progress-dots { display: flex; gap: 6px; margin-bottom: 22px; }
.pdot { width: 6px; height: 6px; border-radius: 50%; background: var(--border); transition: background 0.3s; }
.pdot.active { background: var(--sage); }
.pdot.done   { background: var(--sage-dark); }

/* ── MESSAGE PREVIEW ────────────────────────────────────────────────────── */
.msg-preview {
  background: var(--parchment);
  border-radius: 12px;
  padding: 16px 18px;
  font-size: 14px;
  line-height: 1.7;
  font-style: italic;
  margin-bottom: 16px;
  color: var(--charcoal);
}

/* ── RECEIVED MESSAGE ───────────────────────────────────────────────────── */
.msg-received {
  background: var(--parchment);
  border-radius: 4px 14px 14px 14px;
  padding: 16px 18px;
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 8px;
}
.from-label { font-size: 12px; color: var(--muted); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; justify-content: space-between; }

/* ── DIVIDER ────────────────────────────────────────────────────────────── */
.divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--muted); font-size: 12px; letter-spacing: 0.08em; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── OVERLAP CARD ───────────────────────────────────────────────────────── */
.overlap-card {
  background: linear-gradient(135deg, rgba(122,158,135,0.1), rgba(122,158,135,0.04));
  border: 1px solid rgba(122,158,135,0.3);
  border-radius: 14px;
  padding: 18px;
  margin-top: 16px;
}
.overlap-title { font-family: 'Cormorant Garant', serif; font-size: 18px; color: var(--sage); margin-bottom: 6px; }

/* ── LOADING ────────────────────────────────────────────────────────────── */
.loading-dots { display: flex; gap: 5px; align-items: center; padding: 10px 0; }
.ld { width: 7px; height: 7px; border-radius: 50%; background: var(--sage); animation: pulse 1.2s ease-in-out infinite; }
.ld:nth-child(2) { animation-delay: 0.2s; }
.ld:nth-child(3) { animation-delay: 0.4s; }
@keyframes pulse { 0%,80%,100% { transform:scale(0.7); opacity:0.4; } 40% { transform:scale(1); opacity:1; } }

/* ── ICON CIRCLE ────────────────────────────────────────────────────────── */
.icon-circle {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--sage), var(--sage-dark));
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  font-size: 24px;
}

/* ── SUMMARY PARTNER LABEL ──────────────────────────────────────────────── */
.snl { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }

/* ── NAV TABS ───────────────────────────────────────────────────────────── */
.nav-tabs { display: flex; background: var(--parchment); border: 1px solid var(--border); border-radius: 10px; padding: 4px; gap: 4px; margin-bottom: 24px; }
.nav-tab { flex: 1; padding: 9px; border-radius: 7px; border: none; background: transparent; font-family: 'Jost', sans-serif; font-size: 13px; cursor: pointer; color: var(--muted); transition: all 0.2s; }
.nav-tab.active { background: white; color: var(--charcoal); box-shadow: 0 1px 4px rgba(0,0,0,0.08); }

/* ── THREAD LIST ────────────────────────────────────────────────────────── */
.thread-item { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.thread-item:last-child { border-bottom: none; }
.thread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sage); flex-shrink: 0; }
.thread-dot.pending { background: var(--rose); }
.thread-meta { flex: 1; }
.thread-date { font-size: 12px; color: var(--muted); }
.thread-preview { font-size: 14px; color: var(--charcoal); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }

/* ── PROFILE COMM STYLE PICKER ──────────────────────────────────────────── */
.style-picker { display: flex; gap: 8px; }
.style-opt { flex: 1; }
.style-opt input { display: none; }
.style-opt label {
  display: block; text-align: center; padding: 12px 8px;
  border: 1px solid var(--border); border-radius: 10px;
  font-size: 13px; cursor: pointer; transition: all 0.2s;
  background: var(--parchment);
}
.style-opt input:checked + label { border-color: var(--sage); background: rgba(122,158,135,0.1); color: var(--sage); }

/* ── MENU / SETTINGS ────────────────────────────────────────────────────── */
.menu-item { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--border); }
.menu-item:last-child { border-bottom: none; }
.menu-label { font-size: 15px; }
.menu-value { font-size: 14px; color: var(--muted); }
.menu-arrow { color: var(--muted); }

/* ── UTILITY ────────────────────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-muted  { color: var(--muted); }
.text-sm     { font-size: 13px; }
.mt-sm  { margin-top: 12px; }
.mt-md  { margin-top: 24px; }
.mt-lg  { margin-top: 40px; }
.mb-sm  { margin-bottom: 12px; }
.mb-md  { margin-bottom: 24px; }
.spacer { height: 24px; }
.hidden { display: none !important; }

/* ── PWA INSTALL BANNER ─────────────────────────────────────────────────── */
.install-banner {
  position: fixed; bottom: 20px; left: 16px; right: 16px;
  max-width: 480px; margin: 0 auto;
  background: var(--charcoal); color: white;
  border-radius: 14px; padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  z-index: 200; box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
.install-banner .install-text { flex: 1; font-size: 14px; }
.install-banner .install-text strong { display: block; margin-bottom: 2px; }
.install-btn { background: var(--sage); color: white; border: none; border-radius: 8px; padding: 8px 14px; font-size: 13px; cursor: pointer; white-space: nowrap; font-family: 'Jost', sans-serif; }
.install-close { color: rgba(255,255,255,0.6); cursor: pointer; font-size: 18px; padding: 4px; }