/* Sugar Freedom Movement Portal — Longevity Starts Young
   Mobile-first, large type, high contrast. Designed for adults 50+. */

:root {
  --cream: #fbf8f1;
  --cream-2: #f3eee2;
  --white: #ffffff;
  --forest: #2d5a3d;       /* primary — 7.9:1 on white */
  --forest-dark: #1f4029;
  --olive: #4a7a5a;
  --sage: #5bad8f;
  --sage-soft: #e5f2ec;
  --lime: #7ed957;          /* decorative accents only (low contrast as text) */
  --ink: #1d2a21;
  --ink-soft: #46534a;      /* 7.6:1 on cream */
  --line: #d9d3c4;
  --amber-bg: #fff4d6;
  --amber-ink: #6b4a00;
  --alert-bg: #fde8e4;
  --alert-ink: #8a1f0e;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(45, 90, 61, 0.08);
  --font: "Poppins", "DM Sans", "Nunito", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 112.5%; -webkit-text-size-adjust: 100%; }   /* 18px base */
body {
  margin: 0; font-family: var(--font); color: var(--ink); background: var(--cream);
  line-height: 1.6; font-size: 1rem;
}
img, svg { max-width: 100%; }
a { color: var(--forest); text-underline-offset: 3px; text-decoration-thickness: 2px; }
a:hover { color: var(--forest-dark); }
:focus-visible { outline: 4px solid var(--sage); outline-offset: 3px; border-radius: 6px; }

.skip-link { position: absolute; left: -999px; top: 0; background: var(--forest); color: #fff; padding: .75rem 1rem; z-index: 10; }
.skip-link:focus { left: 1rem; top: 1rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Header ---------- */
.site-header { background: var(--forest); color: #fff; position: relative; overflow: hidden; }
.site-header::after { /* soft leaf shape in the corner */
  content: ""; position: absolute; right: -40px; top: -50px; width: 180px; height: 180px;
  background: radial-gradient(ellipse at 30% 70%, rgba(126, 217, 87, .35), transparent 60%);
  border-radius: 0 100% 0 100%; transform: rotate(20deg); pointer-events: none;
}
.header-inner { max-width: 960px; margin: 0 auto; padding: .9rem 1.1rem; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; font-weight: 800; letter-spacing: .04em; line-height: 1.15; }
.brand img { width: 40px; height: 40px; }
.brand small { display: block; font-weight: 500; letter-spacing: .02em; font-size: .78rem; opacity: .92; }
.brand:hover { color: #fff; }
.nav { margin-left: auto; display: flex; gap: .35rem; flex-wrap: wrap; position: relative; z-index: 1; }
.nav a, .nav button {
  color: #fff; text-decoration: none; font: inherit; font-size: .95rem; font-weight: 600; background: transparent;
  border: 2px solid transparent; padding: .45rem .8rem; border-radius: 999px; cursor: pointer; min-height: 44px;
}
.nav a[aria-current="page"] { border-color: var(--lime); }
.nav a:hover, .nav button:hover { background: rgba(255, 255, 255, .12); }

/* ---------- Layout ---------- */
main { max-width: 960px; margin: 0 auto; padding: 1.25rem 1.1rem 3rem; }
.narrow { max-width: 560px; }
h1 { font-size: 1.75rem; line-height: 1.25; margin: .5rem 0 1rem; color: var(--forest-dark); font-weight: 800; }
h2 { font-size: 1.3rem; line-height: 1.3; margin: 0 0 .75rem; color: var(--forest-dark); }
h3 { font-size: 1.1rem; margin: 1rem 0 .5rem; }
p { margin: 0 0 1rem; }
.lead { font-size: 1.1rem; color: var(--ink-soft); }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .8rem; font-weight: 700; color: var(--olive); margin: 0 0 .25rem; }
.muted { color: var(--ink-soft); }
.small { font-size: .9rem; }

.card { background: var(--white); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); margin-bottom: 1.1rem; border: 1px solid #ece6d8; }
.card.accent { border-left: 6px solid var(--sage); }
.grid { display: grid; gap: 1.1rem; }
@media (min-width: 720px) {
  html { font-size: 118.75%; }  /* 19px */
  .grid.two { grid-template-columns: 1fr 1fr; }
  .grid.three { grid-template-columns: repeat(3, 1fr); }
  h1 { font-size: 2rem; }
}

.stat { font-size: 2.1rem; font-weight: 800; color: var(--forest); line-height: 1.1; }
.stat small { font-size: 1rem; font-weight: 600; color: var(--ink-soft); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; font: inherit; font-weight: 700;
  min-height: 54px; padding: .7rem 1.4rem; border-radius: 999px; border: 2px solid var(--forest);
  background: var(--forest); color: #fff; cursor: pointer; text-decoration: none; text-align: center; line-height: 1.2;
}
.btn:hover { background: var(--forest-dark); border-color: var(--forest-dark); color: #fff; }
.btn.secondary { background: #fff; color: var(--forest); }
.btn.secondary:hover { background: var(--sage-soft); color: var(--forest-dark); }
.btn.danger { background: var(--alert-ink); border-color: var(--alert-ink); }
.btn.big { width: 100%; font-size: 1.15rem; min-height: 64px; }
.btn.small { min-height: 44px; padding: .4rem 1rem; font-size: .9rem; }
.btn[disabled] { opacity: .6; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1rem; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--forest); text-decoration: underline; cursor: pointer; }

/* ---------- Forms ---------- */
.field { margin-bottom: 1.2rem; }
label, legend { font-weight: 700; display: block; margin-bottom: .4rem; }
.hint { display: block; font-weight: 400; color: var(--ink-soft); font-size: .92rem; margin-top: .15rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], select, textarea {
  width: 100%; font: inherit; padding: .8rem .9rem; border: 2px solid #8c9a8f; border-radius: 12px; background: #fff; color: var(--ink); min-height: 54px;
}
textarea { min-height: 120px; }
input:focus, select:focus, textarea:focus { border-color: var(--forest); }
input[aria-invalid="true"] { border-color: var(--alert-ink); }
fieldset { border: 0; padding: 0; margin: 0 0 1.4rem; }
.choices { display: grid; gap: .6rem; }
.choices.inline { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice span {
  display: flex; align-items: center; gap: .7rem; padding: .85rem 1rem; border: 2px solid #b9c2b9; border-radius: 12px;
  background: #fff; cursor: pointer; font-weight: 500; min-height: 56px;
}
.choice span::before { content: ""; flex: 0 0 22px; height: 22px; border-radius: 50%; border: 2px solid var(--olive); background: #fff; }
.choice input:checked + span { border-color: var(--forest); background: var(--sage-soft); font-weight: 700; }
.choice input:checked + span::before { background: var(--forest); box-shadow: inset 0 0 0 4px #fff; }
.choice input:focus-visible + span { outline: 4px solid var(--sage); outline-offset: 2px; }
.checkbox { display: flex; gap: .75rem; align-items: flex-start; font-weight: 500; }
.checkbox input { width: 26px; height: 26px; margin-top: .2rem; flex: 0 0 26px; accent-color: var(--forest); }
.show-pw { margin-top: .5rem; }

/* ---------- Messages ---------- */
.notice { border-radius: 12px; padding: 1rem 1.1rem; margin-bottom: 1rem; border-left: 6px solid var(--sage); background: var(--sage-soft); }
.notice.warn { background: var(--amber-bg); border-color: #c99a1b; color: var(--amber-ink); }
.notice.alert { background: var(--alert-bg); border-color: var(--alert-ink); color: var(--alert-ink); }
.notice:empty { display: none; }
.notice h2, .notice h3 { color: inherit; margin-top: 0; }

.badge { display: inline-block; padding: .15rem .65rem; border-radius: 999px; font-size: .85rem; font-weight: 700; background: var(--cream-2); color: var(--ink); }
.badge.PROGRESS, .badge.eligible { background: #dcefe3; color: #1f4029; }
.badge.MAINTAIN, .badge.repeating { background: var(--amber-bg); color: var(--amber-ink); }
.badge.REVIEW, .badge.flagged { background: var(--alert-bg); color: var(--alert-ink); }
.badge.missing { background: #ece8f0; color: #3d3550; }

/* ---------- Plan / progress ---------- */
.plan-target { font-size: 1.35rem; font-weight: 800; color: var(--forest-dark); margin: .25rem 0 .5rem; }
.stage-dots { display: flex; gap: .35rem; margin: .5rem 0 1rem; flex-wrap: wrap; }
.stage-dots span { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; font-weight: 700; background: var(--cream-2); color: var(--ink-soft); }
.stage-dots span.done { background: var(--sage); color: #fff; }
.stage-dots span.current { background: var(--forest); color: #fff; box-shadow: 0 0 0 3px var(--lime); }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: .6rem 0 .6rem 1.4rem; border-left: 3px solid var(--sage); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -9px; top: 1rem; width: 15px; height: 15px; border-radius: 50%; background: var(--forest); }

.chart-wrap { width: 100%; overflow-x: auto; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .bar { fill: var(--sage); }
.chart .bar.met { fill: var(--forest); }
.chart .target { stroke: var(--lime); stroke-width: 4; stroke-linecap: round; }
.chart .axis { stroke: var(--line); }
.chart text { fill: var(--ink-soft); font-size: 13px; font-family: var(--font); }
.chart .val { fill: var(--ink); font-weight: 700; }
.legend { display: flex; gap: 1.2rem; flex-wrap: wrap; font-size: .9rem; color: var(--ink-soft); margin-top: .5rem; }
.legend i { display: inline-block; width: 16px; height: 16px; border-radius: 4px; vertical-align: -2px; margin-right: .35rem; }
.legend .l-bar { background: var(--forest); }
.legend .l-target { background: var(--lime); height: 5px; vertical-align: 3px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--ink-soft); font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--sage-soft); }

/* ---------- Admin ---------- */
.tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tabs button { font: inherit; font-weight: 700; border: 2px solid var(--forest); background: #fff; color: var(--forest); border-radius: 999px; padding: .45rem 1rem; min-height: 46px; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--forest); color: #fff; }
.filters { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .75rem; }
.filters button { font: inherit; font-size: .9rem; border: 2px solid var(--line); background: #fff; border-radius: 999px; padding: .3rem .85rem; min-height: 42px; cursor: pointer; }
.filters button[aria-pressed="true"] { border-color: var(--forest); background: var(--sage-soft); font-weight: 700; }
.code-box { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.5rem; letter-spacing: .1em; background: var(--cream-2); padding: .75rem 1rem; border-radius: 10px; display: inline-block; user-select: all; }
.json-editor { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; min-height: 340px; }
.stage-table input { min-height: 44px; padding: .4rem .5rem; }
.stage-table td { padding: .35rem .3rem; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0; }
dl.kv dt { font-weight: 700; color: var(--ink-soft); }
dl.kv dd { margin: 0; }
details summary { cursor: pointer; font-weight: 700; padding: .4rem 0; }

.footer { max-width: 960px; margin: 0 auto; padding: 1.5rem 1.1rem 2.5rem; color: var(--ink-soft); font-size: .9rem; border-top: 1px solid var(--line); }
.footer a { color: var(--ink-soft); }

.hidden { display: none !important; }
.step-indicator { font-weight: 700; color: var(--olive); margin-bottom: .5rem; }
.track-option { border: 2px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: .75rem; background: #fff; }
.track-option.recommended { border-color: var(--forest); background: var(--sage-soft); }

@media print { .site-header .nav, .btn, .footer { display: none; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.notice p:last-child { margin-bottom: 0; }
.badge { white-space: nowrap; }
.btn.big { margin-bottom: .5rem; }

/* Call prep summary */
.callprep-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.callprep-head h3 { margin-top: 0; }
#callprep h4 { margin: 1rem 0 .4rem; font-size: 1rem; }
#callprep dl.kv { align-content: start; }
@media print {
  body.print-callprep .site-header, body.print-callprep .footer, body.print-callprep h1,
  body.print-callprep .tabs, body.print-callprep #msg,
  body.print-callprep #panel-participants > :not(#callprep) { display: none !important; }
  body.print-callprep #callprep { box-shadow: none; border: 1px solid #999; }
  body.print-callprep .grid.two { grid-template-columns: 1fr 1fr; }
}
