/* ============================================================================
   My Trust Circle — design system
   Warm, prepared, calm. Forest green + gold + mint, with crisis red used only
   when a crisis is real. Display: Fraunces. UI/body: Figtree.
   ========================================================================== */

:root {
  /* Brand palette (kept from the original app) */
  --forest: #0b3d2e;
  --forest-ink: #072a20;
  --green: #17794a;
  --green-600: #1b7a4b;
  --green-700: #0f5c38;
  --gold: #d8b25c;
  --gold-soft: #f0e2bf;
  --mint: #e9f6ec;
  --mint-deep: #d9efdf;

  /* Neutrals (warm, green-tinted) */
  --paper: #fbfcfa;
  --card: #ffffff;
  --ink: #14241c;
  --muted: #5b6b62;
  --faint: #8a978f;
  --line: #e3eae4;
  --line-strong: #d3ddd5;

  /* Signal colours */
  --red: #d92d20;
  --red-deep: #9f1d14;
  --red-wash: #fdecea;
  --amber: #e08a1e;
  --amber-wash: #fbeed9;

  /* Relationship accents */
  --acc-forest: #0b3d2e;
  --acc-green: #17794a;
  --acc-gold: #b98f2f;
  --acc-teal: #1f7a7a;
  --acc-plum: #7a4390;
  --acc-slate: #566373;

  --radius: 18px;
  --radius-sm: 12px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(12, 40, 28, 0.06), 0 1px 1px rgba(12, 40, 28, 0.04);
  --shadow-md: 0 6px 20px -8px rgba(12, 40, 28, 0.18), 0 2px 6px rgba(12, 40, 28, 0.06);
  --shadow-lg: 0 24px 60px -20px rgba(12, 40, 28, 0.28);

  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-ui: "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --nav-h: 68px;
  --rail-w: 232px;
  --content-max: 620px;

  color-scheme: light;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 560;
  font-optical-sizing: auto;
  line-height: 1.12;
  letter-spacing: -0.01em;
  margin: 0 0 0.4em;
  color: var(--forest);
}

p { margin: 0 0 1em; }
a { color: var(--green-700); text-underline-offset: 3px; }
a:hover { color: var(--forest); }

img { max-width: 100%; display: block; }

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
  border-radius: 6px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--forest);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 10px 0;
  z-index: 200;
}
.skip-link:focus { left: 0; }

/* --------------------------------------------------------------------------
   Layout shell
   ------------------------------------------------------------------------ */

.app-shell { min-height: 100dvh; display: flex; flex-direction: column; }

.appbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px clamp(16px, 4vw, 28px);
  min-height: 60px;
  background: var(--forest);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.appbar a { color: #fff; }
.appbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.appbar__brand .mark { width: 30px; height: 30px; }
.appbar__spacer { flex: 1; }
.appbar__meta { font-size: 0.82rem; opacity: 0.8; }

/* Crisis mode recolours the frame */
body.crisis-mode .appbar { background: var(--red-deep); }
body.crisis-mode .rail__link.is-active { color: var(--red-deep); }
body.crisis-mode .rail__link.is-active::before { background: var(--red); }

.crisis-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px clamp(16px, 4vw, 28px);
  background: var(--red);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  position: sticky;
  top: 60px;
  z-index: 39;
}
.crisis-strip a { color: #fff; text-decoration: underline; margin-left: auto; font-weight: 700; }
.crisis-strip .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 0 0 rgba(255,255,255,0.7);
  animation: ping 1.8s ease-out infinite;
}

.app-body {
  flex: 1;
  display: flex;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
}

/* Desktop rail */
.rail {
  display: none;
  flex-direction: column;
  gap: 4px;
  width: var(--rail-w);
  flex-shrink: 0;
  padding: 26px 16px;
  border-right: 1px solid var(--line);
}
.rail__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  text-decoration: none;
  font-weight: 550;
  position: relative;
}
.rail__link svg { width: 22px; height: 22px; flex-shrink: 0; }
.rail__link:hover { background: var(--mint); color: var(--forest); }
.rail__link.is-active { color: var(--forest); background: var(--mint); }
.rail__link.is-active::before {
  content: "";
  position: absolute;
  left: -16px; top: 8px; bottom: 8px;
  width: 4px; border-radius: 0 4px 4px 0;
  background: var(--green);
}
.rail__spacer { flex: 1; }
.rail__foot { padding: 12px 14px; font-size: 0.8rem; color: var(--faint); }

/* Rail: primary "Activate crisis" action, sits above the section links */
.rail__cta {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin: 0 0 14px;
  padding: 13px 16px;
  border-radius: var(--radius-pill);
  background: var(--red);
  color: #fff;
  font-weight: 650;
  font-size: 0.95rem;
  text-decoration: none;
  box-shadow: 0 8px 18px -8px rgba(217, 45, 32, 0.55);
}
.rail__cta:hover { background: var(--red-deep); color: #fff; }
.rail__cta svg { width: 19px; height: 19px; }
.rail__cta.is-active-crisis::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  animation: pulse-ring 2.2s ease-out infinite;
}

.content {
  flex: 1;
  width: 100%;
  padding: clamp(18px, 4vw, 36px) clamp(16px, 4vw, 32px) calc(var(--nav-h) + 48px);
}
.content--narrow { max-width: var(--content-max); margin: 0 auto; }

@media (min-width: 960px) {
  .rail { display: flex; }
  .content { padding-bottom: 48px; }
  .tabbar { display: none; }
  .crisis-strip { top: 60px; }
}

/* Mobile bottom tab bar */
.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 45;
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
  overflow: visible;
}
.tabbar__link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 8px;
  min-width: 56px;
  color: var(--faint);
  text-decoration: none;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.tabbar__link svg { width: 24px; height: 24px; }
.tabbar__link.is-active { color: var(--forest); }
body.crisis-mode .tabbar__link.is-active { color: var(--red-deep); }

/* Raised centre action — activate a crisis from any screen */
.tabbar__action {
  position: relative;
  min-width: 62px;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding: 4px 8px;
}
.tabbar__action-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--red-deep);
}
.tabbar__fab {
  position: absolute;
  left: 50%;
  top: -28px;
  transform: translateX(-50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  display: grid;
  place-items: center;
  text-decoration: none;
  box-shadow: 0 6px 16px -4px rgba(217, 45, 32, 0.5), 0 0 0 6px var(--paper);
  transition: transform 0.08s ease, background 0.15s ease;
}
.tabbar__fab:active { transform: translateX(-50%) translateY(1px); }
.tabbar__fab:hover { background: var(--red-deep); }
.tabbar__fab svg { width: 26px; height: 26px; }
.tabbar__fab.is-active-crisis::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  animation: pulse-ring 2.2s ease-out infinite;
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(217, 45, 32, 0.5); }
  70% { box-shadow: 0 0 0 16px rgba(217, 45, 32, 0); }
  100% { box-shadow: 0 0 0 0 rgba(217, 45, 32, 0); }
}

/* --------------------------------------------------------------------------
   Typography helpers
   ------------------------------------------------------------------------ */

.eyebrow {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green);
  margin: 0 0 10px;
}
.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: clamp(1.7rem, 5vw, 2.3rem); }
.page-head p { color: var(--muted); margin: 0; }
.section-title { font-size: 1.15rem; margin: 0 0 12px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.center { text-align: center; }

/* --------------------------------------------------------------------------
   Cards
   ------------------------------------------------------------------------ */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(18px, 4vw, 26px);
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 16px; }
.card__title {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  color: var(--ink);
  margin: 0 0 14px;
}
.stack > * + * { margin-top: 16px; }
.grid-2 { display: grid; gap: 14px; }
@media (min-width: 560px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* --------------------------------------------------------------------------
   Buttons
   ------------------------------------------------------------------------ */

.btn {
  --btn-bg: var(--green);
  --btn-fg: #fff;
  appearance: none;
  border: 1px solid transparent;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 650;
  line-height: 1;
  padding: 14px 22px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.06s ease, box-shadow 0.15s ease, background 0.15s ease;
  min-height: 48px;
}
.btn:hover { background: var(--green-700); }
.btn:active { transform: translateY(1px); }
.btn--block { width: 100%; }
.btn--lg { padding: 17px 26px; font-size: 1.05rem; }
.btn--forest { --btn-bg: var(--forest); }
.btn--forest:hover { background: var(--forest-ink); }
.btn--gold { --btn-bg: var(--gold); --btn-fg: var(--forest-ink); }
.btn--gold:hover { background: #caa049; }
.btn--danger { --btn-bg: var(--red); }
.btn--danger:hover { background: var(--red-deep); }
.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--forest);
  border-color: var(--line-strong);
}
.btn--ghost:hover { background: var(--mint); }
.btn--sm { min-height: 40px; padding: 10px 16px; font-size: 0.9rem; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }

.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }
.btn-row--split { justify-content: space-between; }

/* --------------------------------------------------------------------------
   Forms
   ------------------------------------------------------------------------ */

.field { margin-bottom: 16px; }
.field__label {
  display: block;
  font-size: 0.85rem;
  font-weight: 650;
  color: var(--ink);
  margin-bottom: 6px;
}
.field__label .opt { color: var(--faint); font-weight: 500; }
.field > input:not([type="checkbox"]):not([type="radio"]),
.field > select,
.field > textarea,
.field__input {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.field__input::placeholder { color: var(--faint); }
.field__input:focus,
.field > input:focus,
.field > select:focus,
.field > textarea:focus {
  outline: none;
  border-color: var(--green);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(23, 121, 74, 0.12);
}
textarea.field__input { resize: vertical; min-height: 84px; }
.field__hint { font-size: 0.8rem; color: var(--muted); margin-top: 6px; }
.field__hint ul { margin: 4px 0 0; padding-left: 18px; }
.field__hint li { margin: 1px 0; }
.field__error { font-size: 0.82rem; color: var(--red-deep); margin-top: 6px; font-weight: 600; }
.field--check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--mint);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.field--check input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--green); }
.field--check label { font-size: 0.9rem; font-weight: 550; }

.form-error-summary {
  background: var(--red-wash);
  border: 1px solid #f4c4bf;
  color: var(--red-deep);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.9rem;
  margin-bottom: 16px;
}

/* Severity segmented control */
.severity { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.severity label {
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  text-align: center;
  font-weight: 650;
  cursor: pointer;
  transition: all 0.12s ease;
  color: var(--muted);
}
.severity input { position: absolute; opacity: 0; pointer-events: none; }
.severity label:hover { border-color: var(--faint); }
.severity input:focus-visible + label { outline: 3px solid var(--gold); outline-offset: 2px; }
.severity input[value="low"]:checked + label {
  border-color: var(--green); background: var(--mint); color: var(--green-700);
}
.severity input[value="medium"]:checked + label {
  border-color: var(--amber); background: var(--amber-wash); color: #8a5410;
}
.severity input[value="high"]:checked + label {
  border-color: var(--red); background: var(--red-wash); color: var(--red-deep);
}

/* --------------------------------------------------------------------------
   Messages / toasts
   ------------------------------------------------------------------------ */

.flash-stack {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  top: 14px;
  z-index: 120;
  width: min(92vw, 460px);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.flash {
  background: var(--forest);
  color: #fff;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 0.92rem;
  font-weight: 550;
  box-shadow: var(--shadow-lg);
  animation: fade-up 0.25s ease both;
}
.flash--success { background: var(--green-700); }
.flash--error { background: var(--red-deep); }
.flash--info { background: var(--forest); }

/* --------------------------------------------------------------------------
   Status band (dashboard signature)
   ------------------------------------------------------------------------ */

.status-band {
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  gap: 16px;
  align-items: center;
  border: 1px solid var(--line);
  background:
    radial-gradient(120% 140% at 0% 0%, var(--mint) 0%, transparent 60%),
    var(--card);
  box-shadow: var(--shadow-sm);
}
.status-band__icon {
  width: 52px; height: 52px; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--mint-deep);
  color: var(--green-700);
}
.status-band__icon svg { width: 28px; height: 28px; }
.status-band h2 { font-size: 1.2rem; margin: 0; }
.status-band p { margin: 2px 0 0; color: var(--muted); font-size: 0.92rem; }
.status-band--calm .status-band__icon { animation: breathe 4s ease-in-out infinite; }
.status-band--alert {
  background:
    radial-gradient(120% 140% at 0% 0%, var(--red-wash) 0%, transparent 62%),
    var(--card);
  border-color: #f1c9c4;
}
.status-band--alert .status-band__icon { background: var(--red-wash); color: var(--red-deep); }
.status-band--alert h2 { color: var(--red-deep); }

/* --------------------------------------------------------------------------
   Circle constellation (signature)
   ------------------------------------------------------------------------ */

.constellation {
  position: relative;
  width: min(320px, 82vw);
  aspect-ratio: 1;
  margin: 8px auto 4px;
}
.constellation__ring {
  position: absolute;
  inset: 12%;
  border: 1.5px dashed var(--line-strong);
  border-radius: 50%;
}
.constellation__center,
.constellation__node {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}
.constellation__center {
  width: 30%; aspect-ratio: 1;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--forest);
  color: #fff;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  text-align: center;
  line-height: 1.1;
  padding: 6px;
}
.constellation__node {
  width: 20%; aspect-ratio: 1;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--card);
  border: 2px solid var(--node, var(--acc-green));
  color: var(--node, var(--acc-green));
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: var(--shadow-sm);
}
.constellation--empty .constellation__center { background: var(--line-strong); color: var(--muted); }

.constellation__node:nth-child(3)  { top: 10%;   left: 50%; }
.constellation__node:nth-child(4)  { top: 15.9%; left: 78.3%; }
.constellation__node:nth-child(5)  { top: 50%;   left: 90%; }
.constellation__node:nth-child(6)  { top: 84.1%; left: 78.3%; }
.constellation__node:nth-child(7)  { top: 90%;   left: 50%; }
.constellation__node:nth-child(8)  { top: 84.1%; left: 21.7%; }
.constellation__node:nth-child(9)  { top: 50%;   left: 10%; }
.constellation__node:nth-child(10) { top: 15.9%; left: 21.7%; }

.node--forest { --node: var(--acc-forest); }
.node--green { --node: var(--acc-green); }
.node--gold { --node: var(--acc-gold); }
.node--teal { --node: var(--acc-teal); }
.node--plum { --node: var(--acc-plum); }
.node--slate { --node: var(--acc-slate); }

/* --------------------------------------------------------------------------
   Stat tiles / quick links
   ------------------------------------------------------------------------ */

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tile:hover { border-color: var(--green); box-shadow: var(--shadow-md); }
.tile__num { font-family: var(--font-display); font-size: 1.9rem; color: var(--forest); line-height: 1; }
.tile__label { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.tile__icon { color: var(--green); }
.tile__icon svg { width: 22px; height: 22px; }

.link-list { display: flex; flex-direction: column; gap: 10px; }
.link-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.link-row:hover { border-color: var(--green); }
.link-row__icon {
  width: 40px; height: 40px; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--mint);
  color: var(--green-700);
}
.link-row__icon svg { width: 21px; height: 21px; }
.link-row__body { flex: 1; }
.link-row__body strong { display: block; font-size: 0.98rem; }
.link-row__body span { font-size: 0.85rem; color: var(--muted); }
.link-row__chev { color: var(--faint); }

/* --------------------------------------------------------------------------
   Member cards
   ------------------------------------------------------------------------ */

.member-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.member-card + .member-card { margin-top: 12px; }
.avatar {
  width: 46px; height: 46px; flex-shrink: 0;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 0.95rem;
  background: var(--mint);
  color: var(--acc-forest);
  border: 2px solid var(--avatar, var(--acc-green));
  color: var(--avatar, var(--acc-green));
}
.avatar--forest { --avatar: var(--acc-forest); }
.avatar--green { --avatar: var(--acc-green); }
.avatar--gold { --avatar: var(--acc-gold); }
.avatar--teal { --avatar: var(--acc-teal); }
.avatar--plum { --avatar: var(--acc-plum); }
.avatar--slate { --avatar: var(--acc-slate); }
.member-card__body { flex: 1; min-width: 0; }
.member-card__name { font-weight: 700; font-size: 1rem; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.member-card__contact { font-size: 0.88rem; color: var(--muted); margin-top: 4px; }
.member-card__contact a { color: var(--muted); text-decoration: none; }
.member-card__contact div { display: flex; align-items: center; gap: 7px; }
.member-card__contact svg { width: 15px; height: 15px; opacity: 0.7; }
.member-card__actions { display: flex; gap: 6px; flex-shrink: 0; }
.icon-btn {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 10px;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  cursor: pointer;
  color: var(--muted);
}
.icon-btn:hover { color: var(--forest); border-color: var(--line-strong); }
.icon-btn--danger:hover { color: var(--red-deep); border-color: #f0c4bf; background: var(--red-wash); }
.icon-btn svg { width: 17px; height: 17px; }

/* Chips / badges */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: var(--mint);
  color: var(--green-700);
}
.chip--forest { background: rgba(11,61,46,0.1); color: var(--acc-forest); }
.chip--green { background: rgba(23,121,74,0.12); color: var(--acc-green); }
.chip--gold { background: var(--gold-soft); color: var(--acc-gold); }
.chip--teal { background: rgba(31,122,122,0.12); color: var(--acc-teal); }
.chip--plum { background: rgba(122,67,144,0.12); color: var(--acc-plum); }
.chip--slate { background: rgba(86,99,115,0.12); color: var(--acc-slate); }
.chip--coord { background: var(--gold-soft); color: #7a5a12; }
.chip--low { background: var(--mint); color: var(--green-700); }
.chip--medium { background: var(--amber-wash); color: #8a5410; }
.chip--high { background: var(--red-wash); color: var(--red-deep); }

/* --------------------------------------------------------------------------
   Empty states
   ------------------------------------------------------------------------ */

.empty {
  text-align: center;
  padding: 44px 20px;
  color: var(--muted);
}
.empty__icon {
  width: 56px; height: 56px;
  margin: 0 auto 14px;
  color: var(--line-strong);
}
.empty h3 { color: var(--ink); font-family: var(--font-ui); font-size: 1.05rem; margin-bottom: 4px; }

/* --------------------------------------------------------------------------
   Crisis detail
   ------------------------------------------------------------------------ */

.progress {
  height: 8px;
  border-radius: 99px;
  background: var(--mint-deep);
  overflow: hidden;
}
.progress__bar { height: 100%; background: var(--green); border-radius: 99px; transition: width 0.3s ease; }

.task {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.task:last-child { border-bottom: 0; }
.task__toggle {
  flex-shrink: 0;
  width: 26px; height: 26px;
  border-radius: 8px;
  border: 2px solid var(--line-strong);
  background: var(--card);
  display: grid; place-items: center;
  cursor: pointer;
  color: transparent;
}
.task__toggle[data-state="in_progress"] { border-color: var(--amber); color: var(--amber); }
.task__toggle[data-state="done"] { border-color: var(--green); background: var(--green); color: #fff; }
.task__toggle svg { width: 15px; height: 15px; }
.task__body { flex: 1; min-width: 0; }
.task__desc { font-weight: 550; }
.task[data-done="true"] .task__desc { text-decoration: line-through; color: var(--faint); }
.task__meta { font-size: 0.8rem; color: var(--muted); margin-top: 2px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  position: relative;
  padding: 0 0 16px 22px;
  border-left: 2px solid var(--line);
}
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -7px; top: 3px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid var(--paper);
}
.timeline li[data-kind="system"]::before { background: var(--gold); }
.timeline__meta { font-size: 0.78rem; color: var(--faint); }
.timeline__msg { font-size: 0.92rem; }
.timeline__msg strong { color: var(--forest); }

.reply-bar { display: flex; gap: 8px; margin-top: 14px; align-items: stretch; }
.reply-bar .field { flex: 1; margin: 0; }
.reply-bar .field__label, .reply-bar .field__hint { display: none; }
.reply-bar .btn { flex-shrink: 0; border-radius: var(--radius-sm); }

/* --------------------------------------------------------------------------
   Auth + marketing
   ------------------------------------------------------------------------ */

.auth-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 32px 18px calc(32px + env(safe-area-inset-bottom));
  background:
    radial-gradient(80% 60% at 50% 0%, var(--mint) 0%, transparent 70%),
    var(--paper);
}
.auth-card {
  width: min(440px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: clamp(24px, 6vw, 38px);
  box-shadow: var(--shadow-lg);
}
.auth-card__brand {
  display: flex; align-items: center; gap: 10px;
  justify-content: center;
  margin-bottom: 18px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--forest);
}
.auth-card__brand .mark { width: 34px; height: 34px; }
.auth-card h1 { text-align: center; font-size: 1.5rem; }
.auth-card__sub { text-align: center; color: var(--muted); font-size: 0.92rem; margin-bottom: 22px; }
.auth-alt { text-align: center; margin-top: 18px; font-size: 0.9rem; color: var(--muted); }

/* Landing */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(251, 252, 250, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header__inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px clamp(16px, 4vw, 28px);
}
.site-header__brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-weight: 600; font-size: 1.15rem;
  color: var(--forest); text-decoration: none;
}
.site-header__brand .mark { width: 32px; height: 32px; }
.site-header__nav { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.landing { overflow-x: hidden; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 28px); }
.section { padding: clamp(52px, 9vw, 96px) 0; }
.section--mint { background: linear-gradient(180deg, var(--mint) 0%, var(--paper) 100%); }
.section--forest { background: var(--forest); color: #fff; }
.section--forest h2, .section--forest h3 { color: #fff; }
.section--forest p { color: rgba(255,255,255,0.82); }

.hero { text-align: center; padding: clamp(48px, 10vw, 104px) 0 clamp(40px, 8vw, 80px); }
.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--mint-deep);
  color: var(--green-700);
  font-weight: 650;
  font-size: 0.85rem;
  padding: 7px 16px;
  border-radius: var(--radius-pill);
  margin-bottom: 22px;
}
.hero h1 {
  font-size: clamp(2.6rem, 8vw, 4.6rem);
  line-height: 1.02;
  letter-spacing: -0.025em;
  max-width: 14ch;
  margin: 0 auto 0.35em;
}
.hero h1 em { font-style: italic; color: var(--green); }
.hero__lede {
  font-size: clamp(1.05rem, 2.5vw, 1.3rem);
  color: var(--muted);
  max-width: 44ch;
  margin: 0 auto 30px;
}
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.hero__note { margin-top: 18px; font-size: 0.85rem; color: var(--faint); font-weight: 600; }

.steps { display: grid; gap: 18px; margin-top: 36px; }
@media (min-width: 720px) { .steps { grid-template-columns: repeat(4, 1fr); } }
.step {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.step__n {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--gold);
  display: inline-grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1.5px solid var(--gold-soft);
  margin-bottom: 14px;
}
.step h3 { font-family: var(--font-ui); font-size: 1rem; margin-bottom: 6px; }
.step p { font-size: 0.9rem; color: var(--muted); margin: 0; }

/* Crisis story section: condensed crisis-examples + resolution story */
.cs-type-strip {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin: 0 auto 56px;
  max-width: 920px;
}
.cs-type { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.cs-type__photo {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2.5px solid var(--line-strong);
  box-shadow: var(--shadow-sm);
  background-size: cover;
  background-position: center;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.cs-type:hover .cs-type__photo { border-color: var(--gold); transform: translateY(-2px); }
.cs-type__label { font-size: 0.74rem; font-weight: 650; color: var(--muted); line-height: 1.25; }
@media (max-width: 640px) { .cs-type-strip { grid-template-columns: repeat(3, 1fr); row-gap: 22px; } }

.cs-story-panel {
  background: var(--forest);
  color: #fff;
  border-radius: 28px;
  padding: clamp(28px, 5vw, 52px);
  overflow: hidden;
  position: relative;
}
.cs-story-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 90% at 100% 0%, rgba(216, 178, 92, 0.14), transparent 60%);
  pointer-events: none;
}
.cs-story-grid { display: grid; gap: 40px; align-items: center; position: relative; }
@media (min-width: 900px) { .cs-story-grid { grid-template-columns: 0.95fr 1.05fr; } }

.cs-story-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 12px;
}
.cs-story-copy h3 { color: #fff; font-size: clamp(1.4rem, 3vw, 1.85rem); max-width: 16ch; margin-bottom: 14px; }

.cs-alert-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 22px;
}
.cs-alert-card__dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--red);
  flex-shrink: 0;
  margin-top: 7px;
  box-shadow: 0 0 0 4px rgba(217, 45, 32, 0.25);
}
.cs-alert-card__body { font-size: 0.92rem; color: rgba(255, 255, 255, 0.92); }
.cs-alert-card__body b { color: #fff; }

.cs-mini-timeline { list-style: none; margin: 0 0 26px; padding: 0; }
.cs-mini-timeline li {
  position: relative;
  padding: 0 0 18px 26px;
  border-left: 2px solid rgba(255, 255, 255, 0.18);
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.82);
}
.cs-mini-timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.cs-mini-timeline li::before {
  content: "";
  position: absolute;
  left: -7px; top: 2px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid var(--forest);
}
.cs-mini-timeline b { color: #fff; font-weight: 650; }

.cs-constellation-wrap { position: relative; }
.cs-constellation { position: relative; width: min(340px, 78vw); aspect-ratio: 1; margin: 0 auto 22px; }
.cs-constellation__ring {
  position: absolute;
  inset: 15%;
  border: 1.5px dashed rgba(255, 255, 255, 0.28);
  border-radius: 50%;
}
.cs-node {
  position: absolute;
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.5);
}
.cs-node--alice { width: 34%; top: 50%; left: 50%; transform: translate(-50%, -50%); border: 3px solid var(--gold); }
.cs-node--grace { width: 26%; top: 4%; left: 50%; transform: translate(-50%, 0); border: 3px solid var(--acc-teal); }
.cs-node--sue { width: 22%; top: 60%; left: 12%; border: 3px solid var(--amber); }
.cs-node--bob { width: 22%; top: 60%; left: 66%; border: 3px solid var(--acc-plum); }
.cs-tag {
  position: absolute;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.72rem;
  background: var(--forest-ink);
  color: #fff;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  white-space: nowrap;
}
.cs-tag--alice { top: 69%; left: 50%; transform: translate(-50%, 0); background: var(--gold); color: var(--forest-ink); }
.cs-tag--grace { top: 0; left: 50%; transform: translate(-50%, -130%); color: #bfe3ee; border-color: var(--acc-teal); }
.cs-tag--sue { top: 72%; left: 12%; transform: translate(-92%, -50%); color: #f4c98a; border-color: var(--amber); }
.cs-tag--bob { top: 72%; left: 88%; transform: translate(-8%, -50%); color: #dcc4f4; border-color: var(--acc-plum); }

.cs-legend {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px 18px;
  max-width: 420px;
  margin: 0 auto;
  padding: 0;
  font-size: 0.84rem;
  color: rgba(255, 255, 255, 0.86);
}
.cs-legend li { display: flex; gap: 9px; align-items: flex-start; list-style: none; }
.cs-legend__sw { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex-shrink: 0; }
.cs-legend__sw--grace { background: var(--acc-teal); }
.cs-legend__sw--sue { background: var(--amber); }
.cs-legend__sw--alice { background: var(--gold); }
.cs-legend__sw--bob { background: var(--acc-plum); }
.cs-legend b { color: #fff; display: block; font-size: 0.86rem; }
@media (max-width: 640px) { .cs-legend { grid-template-columns: 1fr; } }

.site-foot {
  border-top: 1px solid var(--line);
  padding: 28px 0;
  font-size: 0.85rem;
  color: var(--faint);
}
.site-foot__inner {
  max-width: 1120px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 28px);
  display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center;
}
.site-foot__inner .brand { display: flex; align-items: center; gap: 8px; color: var(--forest); font-family: var(--font-display); font-weight: 600; }
.site-foot__inner .brand .mark { width: 24px; height: 24px; }
.site-foot a { color: var(--muted); }

/* --------------------------------------------------------------------------
   Settings
   ------------------------------------------------------------------------ */

.contact-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.contact-row:last-child { border-bottom: 0; }
.contact-row__body { flex: 1; }
.contact-row__body strong { display: block; font-size: 0.95rem; }
.contact-row__body span { font-size: 0.85rem; color: var(--muted); }

/* --------------------------------------------------------------------------
   Animations
   ------------------------------------------------------------------------ */

@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}
@keyframes ping {
  0% { box-shadow: 0 0 0 0 rgba(255,255,255,0.6); }
  70% { box-shadow: 0 0 0 10px rgba(255,255,255,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
}

.reveal { animation: fade-up 0.4s ease both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
