:root {
  --bg: #FFF9F5; --panel: #FFFFFF; --ink: #2B2118; --ink2: #8A7E72;
  --line: #F0E6DD; --coral: #FF6B5B; --coral-dk: #E8503F; --plum: #6B4E9E;
  --mint: #2FB8A0; --amber: #F5A623; --shadow: 0 4px 20px rgba(120,80,60,.08);
  --shadow-lg: 0 10px 40px rgba(120,80,60,.12);
  --sans: "Nunito", "Segoe UI", system-ui, sans-serif;
  --round: 20px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 17px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; }
.brand { font-weight: 800; font-size: 1.35rem; letter-spacing: -.02em;
  color: var(--coral); }
.brand.light { color: #fff; }

/* ===== LANDING ===== */
.landing { display: grid; grid-template-columns: 1.05fr .95fr; min-height: 100vh; }
.land-left { background: linear-gradient(150deg, #FF8A5B 0%, #FF6B5B 45%, #E8503F 100%);
  color: #fff; padding: clamp(36px,5vw,80px); display: flex; flex-direction: column;
  justify-content: center; position: relative; }
.land-top { font-weight: 700; font-size: .8rem; letter-spacing: .12em;
  text-transform: uppercase; opacity: .85; margin: 0 0 24px; }
.land-head { font-weight: 800; font-size: clamp(2.3rem,4vw,3.7rem); line-height: 1.05;
  letter-spacing: -.03em; margin: 0 0 18px; max-width: 15ch; }
.land-sub { font-size: 1.15rem; opacity: .95; max-width: 40ch; margin: 0 0 32px;
  line-height: 1.5; }
.land-feats { list-style: none; padding: 0; margin: 0; max-width: 44ch; }
.land-feats li { font-size: 1rem; padding: 14px 0 14px 40px; position: relative;
  border-top: 1px solid #ffffff33; }
.land-feats li::before { content: ""; position: absolute; left: 0; top: 15px;
  width: 24px; height: 24px; border-radius: 50%; background: #ffffff2e;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M5 12l5 5L20 6'/%3E%3C/svg%3E");
  background-size: 15px; background-repeat: no-repeat; background-position: center; }
.land-feats b { font-weight: 800; }
.land-fine { font-size: .8rem; opacity: .8; margin: 28px 0 0; }

.land-right { display: grid; place-items: center; padding: 32px; }
.auth-card { width: 100%; max-width: 380px; background: var(--panel);
  border-radius: var(--round); padding: 36px; box-shadow: var(--shadow-lg); }
.auth-head { font-weight: 800; font-size: 1.6rem; margin: 0 0 20px;
  letter-spacing: -.02em; }
.lbl { font-weight: 700; font-size: .82rem; color: var(--ink2); display: block;
  margin-top: 14px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--ink2);
  font-size: .85rem; font-weight: 600; margin: 18px 0 6px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.err { color: var(--coral-dk); font-weight: 600; font-size: .88rem; }

/* ===== INPUTS / BUTTONS ===== */
input[type=email], input[type=password], input[type=number],
input[type=date], input[type=text], #fd_name, select {
  width: 100%; padding: 14px 16px; margin: 7px 0; font-size: 1rem;
  border: 2px solid var(--line); border-radius: 14px; background: var(--bg);
  color: var(--ink); font-family: var(--sans); font-weight: 600;
  transition: border-color .15s; }
input:focus, select:focus { outline: none; border-color: var(--coral); background: #fff; }
.alert-row { margin: 0; padding: 14px 26px; background: #FFF7EC;
  border-top: 1px solid var(--line); color: #9A6B0E; font-weight: 600;
  font-size: .92rem; }
.alert-row b { color: var(--amber); }
.reminder-box { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.reminder-box h4 { margin: 0 0 12px; font-size: 1rem; font-weight: 800; color: var(--ink); }
.rm-row { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; }
.link-del { background: none; border: 0; color: var(--coral-dk); font-weight: 700;
  font-size: .82rem; cursor: pointer; padding: 4px 0; }
.link-del:hover { text-decoration: underline; }

/* ===== CARE TAB ===== */
.care-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px; align-items: start; }
.care-card { background: #fff; border-radius: var(--round); padding: 26px;
  box-shadow: var(--shadow); }
.care-card h2 { margin: 0 0 6px; font-size: 1.25rem; font-weight: 800; color: var(--ink); }
.care-sub { color: var(--ink2); font-size: .92rem; margin: 0 0 16px; line-height: 1.5; }
.care-fine { color: var(--ink2); font-size: .82rem; margin-top: 12px; line-height: 1.5; }
.sym-q { display: flex; justify-content: space-between; align-items: center; gap: 14px;
  padding: 12px 0; border-bottom: 1px solid var(--line); font-size: .92rem;
  font-weight: 600; color: var(--ink); }
.sym-toggle { display: flex; gap: 6px; flex-shrink: 0; }
.sym-toggle button { padding: 8px 16px; font-size: .85rem; border-radius: 10px;
  background: var(--bg); color: var(--ink2); border: 2px solid var(--line); }
.sym-toggle button.on { background: var(--coral); color: #fff; border-color: var(--coral); }
.sym-result { margin-top: 18px; padding: 20px; border-radius: 16px; background: var(--bg);
  border-left: 5px solid var(--mint); }
.sym-result.mod { border-left-color: var(--amber); }
.sym-result.high { border-left-color: var(--coral); }
.sym-pct { font-size: 1.8rem; font-weight: 800; color: var(--ink); }
.sym-result p { margin: 6px 0 0; font-size: .92rem; color: var(--ink); }
.tx { border-bottom: 1px solid var(--line); }
.tx summary { padding: 14px 0; font-weight: 700; color: var(--ink); cursor: pointer;
  font-size: .95rem; list-style: none; display: flex; justify-content: space-between; }
.tx summary::after { content: "+"; color: var(--coral); font-weight: 800; }
.tx[open] summary::after { content: "–"; }
.tx div { padding: 0 0 16px; color: var(--ink2); font-size: .9rem; line-height: 1.6; }
.research-links { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.research-links h4 { margin: 0 0 10px; font-size: .95rem; font-weight: 800; color: var(--ink); }
.research-links a { display: block; padding: 8px 0; color: var(--coral-dk);
  font-weight: 700; font-size: .9rem; text-decoration: none; }
.research-links a:hover { text-decoration: underline; }
button { font-size: 1rem; font-weight: 800; border: 0; border-radius: 14px;
  cursor: pointer; padding: 15px 22px; font-family: var(--sans);
  transition: transform .1s, box-shadow .15s, background .15s; }
button:active { transform: scale(.98); }
.primary { background: var(--coral); color: #fff;
  box-shadow: 0 4px 14px rgba(255,107,91,.35); }
.primary:hover { background: var(--coral-dk); }
.primary:disabled { background: #E8DCD2; color: #B0A192; box-shadow: none;
  cursor: default; }
.ghost { background: #fff; color: var(--coral); border: 2px solid var(--line); }
.ghost:hover { border-color: var(--coral); }
.small { padding: 9px 16px; font-size: .85rem; }
.wide { width: 100%; margin-top: 12px; }

/* ===== SHELL ===== */
.topbar { position: sticky; top: 0; display: flex; align-items: center; gap: 24px;
  padding: 0 26px; height: 64px; background: #fff; border-bottom: 1px solid var(--line);
  z-index: 5; }
.topnav { display: flex; gap: 6px; margin-right: auto; }
.tabbtn { background: none; border: 0; border-radius: 10px; padding: 9px 16px;
  color: var(--ink2); font-family: var(--sans); font-weight: 700; font-size: .95rem;
  cursor: pointer; }
.tabbtn:hover { color: var(--ink); }
.tabbtn.active { color: var(--coral); background: #FFF0ED; }
.pill { font-weight: 800; font-size: .9rem; padding: 7px 15px; border-radius: 999px;
  background: #F3EEE8; color: var(--ink2); }
.pill.high { background: #FFEBE8; color: var(--coral-dk); }
.pill.ok { background: #E4F7F3; color: var(--mint); }
.content { max-width: 940px; margin: 0 auto; padding: 28px 26px 110px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.sect { font-weight: 800; font-size: 1.15rem; letter-spacing: -.01em; margin: 0 0 14px; }
.msg { font-size: .9rem; color: var(--ink2); min-height: 1em; }
.foot { text-align: center; font-size: .82rem; color: var(--ink2); padding: 20px 0; }

/* ===== TODAY ===== */
.insight-card { background: #fff; border-radius: var(--round); overflow: hidden;
  box-shadow: var(--shadow); }
.readout { padding: 26px 26px 22px; background: linear-gradient(135deg,#FFF4F0,#FFE9E4); }
.readout.warn { background: linear-gradient(135deg,#FFECE8,#FFDdd6); }
.readout .lab { font-weight: 700; font-size: .82rem; color: var(--coral-dk);
  text-transform: uppercase; letter-spacing: .05em; }
.hero-num { font-weight: 800; font-size: 3.6rem; line-height: 1; letter-spacing: -.03em;
  display: block; margin-top: 8px; color: var(--ink); }
.hero-unit { font-size: 1.1rem; color: var(--ink2); font-weight: 700; margin-left: 8px; }
.readout.warn .hero-num { color: var(--coral-dk); }
.gauge { height: 12px; background: #fff; border-radius: 999px; margin: 18px 0 8px;
  position: relative; overflow: hidden; box-shadow: inset 0 1px 3px rgba(0,0,0,.06); }
.gauge .fill { height: 100%; background: linear-gradient(90deg,#2FB8A0,#F5A623);
  border-radius: 999px; }
.gauge.over .fill { background: linear-gradient(90deg,#F5A623,#FF6B5B); }
.gauge .mark { position: absolute; top: -2px; bottom: -2px; width: 3px;
  background: var(--ink); border-radius: 2px; }
.gauge-lab { display: flex; justify-content: space-between; font-size: .72rem;
  font-weight: 700; color: var(--ink2); }
.stat-row { display: flex; padding: 4px 12px 8px; }
.stat { flex: 1; padding: 16px; text-align: center; }
.stat .n { font-weight: 800; font-size: 2rem; color: var(--coral); }
.stat .k { font-size: .78rem; font-weight: 700; color: var(--ink2); text-transform: uppercase;
  letter-spacing: .04em; }
.trigger-wrap { padding: 18px 26px 24px; border-top: 1px solid var(--line); }
.trigger-wrap .lab { font-weight: 700; font-size: .8rem; color: var(--ink2);
  text-transform: uppercase; letter-spacing: .04em; }
.trigger-chip { display: inline-block; font-weight: 700; font-size: .85rem;
  background: #FFF0ED; color: var(--coral-dk); border-radius: 999px;
  padding: 6px 14px; margin: 8px 8px 0 0; }

/* ===== QUICK LOG ===== */
/* ===== RISK CARD ===== */
.risk-card { display: flex; gap: 22px; align-items: center; background: #fff;
  border-radius: var(--round); padding: 24px 26px; box-shadow: var(--shadow);
  margin-bottom: 18px; border-left: 6px solid var(--mint); }
.risk-card.moderate { border-left-color: var(--amber); }
.risk-card.high { border-left-color: var(--coral); }
.risk-ring { position: relative; width: 120px; height: 120px; flex-shrink: 0; }
.risk-ring svg { width: 120px; height: 120px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--line); stroke-width: 12; }
.ring-fg { fill: none; stroke-width: 12; stroke-linecap: round;
  transition: stroke-dashoffset .6s ease; }
.risk-card.low .ring-fg { stroke: var(--mint); }
.risk-card.moderate .ring-fg { stroke: var(--amber); }
.risk-card.high .ring-fg { stroke: var(--coral); }
.ring-center { position: absolute; inset: 0; display: grid; place-content: center;
  text-align: center; }
.ring-num { font-size: 2.3rem; font-weight: 800; color: var(--ink); line-height: 1; }
.ring-unit { font-size: .75rem; font-weight: 700; color: var(--ink2);
  text-transform: uppercase; letter-spacing: .05em; }
.risk-body { flex: 1; }
.risk-msg { font-size: 1.15rem; font-weight: 800; color: var(--ink);
  display: block; margin-bottom: 8px; }
.risk-card.high .risk-msg { color: var(--coral-dk); }
.risk-factors { list-style: none; margin: 0; padding: 0; }
.risk-factors li { font-size: .9rem; font-weight: 600; color: var(--ink2);
  padding: 3px 0 3px 18px; position: relative; }
.risk-factors li::before { content: "•"; position: absolute; left: 4px;
  color: var(--coral); }
@media (max-width: 600px) {
  .quick-grid { grid-template-columns: repeat(3,1fr); }
  .risk-card { flex-direction: column; text-align: center; }
  .risk-factors li { text-align: left; }
}
.quick { background: #fff; border: 0; border-radius: var(--round); padding: 24px 10px;
  cursor: pointer; display: grid; gap: 10px; justify-items: center; font-weight: 800;
  font-size: .92rem; color: var(--ink); box-shadow: var(--shadow); }
.quick:hover { box-shadow: var(--shadow-lg); }
.quick .q-icon { width: 48px; height: 48px; border-radius: 50%; display: grid;
  place-items: center; font-size: 1.5rem; background: #FFF0ED; }
.flare-btn .q-icon { background: #FFE4DF; }
.quick.flare-btn { color: var(--coral-dk); }
.sheet { background: #fff; border-radius: var(--round); padding: 22px; margin-top: 16px;
  box-shadow: var(--shadow); }
.sheet h3 { margin: 0 0 12px; font-weight: 800; font-size: 1.05rem; }
.check { display: flex; gap: 10px; align-items: center; margin: 12px 0; font-weight: 600; }
.check input { width: auto; }

/* ===== JOINT MAP ===== */
#jointmap { width: 100%; background: #fff; border-radius: var(--round); padding: 18px;
  box-shadow: var(--shadow); }
.silh path { fill: #FFF4F0; stroke: #FFD9CF; stroke-width: 1.5; }
.joint circle { fill: #fff; stroke: #E0B5AC; stroke-width: 2; cursor: pointer;
  transition: all .12s; }
.joint:hover circle { stroke: var(--coral); stroke-width: 3; }
.joint.sel circle { fill: var(--coral); stroke: var(--coral); }
.joint text { text-anchor: middle; font-size: 11px; font-weight: 700; fill: var(--ink2);
  font-family: var(--sans); }
.joint.sel text { fill: var(--coral-dk); }

/* ===== SEVERITY / TRENDS ===== */
input[type=range] { width: 100%; accent-color: var(--coral); margin: 12px 0; height: 6px; }
.sev-read { font-weight: 800; font-size: 1.3rem; margin: 0 0 14px; color: var(--coral); }
.chart-card { background: #fff; border-radius: var(--round); padding: 20px;
  box-shadow: var(--shadow); }
#uaChart { width: 100%; height: auto; }
.flare-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.flare-list li { background: #fff; border-radius: 14px; padding: 14px 18px;
  display: flex; justify-content: space-between; align-items: center; font-weight: 600;
  box-shadow: var(--shadow); }
.flare-list .sev { font-weight: 800; color: var(--coral); }
.badge-high, .badge-very_high { color: var(--coral-dk); font-weight: 800; }
.badge-moderate { color: var(--amber); font-weight: 800; }
.badge-low { color: var(--mint); font-weight: 800; }

/* ===== RESPONSIVE ===== */
.tabbar { display: none; }
@media (max-width: 820px) {
  .landing { grid-template-columns: 1fr; }
  .land-left { min-height: 44vh; }
  .grid-2 { grid-template-columns: 1fr; gap: 12px; }
  .topnav { display: none; }
  .tabbar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: #fff;
    border-top: 1px solid var(--line); z-index: 10; padding: 4px; }
  .tabbar .tabbtn { flex: 1; border-radius: 12px; padding: 12px 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }


/* --- New feature styles (v13) --- */
.milestone-badge {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(135deg, #FFF3D6, #FFE9C2);
  border: 1px solid #F5D98A; border-radius: 20px;
  padding: 14px 18px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.milestone-badge .mb-emoji { font-size: 30px; }
.milestone-badge b { display: block; color: #8A5A00; font-size: 16px; }
.milestone-badge span { color: #A8814A; font-size: 13px; }

.swap-tip {
  display: block; background: #EAF8F4; border: 1px solid #B8E6DC;
  border-radius: 12px; padding: 10px 12px; color: #1E7A67;
  font-size: 13px; line-height: 1.4;
}

.corr-card { margin-top: 14px; }
.corr-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--line); gap: 10px;
}
.corr-row:last-child { border-bottom: none; }
.corr-trig { font-weight: 700; color: var(--ink); text-transform: capitalize; }
.corr-lag { color: var(--ink2); font-size: 13px; text-align: right; }

.photo-input {
  width: 100%; padding: 10px; border: 1px dashed var(--line);
  border-radius: 12px; background: #FFFDFB; font-family: var(--sans);
  color: var(--ink2); margin-bottom: 12px;
}
.photo-prev img { max-width: 100%; border-radius: 12px; margin-bottom: 12px; }


/* ===== PUBLIC PAGES (symptom checker + shared report) ===== */
body.public { background: var(--bg); }
.pub-wrap { max-width: 720px; margin: 0 auto; padding: 0 18px 60px; }
.pub-top { display: flex; align-items: center; justify-content: space-between;
  padding: 18px 2px; }
.pub-hero { text-align: center; padding: 26px 6px 10px; }
.pub-hero h1 { font-size: clamp(2.1rem, 6vw, 3rem); font-weight: 800;
  letter-spacing: -.03em; margin: 0 0 12px; color: var(--ink); }
.pub-lead { color: var(--ink2); font-size: 1.08rem; max-width: 52ch;
  margin: 0 auto; line-height: 1.55; }
.pub-card { background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--round); box-shadow: var(--shadow); padding: 22px;
  margin: 18px 0; }
.pub-card.capture { background: linear-gradient(160deg, #FFF3EE, #FFFFFF); }
.pub-card.result { text-align: center; }
.pub-card.result.high { border-color: var(--coral); }
.pub-card.result.mod { border-color: var(--amber); }
.pub-card.result.low { border-color: var(--mint); }
.sym-pct { font-size: 2.4rem; font-weight: 800; letter-spacing: -.02em; }
.result.high .sym-pct { color: var(--coral-dk); }
.result.mod .sym-pct { color: var(--amber); }
.result.low .sym-pct { color: var(--mint); }
.pub-foot { color: var(--ink2); font-size: .82rem; line-height: 1.5;
  margin-top: 26px; }
.pub-foot b { color: var(--ink); }
.pub-links { margin-top: 10px; }
.pub-links a { color: var(--coral-dk); text-decoration: none; font-weight: 700; }

/* shared doctor report */
.report-wrap { max-width: 760px; }
.rep-head h1 { font-size: 1.7rem; font-weight: 800; margin: 6px 0 2px;
  letter-spacing: -.02em; }
.rep-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  margin: 18px 0 8px; }
.rep-stat { background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px 10px; text-align: center; }
.rep-stat .n { font-size: 1.5rem; font-weight: 800; color: var(--plum); }
.rep-stat .k { font-size: .74rem; color: var(--ink2); text-transform: uppercase;
  letter-spacing: .04em; margin-top: 2px; }
.rep-sec { font-size: 1.05rem; font-weight: 800; margin: 26px 0 10px;
  padding-bottom: 6px; border-bottom: 2px solid var(--line); }
.rep-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.rep-table th { text-align: left; color: var(--ink2); font-size: .74rem;
  text-transform: uppercase; letter-spacing: .04em; padding: 6px 8px;
  border-bottom: 1px solid var(--line); }
.rep-table td { padding: 8px; border-bottom: 1px solid var(--line); }
.rep-table .hi { color: var(--coral-dk); font-weight: 700; }
@media print {
  .pub-top button, .pub-top .ghost { display: none; }
  body.public { background: #fff; }
}
/* lab import + share controls in app */
.mini-note { font-size: .82rem; color: var(--ink2); margin: 4px 0 0; }
.import-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  margin-top: 8px; }
.share-box { margin-top: 12px; padding: 12px; border: 1px solid var(--line);
  border-radius: 12px; background: #FFFDFB; }
.share-box input { width: 100%; font-size: .85rem; }
.lab-hits { margin: 8px 0; font-size: .9rem; }
.lab-hits li { padding: 4px 0; }
@media (max-width: 560px) { .rep-stats { grid-template-columns: repeat(2, 1fr); } }


/* ===== ACHIEVEMENTS ===== */
.tab-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--coral); margin-left: 5px; vertical-align: middle;
  box-shadow: 0 0 0 3px rgba(255,107,91,.2); }
.ach-head { margin-bottom: 8px; }
.ach-progress-card { display: flex; align-items: center; gap: 18px;
  background: linear-gradient(150deg, #FF8A5B, #FF6B5B 55%, #E8503F);
  color: #fff; border-radius: var(--round); padding: 20px 22px;
  box-shadow: var(--shadow); }
.ach-count { display: flex; align-items: baseline; gap: 2px; }
.ach-num { font-size: 2.6rem; font-weight: 800; line-height: 1; }
.ach-of { font-size: 1.1rem; font-weight: 700; opacity: .85; }
.ach-bar-wrap { flex: 1; }
.ach-bar-lab { font-size: .82rem; font-weight: 700; opacity: .95; margin-bottom: 6px; }
.ach-bar { height: 10px; background: #ffffff33; border-radius: 6px; overflow: hidden; }
.ach-bar-fill { height: 100%; background: #fff; border-radius: 6px;
  transition: width .5s ease; }
.ach-cat { margin-top: 22px; }
.ach-cat-h { font-size: 1rem; font-weight: 800; color: var(--ink);
  display: flex; justify-content: space-between; align-items: center;
  margin: 0 0 12px; }
.ach-cat-h span { font-size: .8rem; color: var(--ink2); font-weight: 700; }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px; }
.badge-card { position: relative; background: var(--panel);
  border: 1px solid var(--line); border-radius: 16px; padding: 16px 14px;
  text-align: center; box-shadow: var(--shadow); overflow: hidden; }
.badge-card.locked { opacity: .62; background: #FBF7F3; }
.badge-card.locked .badge-emoji { filter: grayscale(1); opacity: .7; }
.badge-card.earned { border-color: #FFD9CF; }
.badge-card.isnew { border-color: var(--coral);
  box-shadow: 0 0 0 3px rgba(255,107,91,.18), var(--shadow); }
.badge-emoji { font-size: 2.2rem; line-height: 1; margin-bottom: 8px; }
.badge-title { font-weight: 800; font-size: .95rem; color: var(--ink);
  letter-spacing: -.01em; }
.badge-desc { font-size: .78rem; color: var(--ink2); margin-top: 4px;
  line-height: 1.4; }
.badge-new { position: absolute; top: 8px; right: 8px; background: var(--coral);
  color: #fff; font-size: .6rem; font-weight: 800; letter-spacing: .06em;
  padding: 2px 7px; border-radius: 8px; }
.badge-prog { height: 6px; background: var(--line); border-radius: 4px;
  overflow: hidden; margin: 10px 0 4px; }
.badge-prog-fill { height: 100%; background: var(--coral); border-radius: 4px; }
.badge-prog-lab { font-size: .72rem; color: var(--ink2); font-weight: 700; }
.badge-date { display: block; font-size: .68rem; color: var(--mint);
  font-weight: 700; margin-top: 8px; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%) translateY(20px);
  background: var(--panel); border: 1px solid var(--line);
  border-left: 4px solid var(--coral); border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 14px 18px; display: flex;
  align-items: center; gap: 12px; max-width: 340px; z-index: 999;
  opacity: 0; transition: opacity .35s ease, transform .35s ease; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-emoji { font-size: 1.8rem; line-height: 1; }
.toast b { display: block; color: var(--ink); font-weight: 800; }
.toast span { font-size: .82rem; color: var(--ink2); line-height: 1.3; }
@media (max-width: 560px) {
  .ach-progress-card { padding: 16px; gap: 12px; }
  .ach-num { font-size: 2.1rem; }
  .badge-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .toast { bottom: 76px; }
}


/* ===== DAILY STREAK + TIP (retention) ===== */
.streak-card { display: flex; align-items: center; gap: 14px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--round); padding: 16px 18px; margin-bottom: 14px;
  box-shadow: var(--shadow); position: relative; overflow: hidden; }
.streak-card.lit { background: linear-gradient(150deg, #FFF1EC, #FFFFFF);
  border-color: #FFD3C7; }
.streak-card.risk { background: linear-gradient(150deg, #FFF7E9, #FFFFFF);
  border-color: #F7DCA6; }
.streak-flame { font-size: 2.3rem; line-height: 1;
  filter: saturate(1.1); transition: transform .3s; }
.streak-card.lit .streak-flame { animation: flamepulse 1.8s ease-in-out infinite; }
@keyframes flamepulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.15); } }
.streak-card:not(.lit):not(.risk) .streak-flame { filter: grayscale(.5) opacity(.7); }
.streak-body { flex: 1; }
.streak-num { font-size: 1.5rem; font-weight: 800; color: var(--ink);
  letter-spacing: -.02em; line-height: 1.1; }
.streak-msg { font-size: .84rem; color: var(--ink2); margin-top: 2px; }
.streak-best { text-align: center; padding-left: 14px;
  border-left: 1px solid var(--line); }
.streak-best span { font-size: .66rem; color: var(--ink2); text-transform: uppercase;
  letter-spacing: .05em; display: block; }
.streak-best b { font-size: 1.3rem; color: var(--coral-dk); font-weight: 800; }

.tip-card { display: flex; gap: 12px; align-items: flex-start;
  background: #FBF7FF; border: 1px solid #EBE2F5; border-radius: 16px;
  padding: 14px 16px; margin-top: 14px; }
.tip-icon { font-size: 1.4rem; line-height: 1.2; }
.tip-card > div { font-size: .9rem; color: var(--ink); line-height: 1.5; }
.tip-tag { display: inline-block; background: var(--plum); color: #fff;
  font-size: .64rem; font-weight: 800; letter-spacing: .05em;
  text-transform: uppercase; padding: 2px 8px; border-radius: 8px;
  margin-right: 6px; vertical-align: middle; }


/* ===== BILLING / PREMIUM UI ===== */
.upgrade-pill { background: linear-gradient(135deg, var(--amber), var(--coral));
  color: #fff; border: none; font-family: var(--sans); font-weight: 800;
  font-size: .8rem; padding: 7px 14px; border-radius: 999px; cursor: pointer;
  box-shadow: var(--shadow); white-space: nowrap; transition: transform .15s; }
.upgrade-pill:hover { transform: translateY(-1px); }

.pro-tag { display: inline-block; background: var(--amber); color: #fff;
  font-size: .6rem; font-weight: 800; letter-spacing: .05em; padding: 1px 6px;
  border-radius: 6px; margin-left: 6px; vertical-align: middle; }

.modal-overlay { position: fixed; inset: 0; z-index: 1000;
  background: rgba(43, 33, 24, .5); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fadein .2s ease; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.modal-card { background: var(--panel); border-radius: var(--round);
  padding: 30px 26px 24px; max-width: 380px; width: 100%; text-align: center;
  box-shadow: var(--shadow-lg); position: relative; animation: popin .25s ease; }
@keyframes popin { from { transform: scale(.92) translateY(10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; } }
.modal-x { position: absolute; top: 12px; right: 14px; background: none;
  border: none; font-size: 1.6rem; line-height: 1; color: var(--ink2);
  cursor: pointer; padding: 4px; }
.up-emoji { font-size: 2.6rem; line-height: 1; }
.up-title { font-size: 1.4rem; font-weight: 800; color: var(--ink);
  margin: 8px 0 2px; }
.up-price { font-size: 1.05rem; font-weight: 800; color: var(--coral-dk);
  margin-bottom: 14px; }
.up-feats { list-style: none; padding: 0; margin: 0 0 18px; text-align: left; }
.up-feats li { position: relative; padding: 7px 6px 7px 30px;
  font-size: .92rem; color: var(--ink); border-bottom: 1px solid var(--line); }
.up-feats li:last-child { border-bottom: none; }
.up-feats li::before { content: "✓"; position: absolute; left: 6px;
  color: var(--mint); font-weight: 900; }
.up-fine { font-size: .74rem; color: var(--ink2); margin-top: 12px; }
.billing-card .up-feats { margin-bottom: 14px; }


/* ===== COMMUNITY FORUM ===== */
.forum-sub { color: var(--ink2); font-size: .92rem; margin: 2px 0 16px; max-width: 60ch; }
.forum-compose { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--round);
  padding: 14px; box-shadow: var(--shadow); margin-bottom: 16px; }
.forum-select { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px;
  font-family: var(--sans); font-weight: 700; color: var(--ink); background: var(--bg); }
.forum-textarea { flex: 1; min-width: 200px; border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px; font-family: var(--sans); font-size: .95rem;
  resize: vertical; color: var(--ink); }
.forum-textarea:focus, .forum-select:focus { outline: none; border-color: var(--coral); }

.forum-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.forum-chip { border: 1px solid var(--line); background: var(--panel); color: var(--ink2);
  font-family: var(--sans); font-weight: 700; font-size: .82rem; padding: 5px 13px;
  border-radius: 999px; cursor: pointer; transition: all .15s; }
.forum-chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }

.forum-list { display: flex; flex-direction: column; gap: 10px; }
.forum-post { background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 14px 16px; cursor: pointer; transition: transform .12s, box-shadow .12s; }
.forum-post:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.fp-top { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; flex-wrap: wrap; }
.fp-cat { font-size: .66rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .04em; padding: 2px 8px; border-radius: 7px; color: #fff; }
.cat-general { background: var(--ink2); }
.cat-diet { background: var(--mint); }
.cat-flares { background: var(--coral); }
.cat-meds { background: var(--plum); }
.cat-wins { background: var(--amber); }
.fp-author { font-weight: 800; color: var(--ink); font-size: .9rem; }
.fp-time { color: var(--ink2); font-size: .78rem; margin-left: auto; }
.fp-body { color: var(--ink); font-size: .95rem; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.fp-foot { margin-top: 9px; color: var(--ink2); font-size: .8rem; font-weight: 700; }

.forum-thread-post { background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--round); padding: 16px 18px; box-shadow: var(--shadow); margin: 12px 0 18px; }
.ft-body { color: var(--ink); font-size: 1rem; line-height: 1.6;
  white-space: pre-wrap; word-break: break-word; }
.ft-rh { font-size: .9rem; color: var(--ink2); font-weight: 800; margin: 0 0 10px; }
.forum-replies { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.forum-reply { background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 11px 14px; }
.fr-top { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.fr-top .fp-time { margin-left: auto; }
.fr-body { color: var(--ink); font-size: .93rem; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word; }

/* ===== EDIT PROFILE ===== */
.pf-fields { text-align: left; margin-bottom: 8px; }
.pf-fields input { width: 100%; box-sizing: border-box; margin-bottom: 4px; }
.pf-divide { height: 1px; background: var(--line); margin: 14px 0; }
.lbl-hint { font-weight: 600; color: var(--ink2); font-size: .78rem; }


/* ===== LEGAL PAGES ===== */
.legal { max-width: 640px; }
.legal h1 { font-size: 1.8rem; margin-bottom: 2px; }
.legal-updated { color: var(--ink2); font-size: .82rem; margin-bottom: 20px; }
.legal h2 { font-size: 1.1rem; margin: 22px 0 6px; color: var(--ink); }
.legal p { color: var(--ink); line-height: 1.6; font-size: .94rem; }

.fp-badges { background: #FFF3E0; color: var(--amber); font-size: .74rem;
  font-weight: 800; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
