:root {
  --page-bg: #d9dedb;
  --bg: #f4f6f5;
  --card: #ffffff;
  --ink: #16211c;
  --muted: #74807b;
  --primary: #14a973;
  --primary-2: #0ea5e9;
  --primary-ink: #ffffff;
  --border: #e6eae8;
  --danger: #d9534f;
  --radius: 16px;
  /* Tints are computed from whatever --primary/--card currently are, so
     they follow BOTH the gender palette and light/dark automatically —
     no combinatorial "male+dark", "female+light" variable blocks needed. */
  --primary-tint: color-mix(in srgb, var(--primary) 12%, var(--card));
  --primary-tint-border: color-mix(in srgb, var(--primary) 32%, var(--card));
}

/* Gender-driven visual identity — set as document.documentElement's
   data-gender attribute from the user's own choice (Account screen). No
   gender picked yet keeps the neutral teal default above. */
:root[data-gender="male"] { --primary: #2f6fed; --primary-2: #00c2d1; }
:root[data-gender="female"] { --primary: #e0427a; --primary-2: #8b5cf6; }

/* Dark mode: follows the OS by default; a manual choice (Account screen,
   stored in localStorage) can force it either way via data-theme. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page-bg: #05070a;
    --bg: #14181a;
    --card: #1d2225;
    --ink: #f2f4f3;
    --muted: #9aa39e;
    --border: #2c3236;
  }
}
:root[data-theme="dark"] {
  --page-bg: #05070a;
  --bg: #14181a;
  --card: #1d2225;
  --ink: #f2f4f3;
  --muted: #9aa39e;
  --border: #2c3236;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page-bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, Arial, sans-serif;
  display: flex;
  justify-content: center;
  padding: 24px 12px;
  color: var(--ink);
  transition: background-color .25s;
}

.phone {
  width: 390px;
  max-width: 100%;
  height: 780px;
  max-height: 95vh;
  background: var(--bg);
  border-radius: 40px;
  border: 10px solid #111;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0,0,0,0.35);
  transition: background-color .25s;
}

.statusbar {
  display: flex;
  justify-content: space-between;
  padding: 10px 22px 4px;
  font-size: 13px;
  font-weight: 600;
}

.screen {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0; /* without this, a flex child won't shrink below its content size, so overflow-y:auto below never actually kicks in — the whole .phone frame grows instead of this scrolling inside it */
  padding: 16px 20px 24px;
  overflow-y: auto;
}
.screen.active { display: flex; }

/* Screens with a bottom tab bar: the bar must stay put while only the
   content above it scrolls, so it needs to sit outside the scrolling
   box — .screen itself becomes the (unpadded) flex column, and
   .screen-body is the part that actually scrolls. */
.screen--with-nav { padding: 0; overflow: hidden; }
.screen-body {
  flex: 1; min-height: 0; overflow-y: auto; padding: 16px 20px 24px;
  display: flex; flex-direction: column;
}

#screen-login {
  /* Matches the brand mark's own fixed gradient (blue → purple → pink),
     not the per-gender --primary — the logo is a fixed identity, unlike
     the rest of the UI's accent color. */
  background: linear-gradient(165deg,
    color-mix(in srgb, #2f6fed 18%, var(--bg)) 0%,
    color-mix(in srgb, #8b5cf6 14%, var(--bg)) 45%,
    color-mix(in srgb, #e0427a 16%, var(--bg)) 100%);
  transition: background .25s;
}
/* Buttons/chips on this one screen pick up the brand gradient too, instead
   of the per-gender --primary used everywhere else in the app — the login
   screen is before any gender theme is even known. */
#screen-login .chip.active,
#screen-login .btn-primary {
  background: linear-gradient(135deg, #2f6fed, #8b5cf6, #e0427a);
  border-color: transparent;
}
#screen-login .input:focus { outline-color: #8b5cf6; }

/* ---------- login ---------- */
.brand { text-align: center; padding: 30px 0 10px; }
.brand-badge {
  width: 140px; height: 140px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
}
.brand h1 { font-size: 20px; margin: 0 0 6px; }
.muted { color: var(--muted); font-size: 14px; margin: 0; }
.muted.small { font-size: 12px; }

.field-row { display: flex; gap: 8px; margin: 18px 0 12px; }
.chip {
  flex: 1; padding: 10px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--card); font-size: 14px; cursor: pointer; font-weight: 600; color: var(--muted);
}
.chip.active { background: var(--primary); border-color: var(--primary); color: white; }

.input {
  width: 100%; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--border);
  font-size: 15px; margin-bottom: 10px; background: var(--card); color: var(--ink);
  direction: ltr; text-align: right;
}
.input:focus { outline: 2px solid var(--primary); }

.btn-primary {
  width: 100%; padding: 14px; border-radius: 14px; border: none;
  background: var(--primary); color: var(--primary-ink); font-size: 15px; font-weight: 700;
  cursor: pointer; margin-top: 4px;
}
.btn-primary:active { opacity: 0.85; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  width: 100%; padding: 12px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--card); color: var(--ink); font-size: 14px; font-weight: 600; cursor: pointer;
}

.hidden { display: none !important; }
.error { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 8px; }
.tab-hint {
  margin-top: auto; padding-top: 16px; font-size: 11px; color: var(--muted); text-align: center;
  line-height: 1.6;
}

/* ---------- session identity badge ---------- */
.session-badge {
  align-self: flex-start;
  background: var(--primary-tint); color: var(--primary); border: 1px solid var(--primary-tint-border);
  font-size: 11px; font-weight: 700; padding: 5px 10px; border-radius: 20px;
  margin-bottom: 10px;
}

/* ---------- app shell ---------- */
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 0 18px; gap: 10px;
}
.eyebrow { font-size: 12px; color: var(--muted); }
.title { font-size: 19px; font-weight: 700; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--card); font-size: 16px; cursor: pointer;
}
.header-left { display: flex; align-items: center; gap: 10px; }

.tab-content { flex: 1; display: flex; flex-direction: column; gap: 14px; padding-bottom: 12px; }

.bottom-nav {
  display: flex; flex: 0 0 auto; border-top: 1px solid var(--border); background: var(--bg);
  padding: 8px 10px calc(env(safe-area-inset-bottom, 10px));
}
.nav-btn {
  flex: 1; background: none; border: none; display: flex; flex-direction: column;
  align-items: center; gap: 3px; font-size: 11px; color: var(--muted); padding: 6px 0; cursor: pointer;
}
.nav-btn span { font-weight: 600; }
.nav-btn.active { color: var(--primary); }

/* ---------- cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px;
}
.card h3 { margin: 0 0 10px; font-size: 15px; }

.health-greeting { display: flex; justify-content: space-between; align-items: flex-end; padding: 4px 2px 6px; }
.health-greeting .title { font-size: 21px; font-weight: 800; margin-top: 2px; }

.health-list-header {
  display: flex; justify-content: space-between; align-items: center; padding: 0 2px 8px;
}
.health-list-label { font-size: 13px; font-weight: 700; color: var(--muted); }
.health-list-header .link-btn { font-size: 13px; }

.health-row-edit {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--border); margin-bottom: 8px;
}
.health-row-edit-icon {
  width: 32px; height: 32px; border-radius: 50%; flex: 0 0 auto; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.health-row-edit-label { flex: 1; font-size: 14px; font-weight: 600; }
.health-row-edit-actions { display: flex; gap: 4px; }
.health-row-edit-actions button {
  width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg);
  color: var(--muted); font-size: 12px; cursor: pointer;
}
.health-row-edit-actions button:disabled { opacity: 0.35; cursor: not-allowed; }
.health-row-edit-actions button.rm { color: var(--danger); }
.health-edit-add { margin-bottom: 14px; }
/* Wrap the "add" chips onto more lines — one unwrapped row got wider than
   the screen once there were 7+ addable readings and pushed the whole
   tab sideways. */
.health-edit-add .field-row { flex-wrap: wrap; margin: 0; }
.health-edit-add .chip { flex: 0 0 auto; padding: 8px 12px; font-size: 13px; white-space: nowrap; }

.health-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.health-row {
  display: flex; align-items: center; gap: 12px; border-radius: 20px; padding: 14px 16px;
  cursor: pointer; transition: transform .1s; color: #fff;
}
.health-row:active { transform: scale(0.98); }
.health-row-icon {
  width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,0.22);
  display: flex; align-items: center; justify-content: center; font-size: 18px; flex: 0 0 auto;
}
.health-row-text { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.health-row-label { font-size: 13px; font-weight: 600; opacity: 0.9; }
.health-row-value { font-size: 21px; font-weight: 800; }
.health-row-arrow { font-size: 20px; opacity: 0.7; }


.log-row { display: flex; gap: 8px; }
.log-row select, .log-row input {
  padding: 10px; border-radius: 10px; border: 1px solid var(--border); font-size: 13px;
  background: var(--card); color: var(--ink);
}
.log-row select { flex: 1.2; }
.log-row input { flex: 1; min-width: 0; direction: ltr; text-align: center; }
.log-row select { min-width: 0; }
.log-row button {
  border: none; background: var(--primary); color: white; border-radius: 10px; padding: 0 14px; font-weight: 700; cursor: pointer;
}

.activity-list { display: flex; flex-direction: column; gap: 8px; }
.activity-item {
  display: flex; justify-content: space-between; padding: 10px 12px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--border); font-size: 13px;
}
.activity-item .t { color: var(--muted); font-size: 11px; }

.trainer-card {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px;
}
.trainer-card .name { font-weight: 700; font-size: 14px; }
.trainer-card .spec { color: var(--muted); font-size: 12px; margin-top: 2px; }
.badge {
  font-size: 11px; padding: 5px 10px; border-radius: 20px; background: var(--primary-tint); color: var(--primary); font-weight: 700;
}
.btn-sm {
  border: none; background: var(--primary); color: white; padding: 8px 14px; border-radius: 10px;
  font-size: 12px; font-weight: 700; cursor: pointer;
}
.btn-sm.outline { background: none; color: var(--danger); border: 1px solid var(--danger); }

.toggle-row {
  display: flex; justify-content: space-between; align-items: center; padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-row .lbl { font-size: 14px; }
.toggle-row .lbl small { display: block; color: var(--muted); font-size: 11px; }

.switch { position: relative; width: 44px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; background: var(--border); border-radius: 999px; cursor: pointer; transition: 0.15s;
}
.switch .track::before {
  content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px;
  background: var(--card); border-radius: 50%; transition: 0.15s; box-shadow: 0 1px 2px rgba(0,0,0,0.25);
}
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::before { transform: translateX(18px); }

.progress-bar {
  height: 8px; border-radius: 999px; background: var(--border); overflow: hidden; margin-top: 6px;
}
.progress-fill { height: 100%; background: var(--primary); border-radius: 999px; }
.goal-item { padding: 10px 0; border-bottom: 1px solid var(--border); }
.goal-item:last-child { border-bottom: none; }
.goal-item .row { display: flex; justify-content: space-between; font-size: 13px; }
.goal-item .row .pct { font-weight: 700; color: var(--primary); }
.goal-item.locked .row .pct { color: var(--muted); }

.period-picker { display: flex; gap: 4px; margin: 10px 0; }
.period-picker button {
  flex: 1; padding: 7px 2px; border-radius: 10px; border: 1px solid var(--border); background: var(--card);
  font-size: 11px; cursor: pointer; color: var(--muted); font-weight: 600; white-space: nowrap;
}
.period-picker button.active { background: var(--primary); border-color: var(--primary); color: white; }

.metric-avg { padding: 6px 2px 4px; }
.metric-avg-lbl { font-size: 12px; color: var(--muted); }
.metric-avg-val { font-size: 30px; font-weight: 800; margin-top: 2px; }
.metric-avg-range { font-size: 12px; color: var(--muted); margin-top: 2px; }

.link-btn { border: none; background: none; color: var(--primary); font-size: 12px; font-weight: 700; cursor: pointer; padding: 4px 0; }

.leaderboard-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--border); font-size: 13px; margin-bottom: 6px;
}
.leaderboard-row.me { border-color: var(--primary); background: var(--primary-tint); }
.leaderboard-row .rank { font-weight: 800; width: 22px; text-align: center; color: var(--muted); }
.leaderboard-row .who { flex: 1; }
.leaderboard-row .score { font-weight: 800; color: var(--primary); }

.status-pill {
  display: inline-block; font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 20px;
  background: var(--primary-tint); color: var(--primary); margin-bottom: 10px;
}
.status-pill.ended { background: var(--border); color: var(--muted); }

.section-title { font-size: 15px; font-weight: 800; margin: 4px 2px 10px; }

.sharing-item {
  border: 1px solid var(--border); border-radius: 14px; overflow: hidden; margin-bottom: 8px; background: var(--card);
}
.sharing-item summary {
  list-style: none; cursor: pointer; padding: 12px 14px; display: flex; align-items: center;
  justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 700;
}
.sharing-item summary::-webkit-details-marker { display: none; }
.sharing-item .chev { color: var(--muted); font-size: 15px; transition: transform .15s; transform: rotate(90deg); }
.sharing-item[open] .chev { transform: rotate(270deg); }
.sharing-item .sharing-body { padding: 4px 14px 12px; border-top: 1px solid var(--border); }
.sharing-name { display: flex; align-items: center; gap: 8px; }
.sharing-count { font-size: 11px; font-weight: 700; color: var(--primary); background: var(--primary-tint); padding: 3px 9px; border-radius: 20px; }

.post-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; margin-bottom: 8px;
}
.post-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.post-trainer {
  font-weight: 700; font-size: 13px; border: none; background: none; padding: 0;
  cursor: pointer; color: var(--ink); font-family: inherit;
}
.post-trainer:active { text-decoration: underline; }
.post-content { font-size: 14px; line-height: 1.6; white-space: pre-wrap; margin-bottom: 8px; }
.post-like {
  border: none; background: none; color: var(--muted); font-size: 13px; font-weight: 700; cursor: pointer; padding: 2px 0;
}
.post-like.liked { color: #e0527a; }

.bio-counter { text-align: left; direction: ltr; font-size: 11px; color: var(--muted); margin-top: 4px; }
.bio-counter.low { color: var(--danger); font-weight: 700; }

/* ---------- date-of-birth wheel picker ---------- */
.dob-sheet-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,0.45); z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
}
.dob-sheet {
  width: 100%; background: var(--card); border-radius: 20px 20px 0 0; padding: 4px 0 max(16px, env(safe-area-inset-bottom));
  animation: dob-sheet-up .2s ease-out;
}
@keyframes dob-sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.dob-sheet-header {
  display: flex; align-items: center; justify-content: space-between; padding: 12px 16px;
  border-bottom: 1px solid var(--border); font-weight: 700; font-size: 14px;
}
.wheel-row { position: relative; display: flex; padding: 0 8px; }
.wheel-col {
  position: relative; z-index: 1; flex: 1; height: 200px; overflow-y: scroll; scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch; background: transparent;
}
.wheel-col::-webkit-scrollbar { display: none; }
.wheel-item {
  display: flex; align-items: center; justify-content: center; scroll-snap-align: center;
  font-size: 16px; color: var(--ink); cursor: pointer; font-weight: 600;
}
.wheel-center-highlight {
  position: absolute; top: 80px; left: 8px; right: 8px; height: 40px;
  background: var(--primary-tint); border: 1px solid var(--primary-tint-border); border-radius: 10px;
  pointer-events: none; z-index: 0;
}

.empty { text-align: center; color: var(--muted); font-size: 13px; padding: 30px 10px; }
.subs-none { text-align: center; color: var(--muted); font-size: 13px; padding: 10px; }

.sub-block { display: flex; flex-direction: column; gap: 6px; }
.sub-block .sub-title { font-weight: 700; font-size: 13px; margin: 6px 2px 0; }

/* Personal daily goals */
.goal-row-end { display: flex; align-items: center; gap: 8px; }
.goal-rm {
  border: none; background: none; color: var(--muted); font-size: 12px; cursor: pointer; padding: 2px 4px;
}
.goal-done { font-size: 11px; font-weight: 700; color: #16a34a; margin-inline-start: 4px; }
.goal-item.achieved .progress-fill { background: #16a34a; }
.sim-sync { display: block; margin: 4px auto 12px; color: var(--muted); }

/* In-app reminder banner (see notify() in app.js) */
.toast {
  position: absolute; top: 14px; left: 14px; right: 14px; z-index: 50;
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 12px 14px; box-shadow: 0 10px 30px rgba(0,0,0,0.18); cursor: pointer;
  animation: toast-in .25s ease-out;
}
.toast-title { font-weight: 800; font-size: 14px; color: var(--ink); }
.toast-body { font-size: 12px; color: var(--muted); margin-top: 3px; }
@keyframes toast-in { from { transform: translateY(-16px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Daily goal rings (top of the اليوم tab) */
.rings-header { display: flex; justify-content: space-between; align-items: center; }
.rings-body { display: flex; align-items: center; gap: 16px; margin-top: 8px; }
.chip:disabled { opacity: 0.45; cursor: not-allowed; }
.goal-edit-input {
  width: 90px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border);
  font-size: 13px; direction: ltr; text-align: center; background: var(--card); color: var(--ink);
}
.rings-svg { flex: 0 0 auto; }
.ring-legend { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.ring-legend-label { font-size: 12px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.ring-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.ring-legend-value { font-size: 18px; font-weight: 800; direction: ltr; text-align: right; }
.ring-legend-value span { font-size: 12px; font-weight: 600; color: var(--muted); }
.health-row-sub { font-size: 12px; font-weight: 600; opacity: 0.85; margin-top: 1px; }
.metric-switch { margin-bottom: 0; }

/* Achievements (النشاط tab) */
.streak-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.streak-chip {
  display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; border-radius: 12px;
  background: color-mix(in srgb, #f97316 12%, var(--card)); border: 1px solid color-mix(in srgb, #f97316 30%, var(--border));
}
.streak-count { font-weight: 800; font-size: 14px; color: #ea580c; }
.streak-label { font-size: 11px; color: var(--muted); font-weight: 600; }
.award-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px 6px; }
.award { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 3px; min-width: 0; }
.award-icon {
  width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 26px;
  background: linear-gradient(145deg, #fde68a, #f59e0b); box-shadow: 0 3px 10px rgba(245, 158, 11, 0.35);
}
.award.locked .award-icon { background: var(--border); box-shadow: none; filter: grayscale(1); opacity: 0.55; }
.award-title { font-size: 11px; font-weight: 700; color: var(--ink); line-height: 1.3; }
.award.locked .award-title { color: var(--muted); }
.award-sub { font-size: 10px; color: var(--muted); direction: ltr; }

/* ملاحظات لك (insights) */
.insight-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.insight {
  display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: start; cursor: pointer;
  padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--card);
  border-inline-start: 4px solid #94a3b8; font: inherit; color: inherit;
}
.insight--good { border-inline-start-color: #16a34a; }
.insight--attention { border-inline-start-color: #f59e0b; }
.insight-icon { font-size: 20px; line-height: 1.2; }
.insight-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.insight-title { font-size: 13px; font-weight: 700; color: var(--ink); }
.insight-body { font-size: 11.5px; color: var(--muted); line-height: 1.45; }

/* Normal-range status (blood pressure / glucose) */
.range-pill {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 4px; padding: 2px 9px 2px 8px;
  border-radius: 999px; background: #fff; font-size: 11px; font-weight: 800; align-self: flex-start; width: fit-content;
}
.range-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.range-row { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 10px; font-size: 12.5px; }
.range-row.current { background: color-mix(in srgb, var(--lvl) 14%, transparent); font-weight: 800; }
.range-label { color: var(--ink); min-width: 110px; }
.range-desc { color: var(--muted); font-size: 11.5px; }

/* "＋ إضافة قراءة" on manual-entry metrics' detail screen */
.manual-add-btn {
  width: 100%; padding: 11px; border-radius: 14px; border: 1.5px dashed var(--primary);
  background: none; color: var(--primary); font-weight: 800; font-size: 14px; cursor: pointer; margin-bottom: 14px;
}
.condition-row .lbl { display: flex; flex-direction: column; gap: 2px; padding-inline-end: 10px; }
.condition-row .muted.small { font-size: 11px; line-height: 1.4; }

/* One-line encouragement at the top of اليوم */
.motivation {
  padding: 12px 14px; border-radius: 14px; font-size: 13.5px; font-weight: 700; line-height: 1.5;
  color: var(--ink); background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 16%, var(--card)), color-mix(in srgb, #f59e0b 12%, var(--card)));
  border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--border));
}
.chip-hint { font-size: 10.5px; font-weight: 600; opacity: 0.7; margin-inline-start: 2px; }

/* Rings editor: each ring with its daily target (Apple Fitness goal stepper) */
.ring-edit-list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.ring-edit-item { border: 1px solid var(--border); border-radius: 14px; padding: 10px 12px; background: var(--card); }
.ring-edit-top { display: flex; align-items: center; gap: 10px; }
.ring-edit-top .health-row-edit-label { flex: 1; }
.ring-target { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
.ring-target-lbl { font-size: 12px; color: var(--muted); font-weight: 600; flex: 1; }
.ring-target-unit { font-size: 12px; color: var(--muted); font-weight: 600; min-width: 34px; }
.stepper { display: flex; align-items: center; gap: 6px; direction: ltr; }
.stepper button {
  width: 34px; height: 34px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--border); color: var(--ink); font-size: 20px; font-weight: 700; line-height: 1;
}
.stepper input {
  width: 76px; text-align: center; font-size: 18px; font-weight: 800; border: none; background: transparent;
  -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* أسبوعك — weekly summary */
.week-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin: 12px 0 6px; }
.week-day { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10px; color: var(--muted); font-weight: 600; padding: 4px 0; border-radius: 10px; }
.week-day.today { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); font-weight: 800; }
.week-day.closed span::after { content: ' ✓'; color: #16a34a; }
.week-closed { font-size: 13px; margin: 6px 2px 10px; color: var(--ink); }
.week-closed b { font-size: 16px; color: var(--primary); }
.week-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.week-stat { border: 1px solid var(--border); border-radius: 12px; padding: 9px 10px; display: flex; flex-direction: column; gap: 3px; }
.week-stat-label { font-size: 11px; color: var(--muted); font-weight: 600; }
.week-stat-value { font-size: 17px; font-weight: 800; color: var(--ink); }
.week-stat-value span { font-size: 11px; font-weight: 600; color: var(--muted); }
.week-change { align-self: flex-start; font-size: 10.5px; font-weight: 800; padding: 1px 7px; border-radius: 999px; }
.week-change.up { color: #16a34a; background: color-mix(in srgb, #16a34a 12%, transparent); }
.week-change.down { color: #ea580c; background: color-mix(in srgb, #ea580c 12%, transparent); }
.week-badges { margin-top: 10px; font-size: 12px; color: var(--muted); font-weight: 600; }
.week-badges span { font-size: 18px; }

/* Twitter-style segmented tabs (المجتمع: المنشورات / التحديات) */
.segmented { display: flex; background: var(--border); border-radius: 12px; padding: 3px; gap: 3px; }
.segmented button {
  flex: 1; border: none; background: none; padding: 9px 6px; border-radius: 10px; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 700; color: var(--muted);
}
.segmented button.active { background: var(--card); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,0.12); }
.segmented--small button { font-size: 12.5px; padding: 7px 4px; }

/* Diet-plan posts */
.diet-label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin: 8px 2px 4px; }
.diet-meal { min-height: 44px; resize: vertical; }
.diet-plan { border: 1px solid color-mix(in srgb, #16a34a 30%, var(--border)); border-radius: 12px; padding: 10px 12px; margin: 8px 0; background: color-mix(in srgb, #16a34a 6%, var(--card)); }
.diet-plan-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.diet-badge { font-size: 11px; font-weight: 800; color: #16a34a; background: color-mix(in srgb, #16a34a 14%, transparent); padding: 2px 8px; border-radius: 999px; }
.diet-title { font-weight: 800; font-size: 14px; color: var(--ink); }
.diet-meal-row { display: flex; gap: 10px; padding: 6px 0; border-top: 1px dashed var(--border); font-size: 13px; }
.diet-meal-name { flex: 0 0 72px; font-weight: 700; color: var(--ink); }
.diet-meal-text { color: var(--ink); white-space: pre-line; line-height: 1.5; }

/* Form controls don't inherit the page font by default — textareas fell
   back to a monospace face with spaced-out Arabic letters. */
input, textarea, select, button { font-family: inherit; }

/* Session badge fades out 5 s after login (flashSessionBadge) */
.session-badge { transition: opacity .4s; }
.session-badge.fading { opacity: 0; }
.session-badge.gone { display: none; }

/* 🔔 bell + unread count (top-left of the home header) */
.notif-bell { position: relative; }
.notif-count {
  position: absolute; top: -6px; left: -6px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: #dc2626; color: #fff; font-size: 10.5px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; border: 2px solid var(--bg);
}
.notif-count[hidden] { display: none; }

/* Notifications screen */
.notif-list { display: flex; flex-direction: column; gap: 8px; }
.notif-item {
  display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: start; cursor: pointer;
  padding: 12px; border-radius: 14px; border: 1px solid var(--border); background: var(--card); font: inherit; color: inherit;
}
.notif-item.unread { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); background: color-mix(in srgb, var(--primary) 7%, var(--card)); }
.notif-text { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.notif-title { font-weight: 800; font-size: 13.5px; color: var(--ink); }
.notif-body { font-size: 12px; color: var(--muted); line-height: 1.45; }
.notif-time { font-size: 10.5px; color: var(--muted); white-space: nowrap; }

/* Brief highlight on the card a notification jumped to */
.flash { animation: flash-ring 1.6s ease-out; }
@keyframes flash-ring { 0% { box-shadow: 0 0 0 3px var(--primary); } 100% { box-shadow: 0 0 0 3px transparent; } }

/* @username field (account screen) */
.username-row { display: flex; align-items: center; gap: 8px; direction: ltr; }
.username-at { font-size: 18px; font-weight: 800; color: var(--muted); }
.username-row .input { flex: 1; margin: 0; text-align: left; font-weight: 700; }
.username-row .input:disabled { opacity: .6; }
.username-row .btn-sm:disabled { opacity: .5; cursor: not-allowed; }

/* "من مدربك" — coach tasks on اليوم */
.coach-task-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.coach-invite {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px;
  padding: 10px 12px; border-radius: 12px; border: 1px dashed var(--primary); color: var(--ink);
}
.coach-task { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); }
.coach-task.done { opacity: 0.6; }
.coach-task.done .coach-task-title { text-decoration: line-through; }
.coach-task-icon { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 17px; flex: 0 0 auto; }
.coach-task-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.coach-task-title { font-weight: 800; font-size: 13.5px; color: var(--ink); }
.coach-task-sub { font-size: 11px; color: var(--muted); }
.coach-task .progress-bar { margin-top: 5px; height: 6px; }
.task-progress-num { font-weight: 800; font-size: 15px; direction: ltr; white-space: nowrap; }
.task-progress-num span { font-size: 11px; color: var(--muted); font-weight: 600; }
.task-check {
  width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--border); background: none; cursor: pointer;
  color: transparent; font-size: 17px; font-weight: 900; display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.task-check.done { background: #16a34a; border-color: #16a34a; color: #fff; }
.task-check:not(.done):hover { color: var(--muted); }

/* Trainer: مهام المتابعين */
.trainer-task-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.trainer-task { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); }
.trainer-task-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.trainer-task-stat { font-size: 11.5px; font-weight: 700; color: var(--primary); }
.auto-tasks-row { border-bottom: 1px dashed var(--border); margin-bottom: 4px; }

/* ---- المدرب الذكي ---- */
.smart-coach { cursor: pointer; border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.program-hero { text-align: center; }
.setup-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.setup-field { min-width: 0; }
.setup-field label { display: block; font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.setup-field.missing label { color: #ea580c; }
.setup-field.missing label::after { content: ' — مطلوب'; }
.setup-input { display: flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 12px; padding: 0 10px; background: var(--card); }
.setup-field.missing .setup-input { border-color: #ea580c; }
.setup-input input { flex: 1; min-width: 0; border: none; background: none; padding: 10px 0; font: inherit; font-size: 16px; font-weight: 800; color: var(--ink); direction: ltr; text-align: right; }
.setup-input span { font-size: 12px; color: var(--muted); }
.choice-row { flex-wrap: wrap; margin: 6px 0 0; }
.choice-row .chip { flex: 1 1 auto; }
.disclaimer { font-size: 12px; line-height: 1.6; color: var(--muted); background: color-mix(in srgb, #f59e0b 8%, var(--card)); border-color: color-mix(in srgb, #f59e0b 30%, var(--border)); }

.pw-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 12px; }
.pw-day { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0; border-radius: 10px; font-size: 10.5px; color: var(--muted); font-weight: 700; }
.pw-day.today { background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); }
.pw-dot { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; background: var(--border); color: var(--ink); }
.pw-day.rest .pw-dot { background: none; color: var(--muted); }
.pw-day.done .pw-dot { background: #16a34a; color: #fff; }
.pw-day.faded { opacity: .35; }

.exercise-list { display: flex; flex-direction: column; gap: 10px; }
.exercise { display: flex; gap: 10px; align-items: flex-start; }
.exercise-num { width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 12px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; margin-top: 2px; }
.exercise-name { font-weight: 800; font-size: 13.5px; color: var(--ink); }
.exercise-detail { font-size: 12.5px; font-weight: 700; color: var(--primary); margin-top: 1px; }
.exercise-how { font-size: 11.5px; color: var(--muted); margin-top: 2px; line-height: 1.5; }
.btn-outline-done { width: 100%; padding: 12px; border-radius: 14px; border: 1.5px solid #16a34a; background: none; color: #16a34a; font-weight: 800; font-size: 14px; cursor: pointer; }

.macro-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.macro { border: 1px solid var(--border); border-radius: 12px; padding: 8px 4px; text-align: center; display: flex; flex-direction: column; gap: 2px; }
.macro b { font-size: 15px; color: var(--ink); }
.macro span { font-size: 10.5px; color: var(--muted); font-weight: 600; }
.macro.kcal { grid-column: 1 / -1; background: color-mix(in srgb, var(--primary) 10%, var(--card)); }
.macro.kcal b { font-size: 22px; color: var(--primary); }
.tips { margin: 0; padding-inline-start: 18px; font-size: 12.5px; line-height: 1.8; color: var(--ink); }

/* ☰ community drawer (slides in from the right — the start side in RTL) */
.community-head { display: flex; align-items: center; justify-content: space-between; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45); z-index: 60; }
.drawer {
  position: absolute; top: 0; bottom: 0; right: 0; width: 84%; z-index: 61; overflow-y: auto;
  background: var(--bg); border-left: 1px solid var(--border); padding: 18px 16px 24px;
  display: flex; flex-direction: column; gap: 14px;
  transform: translateX(100%); transition: transform .22s ease-out;
}
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; font-size: 16px; }
.drawer-section { display: flex; flex-direction: column; gap: 8px; }
.drawer-title { font-weight: 800; font-size: 13px; color: var(--muted); }
.drawer-link {
  display: flex; justify-content: space-between; align-items: center; width: 100%; text-align: start; cursor: pointer;
  padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--card); font: inherit; font-weight: 700; color: var(--ink);
}
.drawer-join summary {
  cursor: pointer; list-style: none; padding: 12px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--card); font-weight: 700; color: var(--ink);
}
.drawer-join summary::-webkit-details-marker { display: none; }
.drawer-join summary::after { content: '▾'; float: left; color: var(--muted); }
.drawer-join[open] summary::after { content: '▴'; }
.drawer-join-body { padding: 4px 2px 0; }
.trainer-row-name { background: none; border: none; padding: 0; text-align: start; cursor: pointer; font: inherit; color: inherit; flex: 1; min-width: 0; }
.drawer .trainer-card { margin: 0; }

/* Posts: @handle + save */
.post-username { font-size: 11px; font-weight: 600; color: var(--muted); }
.post-actions { display: flex; gap: 8px; align-items: center; }
.post-save { border: 1px solid var(--border); background: none; border-radius: 999px; padding: 4px 10px; font-size: 12px; cursor: pointer; color: var(--muted); font: inherit; font-size: 12px; }
.post-save.saved { color: var(--primary); border-color: var(--primary); font-weight: 700; }

/* Account screen: معلومات الحساب / التفاصيل الصحية */
.field-label { display: block; font-size: 12px; color: var(--muted); font-weight: 600; margin: 2px 2px 4px; }
.contact-rows { display: flex; flex-direction: column; gap: 6px; }
.contact-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--border) 40%, transparent); font-size: 13px; }
.contact-row span { color: var(--muted); font-weight: 600; }
.contact-row b { color: var(--ink); font-size: 13px; }
.username-block { margin-bottom: 10px; }
.cycle-sub { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--border); }
.exercise-caution { font-size: 11.5px; font-weight: 700; color: #ea580c; margin-top: 3px; }

/* Account: Apple Health–style settings menu */
.account-page { display: flex; flex-direction: column; gap: 12px; }
.account-page[hidden] { display: none; }
.settings-group { background: var(--card); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.settings-row {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; border: none; background: none;
  font: inherit; color: var(--ink); cursor: pointer; text-align: start;
}
.settings-row + .settings-row { border-top: 1px solid var(--border); }
.settings-icon { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 16px; background: color-mix(in srgb, var(--primary) 12%, transparent); flex: 0 0 auto; }
.settings-label { flex: 1; font-size: 15px; font-weight: 600; }
.settings-hint { font-size: 12.5px; color: var(--muted); }
.settings-chev { color: var(--muted); font-size: 18px; }
.settings-heading { font-size: 20px; font-weight: 800; margin: 12px 4px 0; color: var(--ink); }
.settings-note { font-size: 12px; color: var(--muted); margin: -4px 6px 0; line-height: 1.6; }
.settings-action { width: 100%; padding: 15px 16px; border: none; background: none; font: inherit; font-size: 15px; font-weight: 700; color: var(--primary); cursor: pointer; text-align: start; }
.settings-action.plain { background: var(--card); border: 1px solid var(--border); border-radius: 16px; }
.settings-action:disabled { opacity: .6; }
.device-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.device-row:last-of-type { border-bottom: none; }
.device-text { flex: 1; }
.device-name { font-weight: 700; font-size: 14px; color: var(--ink); }
.device-status { font-size: 11px; font-weight: 800; color: var(--muted); background: var(--border); padding: 3px 9px; border-radius: 999px; }

/* ---- Posts: avatar layout, filter, collapsed composer ---- */
.post-card { display: flex; gap: 10px; align-items: flex-start; }
.post-avatar { border: none; background: none; padding: 0; cursor: pointer; flex: 0 0 auto; }
.post-main { flex: 1; min-width: 0; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 16px; flex: 0 0 auto; }
img.avatar { object-fit: cover; background: var(--border); }
.post-header .t { font-size: 11px; color: var(--muted); white-space: nowrap; }
.feed-filter { display: flex; gap: 6px; }
.feed-filter button { border: 1px solid var(--border); background: var(--card); color: var(--muted); border-radius: 999px; padding: 6px 14px; font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.feed-filter button.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.composer-collapsed { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--border); background: var(--card); cursor: pointer; font: inherit; color: var(--muted); text-align: start; }
.composer-collapsed span:nth-child(2) { flex: 1; font-size: 14px; }
.composer-plus { font-size: 18px; }

/* ---- Challenges ---- */
.section-title { margin: 6px 2px -4px; font-size: 15px; }
.challenge-list { display: flex; flex-direction: column; gap: 8px; }
.challenge-card { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 14px; border: 1px solid var(--border); background: var(--card); cursor: pointer; }
.challenge-icon { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 19px; flex: 0 0 auto; }
.challenge-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.challenge-name { font-weight: 800; font-size: 14px; color: var(--ink); }
.challenge-meta { font-size: 11.5px; color: var(--muted); }
.challenge-progress { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.challenge-rank { font-weight: 900; color: var(--primary); font-size: 14px; }
.challenge-card .progress-bar { height: 6px; margin-top: 4px; }
.friend-challenge-cta { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 14px; border-radius: 14px; border: 1.5px dashed var(--primary); background: color-mix(in srgb, var(--primary) 8%, var(--card)); color: var(--primary); font: inherit; font-weight: 800; font-size: 15px; cursor: pointer; }
.invite-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); }
.invite-row:first-of-type { border-top: none; }
.invite-actions { display: flex; gap: 6px; }
.leaderboard-row .score small { color: var(--muted); font-weight: 600; }

/* Challenge duration: all five options on one line */
.duration-row { flex-wrap: nowrap; gap: 6px; margin: 0; }
.duration-row .chip { flex: 1 1 0; min-width: 0; padding: 9px 0; font-size: 12px; letter-spacing: -0.2px; white-space: nowrap; }

/* ── Twitter-style post composer ── */
.composer-top { display: flex; gap: 10px; align-items: flex-start; }
.composer-text { flex: 1; min-width: 0; border: none; background: none; resize: none; font: inherit; font-size: 1.05rem; color: var(--ink); padding: 6px 0; min-height: 70px; outline: none; }
.composer-diet { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 10px; }
.diet-badge { font-weight: 600; font-size: .9rem; }
.share-picker { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; border-top: 1px solid var(--border); margin-top: 8px; padding-top: 8px; }
.composer-bar { display: flex; align-items: center; gap: 4px; border-top: 1px solid var(--border); margin-top: 8px; padding-top: 8px; }
.composer-tool { background: none; border: none; font-size: 1.25rem; width: 38px; height: 38px; border-radius: 50%; cursor: pointer; }
.composer-tool.on { background: var(--primary-tint); }
.composer-count { margin-inline-start: auto; font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.composer-count.near { color: var(--danger); }
.composer-bar .link-btn { padding: 0 8px; }
.composer-bar .btn-sm:disabled { opacity: .45; cursor: not-allowed; }
.share-picker[hidden], .composer-diet[hidden] { display: none; }
.share-picker .chip { padding: 5px 10px; font-size: .82rem; }
.composer .error:empty { display: none; }

/* ── Messages ── */
.header-actions { display: flex; gap: 8px; }
.profile-actions { display: flex; gap: 6px; align-items: center; }
.btn-sm.outline-primary { background: none; color: var(--primary); border: 1px solid var(--primary); }
.conv-list { display: flex; flex-direction: column; gap: 6px; }
.conv-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: start; padding: 10px; border-radius: 14px; border: 1px solid var(--border); background: var(--card); font: inherit; color: inherit; cursor: pointer; }
.conv-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.conv-top { display: flex; justify-content: space-between; gap: 8px; }
.conv-time { font-size: 11px; color: var(--muted); flex-shrink: 0; }
.conv-preview { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-row.unread .conv-preview { color: var(--ink); font-weight: 600; }
.conv-unread { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--primary); color: var(--primary-ink); font-size: 11px; font-weight: 800; }

.screen--chat { padding-bottom: 12px; overflow: hidden; position: relative; }
.chat-header { padding-bottom: 10px; border-bottom: 1px solid var(--border); position: relative; }
.chat-who { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.chat-who .title { font-size: 16px; }
.chat-menu-panel { position: absolute; top: 76px; left: 20px; z-index: 5; background: var(--card); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.12); overflow: hidden; display: flex; flex-direction: column; }
.chat-menu-panel[hidden] { display: none; }
.chat-menu-panel button { background: none; border: none; padding: 12px 16px; text-align: start; font: inherit; color: var(--ink); cursor: pointer; }
.chat-menu-panel button + button { border-top: 1px solid var(--border); }
.chat-menu-panel button.danger { color: var(--danger); }
.chat-thread { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 12px 0; }
.chat-empty { margin: auto; }
.chat-day { align-self: center; font-size: 11px; color: var(--muted); background: var(--card); border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; margin: 6px 0; }
.bubble { max-width: 78%; padding: 8px 12px; border-radius: 18px; }
.bubble.mine { align-self: flex-end; background: var(--primary); color: var(--primary-ink); border-bottom-left-radius: 6px; }
.bubble.theirs { align-self: flex-start; background: var(--card); border: 1px solid var(--border); border-bottom-right-radius: 6px; }
.bubble-text { white-space: pre-wrap; word-wrap: break-word; line-height: 1.45; }
.bubble-meta { font-size: 10.5px; opacity: .75; margin-top: 3px; }
.chat-compose { display: flex; align-items: flex-end; gap: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.chat-compose[hidden] { display: none; }
.chat-compose textarea { flex: 1; resize: none; font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 9px 14px; max-height: 120px; outline: none; }
.chat-send { width: 38px; height: 38px; border-radius: 50%; border: none; background: var(--primary); color: var(--primary-ink); font-size: 18px; font-weight: 800; cursor: pointer; flex-shrink: 0; }
.chat-send:disabled { opacity: .4; cursor: default; }
.chat-note { text-align: center; padding-top: 8px; border-top: 1px solid var(--border); }
.chat-note[hidden] { display: none; }

/* ── Paid subscription (💎) ── */
.plan-card { border: 1px solid var(--primary-tint-border); background: var(--primary-tint); }
.plan-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.plan-price { font-weight: 800; color: var(--primary); white-space: nowrap; }
.plan-price small { font-weight: 600; font-size: 12px; }
.plan-perks { margin: 10px 0 12px; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.plan-confirm { border-top: 1px solid var(--primary-tint-border); padding-top: 10px; }
.plan-confirm p { margin: 0 0 6px; }
.plan-buttons { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.plan-buttons .btn-primary { flex: 1; }
.plan-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 4px 0 8px; }
.plan-stats > div { background: var(--bg); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.plan-stats b { font-size: 18px; }
.plan-stats span { font-size: 12px; color: var(--muted); }
.plan-subs { display: flex; flex-direction: column; }
.plan-sub { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.excl-badge { font-size: 12px; }
.excl-note { margin: 6px 0 0; font-size: 12.5px; color: var(--primary); font-weight: 600; }
.excl-note[hidden] { display: none; }
.locked-post { display: flex; align-items: center; gap: 12px; width: 100%; margin: 6px 0; padding: 14px; border-radius: 14px; border: 1px dashed var(--primary-tint-border); background: var(--primary-tint); font: inherit; color: inherit; text-align: start; cursor: pointer; }
.locked-post > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.locked-icon { font-size: 22px; }
.paid-row { display: flex; align-items: center; gap: 8px; padding: 10px 12px; }
.paid-row + .paid-row { border-top: 1px solid var(--border); }
.paid-row-main { flex: 1; display: flex; align-items: center; gap: 10px; background: none; border: none; font: inherit; color: inherit; text-align: start; cursor: pointer; padding: 0; }
.paid-row-main > span { display: flex; flex-direction: column; gap: 2px; }
.danger-text { color: var(--danger) !important; }
.profile-actions { flex-wrap: wrap; justify-content: flex-end; }
#plan-save-error:empty, #plan-error:empty { display: none; }

/* الصحة ← متابعات إضافية (collapsible) */
.conditions-card summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; }
.conditions-card summary::-webkit-details-marker { display: none; }
.conditions-title { font-weight: 700; font-size: 16px; flex: 1; }
.conditions-on { font-size: 13px; color: var(--muted); }
.conditions-chev { color: var(--muted); font-size: 18px; transition: transform .15s; }
.conditions-card[open] .conditions-chev { transform: rotate(-90deg); }

/* ── On a real phone (or opened from the home screen): drop the desktop
   phone mock-up — full screen, no fake status bar, respect the notch and
   home indicator. 16px inputs stop iOS Safari zooming in on focus. ── */
@media (max-width: 500px), (display-mode: standalone) {
  body { padding: 0; background: var(--bg); }
  .phone {
    width: 100%; max-width: none; height: 100vh; height: 100dvh; max-height: none;
    border: none; border-radius: 0; box-shadow: none;
    padding-top: env(safe-area-inset-top);
  }
  .statusbar { display: none; }
  input, textarea, select, .input { font-size: 16px; }
}

/* ── Store (🛍️) ── */
.segmented [data-seg] { white-space: nowrap; }
.library-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 14px; border-radius: 16px; border: 1px solid var(--border); background: var(--card); font: inherit; color: inherit; cursor: pointer; text-align: start; }
.library-row > span:first-child { font-weight: 700; flex: 1; }
.store-heading { margin: 6px 0 0; font-size: 16px; }
.product-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.product-card { display: flex; flex-direction: column; align-items: stretch; gap: 4px; padding: 10px; border-radius: 16px; border: 1px solid var(--border); background: var(--card); font: inherit; color: inherit; text-align: start; cursor: pointer; min-width: 0; }
.product-cover { display: flex; align-items: center; justify-content: center; height: 78px; border-radius: 12px; font-size: 38px; background: linear-gradient(145deg, var(--primary-tint), color-mix(in srgb, var(--primary-2) 14%, var(--card))); }
.product-cover.big { width: 84px; height: 84px; font-size: 44px; flex-shrink: 0; }
.product-cover.small { width: 44px; height: 44px; font-size: 22px; border-radius: 10px; flex-shrink: 0; }
.product-kind { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.product-title { font-weight: 700; font-size: 14px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-by { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.product-price { font-weight: 800; color: var(--primary); font-size: 14px; margin-top: auto; padding-top: 4px; }
.product-price.owned { font-size: 12.5px; }
.product-hero { display: flex; gap: 14px; align-items: center; }
.product-hero-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; align-items: flex-start; }
.product-hero h2 { margin: 0; font-size: 18px; line-height: 1.35; }
.product-hero .link-btn { padding: 0; }
.product-desc { margin: 0; line-height: 1.6; }
.section-list { display: flex; flex-direction: column; }
.section-item { border-bottom: 1px solid var(--border); padding: 10px 0; }
.section-item:last-child { border-bottom: none; }
.section-item summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.section-item summary::-webkit-details-marker { display: none; }
.section-item.locked { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.section-num { width: 28px; height: 28px; border-radius: 50%; background: var(--bg); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; }
.section-item.done .section-num { background: var(--primary); color: var(--primary-ink); }
.section-title { flex: 1; font-weight: 600; }
.section-item[open] .settings-chev { transform: rotate(-90deg); }
.section-body { white-space: pre-wrap; line-height: 1.7; margin: 10px 0; padding: 12px; border-radius: 12px; background: var(--bg); font-size: 14px; }
.my-products { display: flex; flex-direction: column; }
.my-product { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.my-product.is-hidden { opacity: .55; }
.my-product-main { flex: 1; display: flex; align-items: center; gap: 10px; background: none; border: none; font: inherit; color: inherit; text-align: start; cursor: pointer; padding: 0; min-width: 0; }
.my-product-main > span:last-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.product-form { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.product-form .input { margin-bottom: 0; direction: rtl; }
.product-form textarea.input { resize: vertical; font: inherit; }
.emoji-row { flex-wrap: wrap; gap: 6px; }
.emoji-row .chip { font-size: 18px; padding: 4px 8px; }
.pf-section { display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 14px; background: var(--bg); }
.pf-section-head { display: flex; align-items: center; gap: 8px; }
.pf-section-head .input { flex: 1; }
#pf-error:empty, #buy-error:empty { display: none; }
.plan-head + .plan-confirm { margin-top: 10px; }
.emoji-row .chip { flex: 0 0 auto; }

/* ── Language (i18n.js) ── */
#screen-login { position: relative; }

/* Left-to-right (English): mirror what was laid out for right-to-left. */
html[dir="ltr"] .settings-chev, html[dir="ltr"] .conditions-chev, html[dir="ltr"] .health-row-arrow { display: inline-block; transform: scaleX(-1); }
html[dir="ltr"] .section-item[open] .settings-chev, html[dir="ltr"] .conditions-card[open] .conditions-chev { transform: rotate(-90deg); }
html[dir="ltr"] .input, html[dir="ltr"] .ring-legend-value, html[dir="ltr"] .setup-input input { text-align: left; }
html[dir="ltr"] .product-form .input { direction: ltr; }
html[dir="ltr"] .bio-counter { text-align: start; }
html[dir="ltr"] .chat-menu-panel { left: auto; right: 20px; }
html[dir="ltr"] .bubble.mine { border-bottom-left-radius: 18px; border-bottom-right-radius: 6px; }
html[dir="ltr"] .bubble.theirs { border-bottom-right-radius: 18px; border-bottom-left-radius: 6px; }
html[dir="ltr"] .notif-count { left: auto; right: -6px; }
html[dir="ltr"] .drawer { right: auto; left: 0; transform: translateX(-100%); }
html[dir="ltr"] .drawer.open { transform: none; }
/* What people write keeps its own direction in either interface language
   (an Arabic post in the English app, an English name in the Arabic one). */
.post-content, .bubble-text, .section-body, .diet-meal-text, .conv-preview, .product-desc,
.product-form .input, .composer-text, .chat-compose textarea { unicode-bidi: plaintext; }

/* ---------- trainer home: square tiles ---------- */
.tile-toolbar { display: flex; justify-content: space-between; align-items: center; padding: 0 2px 8px; min-height: 28px; }
.tile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  aspect-ratio: 1 / 1; padding: 14px; display: flex; flex-direction: column; justify-content: space-between;
  cursor: pointer; position: relative; overflow: hidden; min-width: 0;
}
.tile:active { transform: scale(.98); }
.tile.is-off { opacity: .45; }
.tile-head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; }
.tile-icon { font-size: 22px; }
.tile-body { display: flex; flex-direction: column; gap: 2px; }
.tile-big { font-size: 34px; font-weight: 800; line-height: 1.1; }
.tile-big.is-alert { color: var(--primary); }
.tile-label { font-size: 13px; color: var(--muted); }
.tile-sub { font-size: 12px; color: var(--muted); }
.tile-edit { position: absolute; inset-inline: 8px; bottom: 8px; display: flex; gap: 6px; }
.tile-edit button { flex: 1; border: 1px solid var(--border); background: var(--bg); color: var(--ink); border-radius: 10px; padding: 6px 0; font-size: 12px; }
.tile-edit button:disabled { opacity: .35; }
.tile-back { padding: 0 2px 8px; font-size: 14px; }

/* login: language picker (shown first, so a new user picks before signing in) */
.lang-picker { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); display: flex; background: var(--card); border: 1px solid var(--border); border-radius: 999px; padding: 3px; z-index: 2; }
.lang-picker button { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 14px; font-weight: 700; padding: 7px 18px; border-radius: 999px; cursor: pointer; }
.lang-picker button.active { background: linear-gradient(135deg, #2f6fed, #8b5cf6 55%, #e0427a); color: #fff; }

/* post photos */
.post-images { display: grid; gap: 4px; border-radius: 14px; overflow: hidden; margin-bottom: 8px; }
.post-images img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; background: var(--bg); }
.post-images.n1 { grid-template-columns: 1fr; } .post-images.n1 img { height: auto; max-height: 460px; object-fit: contain; }
.post-images.n2, .post-images.n3, .post-images.n4 { grid-template-columns: 1fr 1fr; }
.post-images.n2 img, .post-images.n4 img { aspect-ratio: 1 / 1; }
.post-images.n3 img { aspect-ratio: 1 / 1; } .post-images.n3 img:first-child { grid-row: span 2; aspect-ratio: auto; }
.composer-images { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 8px 0; }
.composer-img { position: relative; aspect-ratio: 1 / 1; border-radius: 10px; overflow: hidden; }
.composer-img img { width: 100%; height: 100%; object-fit: cover; }
.composer-img button { position: absolute; top: 4px; inset-inline-end: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; cursor: pointer; }
.image-viewer { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.image-viewer { touch-action: pan-y; user-select: none; }
.image-viewer img { max-width: 100%; max-height: 100%; object-fit: contain; -webkit-user-drag: none; }
.iv-close, .iv-nav { position: absolute; border: 0; background: rgba(255,255,255,.08); color: rgba(255,255,255,.6); border-radius: 50%; cursor: pointer; }
.iv-close { top: 14px; inset-inline-end: 14px; width: 38px; height: 38px; font-size: 18px; }
.iv-nav { top: 50%; transform: translateY(-50%); width: 44px; height: 44px; font-size: 28px; line-height: 1; }
.iv-prev { left: 10px; } .iv-next { right: 10px; }
.iv-count { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); color: #fff; font-size: 13px; background: rgba(0,0,0,.5); padding: 3px 10px; border-radius: 999px; }

/* smart coach: food preferences */
.food-prefs summary { display: flex; flex-direction: column; gap: 2px; cursor: pointer; list-style: none; }
.food-prefs summary::-webkit-details-marker { display: none; }
.food-prefs[open] summary { margin-bottom: 10px; }

/* ---- المدرب الذكي: big hero tile ----
   Background photo: save it as public/images/smart-coach-bg.jpg (it sits
   under a dark overlay so the text stays readable). Missing file = gradient only. */
.smart-hero {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 14px;
  min-height: 230px; margin-top: 10px; padding: 16px; border-radius: 20px; color: #fff; cursor: pointer; overflow: hidden;
  background:
    linear-gradient(180deg, rgba(8,12,24,.25) 0%, rgba(8,12,24,.72) 100%),
    url('/images/smart-coach-bg.jpg') center / cover no-repeat,
    linear-gradient(135deg, #2f6fed, #8b5cf6 55%, #e0427a);
}
.smart-hero.done { filter: saturate(.7); }
.smart-hero-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.smart-hero-badge { background: rgba(255,255,255,.18); backdrop-filter: blur(6px); padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.smart-hero-main { display: flex; flex-direction: column; gap: 6px; }
.smart-hero-label { font-size: 12px; opacity: .85; font-weight: 600; }
.smart-hero-title { font-size: 24px; font-weight: 800; line-height: 1.25; }
.smart-hero-sub { font-size: 12.5px; opacity: .9; }
.smart-hero-progress { height: 6px; border-radius: 999px; background: rgba(255,255,255,.28); overflow: hidden; margin-top: 4px; }
.smart-hero-progress > div { height: 100%; background: #fff; border-radius: 999px; }
.smart-hero-cta { align-self: stretch; text-align: center; border: 0; border-radius: 14px; padding: 12px 16px; font: inherit; font-size: 15px; font-weight: 800; background: #fff; color: #16211c; cursor: pointer; }
.smart-hero-cta.is-done { background: rgba(255,255,255,.22); color: #fff; }
.smart-hero-rest { align-self: stretch; text-align: center; padding: 12px; border-radius: 14px; background: rgba(255,255,255,.18); font-weight: 700; }

/* ---- smart coach: performance tab ---- */
.segmented--three button { font-size: 13px; padding-inline: 4px; }
.perf-flash { background: color-mix(in srgb, var(--primary) 12%, var(--card)); border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); font-weight: 700; font-size: 13.5px; display: flex; flex-direction: column; gap: 4px; }
.perf-score { display: flex; align-items: center; gap: 16px; }
.score-ring { --pct: 0; --col: var(--primary); flex: 0 0 auto; width: 96px; height: 96px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: conic-gradient(var(--col) calc(var(--pct) * 1%), var(--border) 0); }
.score-inner { width: 76px; height: 76px; border-radius: 50%; background: var(--card); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.score-inner b { font-size: 26px; font-weight: 800; }
.score-inner span { font-size: 10px; color: var(--muted); }
.score-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.score-level { font-size: 18px; font-weight: 800; }
.score-stats { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 12px; font-weight: 700; margin-top: 2px; }
.wk-chart { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; align-items: end; }
.wk { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 10px; color: var(--muted); }
.wk-bar { width: 100%; height: 70px; background: var(--bg); border-radius: 8px; display: flex; align-items: flex-end; overflow: hidden; }
.wk-fill { width: 100%; background: color-mix(in srgb, var(--primary) 55%, var(--card)); border-radius: 8px 8px 0 0; }
.wk-fill.full { background: var(--primary); }
.wk.now span { color: var(--ink); font-weight: 800; }
.improve-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.improve-row:last-of-type { border-bottom: 0; }
.improve-ic { font-size: 20px; width: 28px; text-align: center; }
.improve-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.improve-text b { font-size: 13.5px; }
.spark { flex: 0 0 auto; }
.delta-chip { flex: 0 0 auto; font-size: 12px; font-weight: 800; padding: 4px 9px; border-radius: 999px; background: var(--bg); color: var(--muted); }
.delta-chip.good { background: color-mix(in srgb, #14a973 16%, var(--card)); color: #0e8f61; }
.delta-chip.bad { background: color-mix(in srgb, #d9534f 14%, var(--card)); color: #c0392b; }
/* exercise logging */
.ex-log { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); }
.ex-suggest { font-size: 12px; font-weight: 700; color: var(--primary); margin: 2px 0; }
.ex-log-row { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.ex-log-row .input { width: 0; flex: 1; min-width: 0; padding: 8px; text-align: center; }

/* smart coach: locked preview before subscribing */
.sample-tag { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--bg); color: var(--muted); }
.locked-row { display: flex; align-items: center; gap: 10px; padding: 11px 12px; margin-top: 8px; border: 1px dashed var(--border); border-radius: 12px; background: var(--bg); font-size: 13px; color: var(--muted); }
.blur { filter: blur(4px); user-select: none; }
.locked-row .blur { filter: blur(2.5px); }

/* equipment */
.equip-card summary { display: flex; flex-direction: column; gap: 2px; cursor: pointer; list-style: none; }
.equip-card summary::-webkit-details-marker { display: none; }
.equip-card[open] summary { margin-bottom: 10px; }
.exercise-alt { font-size: 12px; margin-top: 6px; padding: 6px 8px; border-radius: 8px; background: var(--bg); color: var(--ink); }

/* ---------- overall streak (achievements card) ---------- */
.streak-hero { background: var(--primary-tint); border: 1px solid var(--primary-tint-border); border-radius: 16px; padding: 14px; margin-bottom: 12px; }
.streak-hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.streak-hero-num { font-size: 24px; font-weight: 800; color: #ea580c; line-height: 1.3; }
.sw-week { display: flex; justify-content: space-between; margin: 12px 0 10px; }
.sw-day { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; }
.sw-dot { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 15px; background: var(--card); border: 1px solid var(--border); }
.sw-day.on .sw-dot { background: color-mix(in srgb, #f59e0b 22%, var(--card)); border-color: #f59e0b; }
.sw-day.today .sw-dot { outline: 2px solid var(--primary); outline-offset: 2px; }
.sw-name { font-size: 11px; color: var(--muted); }
.sw-next .progress-bar { margin-bottom: 6px; }

/* ---------- recovery ---------- */
.rc-top { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.rc-score { font-size: 40px; font-weight: 800; line-height: 1; }
.rc-score small { font-size: 18px; font-weight: 700; }
.rc-title { font-weight: 800; font-size: 16px; }
.rc-factor { margin-bottom: 9px; }
.rc-factor-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.rc-tips { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--primary-tint); border: 1px solid var(--primary-tint-border); }
.rc-tip { font-size: 13px; line-height: 1.8; }

.rc-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: 14px; margin-bottom: 10px; border: 1px solid var(--border); background: var(--card); }
.rc-banner.warn { background: color-mix(in srgb, #f59e0b 14%, var(--card)); border-color: #f59e0b; }
.rc-banner.rest { background: color-mix(in srgb, #dc2626 10%, var(--card)); border-color: color-mix(in srgb, #dc2626 45%, var(--card)); }

/* ---------- points, coupons, toast ---------- */
.points-card { border: 1px solid var(--border); border-radius: 16px; padding: 12px 14px; margin-bottom: 12px; background: var(--card); }
.points-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.points-num { font-size: 24px; font-weight: 800; color: #b45309; }
.pt-details { margin-top: 8px; font-size: 13px; }
.pt-details summary { cursor: pointer; color: var(--muted); }
.pt-rule { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.pt-rule.total { border-bottom: 0; font-weight: 800; }
.plan-points-row { display: flex; align-items: center; gap: 8px; margin: 4px 0 8px; font-size: 14px; }
.plan-quote { margin-bottom: 8px; }
.coupon-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.coupon-row.off { opacity: .55; }
.coupon-form { margin-top: 10px; }
.coupon-form-row { display: flex; gap: 8px; }
.pt-toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--ink); color: var(--card); padding: 10px 16px; border-radius: 999px; font-size: 13px; font-weight: 600; z-index: 50; box-shadow: 0 8px 24px rgba(0,0,0,.2); animation: pt-toast-in .25s ease-out; max-width: 90%; text-align: center; }
@keyframes pt-toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

.plan-points-box { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); text-align: center; }
.plan-points-box .btn-secondary { margin-top: 6px; }

.pt-goal { margin-top: 10px; }
.pt-goal .progress-bar { margin-bottom: 6px; }
