:root {
  color-scheme: light;
  --ink: #17221c;
  --muted: #637169;
  --line: #dce5df;
  --paper: #ffffff;
  --fog: #f3f7f4;
  --forest: #183d2c;
  --green: #2f7d59;
  --green-bright: #51b982;
  --green-soft: #e8f5ed;
  --gold: #d49c3f;
  --gold-soft: #fff4dc;
  --danger: #a43b36;
  --danger-soft: #fff0ed;
  --shadow: 0 18px 50px rgba(21, 53, 38, 0.09);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--fog);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--green); font-weight: 750; }
.hidden { display: none !important; }
.eyebrow {
  margin: 0 0 7px;
  color: var(--green);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .13em;
  text-transform: uppercase;
}
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 12px; font-size: clamp(34px, 5vw, 58px); line-height: 1.04; letter-spacing: -.045em; }
h2 { margin-bottom: 8px; font-size: clamp(26px, 3.3vw, 38px); line-height: 1.12; letter-spacing: -.035em; }
h3 { margin-bottom: 6px; font-size: 21px; line-height: 1.2; letter-spacing: -.02em; }

.portal-logo { display: inline-flex; width: 168px; }
.portal-logo img { display: block; width: 100%; height: auto; }
.portal-logo-small { width: 124px; }

.portal-login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 18px;
  background:
    radial-gradient(circle at 12% 12%, rgba(81, 185, 130, .22), transparent 34%),
    radial-gradient(circle at 88% 86%, rgba(212, 156, 63, .14), transparent 30%),
    var(--forest);
}
.portal-login-card {
  width: min(490px, 100%);
  padding: clamp(28px, 6vw, 52px);
  border-radius: 28px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 28px 90px rgba(0, 0, 0, .24);
}
.portal-login-card .portal-logo { margin-bottom: 34px; }
.portal-login-card h1 { font-size: clamp(38px, 9vw, 57px); }
.login-intro { margin-bottom: 28px; color: var(--muted); font-size: 16px; }
.support-note { margin: 26px 0 0; color: var(--muted); font-size: 13px; text-align: center; }

.portal-form { display: grid; gap: 13px; }
.portal-form label, .profile-card label, .dialog-card label {
  display: grid;
  gap: 7px;
  color: #425048;
  font-size: 13px;
  font-weight: 760;
}
input, select, textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid #cfdad3;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  padding: 11px 13px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea { min-height: 122px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 4px rgba(47, 125, 89, .12); }
input:disabled { color: #58665e; background: #f1f4f2; }

.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 820;
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease, border-color .15s ease, opacity .15s ease;
}
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .6; transform: none; }
.button-primary { background: var(--green); color: #fff; box-shadow: 0 8px 20px rgba(47, 125, 89, .2); }
.button-primary:hover { background: #276a4b; }
.button-secondary { border-color: #bed0c5; background: #fff; color: var(--forest); }
.button-secondary:hover { border-color: var(--green); background: var(--green-soft); }
.button-quiet { border-color: var(--line); background: transparent; color: var(--muted); }
.button-text { min-height: 34px; background: transparent; color: var(--green); padding: 5px 10px; }
.button-inline { min-height: 42px; flex: 0 0 auto; border-radius: 10px; background: var(--forest); color: #fff; }
.button-inverse { background: #fff; color: var(--forest); }
.button-danger { background: var(--danger); color: #fff; }
.button-danger:hover { background: #8f312d; }

.form-message { min-height: 20px; margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.form-message.is-error { color: var(--danger); }
.form-message.is-success { color: var(--green); }
.form-message-light { color: rgba(255,255,255,.82); }
.form-message-light.is-error { color: #ffe4de; }

.portal-header {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 76px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid rgba(220, 229, 223, .9);
  padding: 14px max(22px, calc((100vw - 1180px) / 2));
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(16px);
}
.portal-header nav { display: flex; gap: 26px; }
.portal-header nav a { color: var(--muted); font-size: 14px; text-decoration: none; }
.portal-header nav a:hover { color: var(--green); }
.portal-header .button { justify-self: end; }

.portal-main { width: min(1180px, calc(100% - 36px)); margin: 0 auto; padding: 34px 0 70px; }
.portal-main > section { scroll-margin-top: 100px; margin-top: 70px; }
.portal-main > .welcome-card { margin-top: 0; }
.welcome-card {
  min-height: 260px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  overflow: hidden;
  position: relative;
  border-radius: 30px;
  padding: clamp(30px, 6vw, 64px);
  background:
    radial-gradient(circle at 86% 10%, rgba(81, 185, 130, .45), transparent 28%),
    linear-gradient(135deg, #173c2b, #245b40);
  color: #fff;
  box-shadow: var(--shadow);
}
.welcome-card::after {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  right: -75px;
  bottom: -100px;
  border: 26px solid rgba(255,255,255,.08);
  border-radius: 50%;
}
.welcome-card > * { position: relative; z-index: 1; }
.welcome-card h1 { margin-bottom: 8px; }
.welcome-card p:not(.eyebrow) { max-width: 610px; margin-bottom: 0; color: rgba(255,255,255,.78); }
.welcome-card .eyebrow { color: #8ee0b3; }
.plan-badge {
  flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 18px;
  padding: 14px 18px;
  background: rgba(255,255,255,.1);
  font-size: 14px;
  font-weight: 820;
  text-align: center;
  backdrop-filter: blur(8px);
}
.plan-badge strong { display: block; font-size: 26px; line-height: 1.15; }

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.section-heading h2, .section-heading p { margin-bottom: 0; }
.section-heading-profile > p { max-width: 390px; color: var(--muted); }
.metric-grid { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: 16px; }
.metric-card, .content-card, .profile-card, .help-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 0 9px 30px rgba(23, 61, 43, .05);
}
.metric-card { min-height: 190px; padding: 26px; }
.metric-streak { display: flex; align-items: center; gap: 24px; background: linear-gradient(140deg, #f5fff8, #e6f5eb); }
.streak-orbit {
  width: 112px;
  height: 112px;
  flex: 0 0 112px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--green-bright) 0 78%, rgba(81,185,130,.14) 78% 100%);
  box-shadow: inset 0 0 0 12px #f1faf4;
}
.streak-orbit span { font-size: 40px; font-weight: 900; letter-spacing: -.05em; }
.metric-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; background: var(--green-soft); color: var(--green); font-size: 22px; font-weight: 900; }
.metric-icon-gold { background: var(--gold-soft); color: var(--gold); }
.metric-value { margin: 18px 0 0; font-size: 42px; font-weight: 900; line-height: 1; letter-spacing: -.05em; }
.metric-label { margin: 9px 0 1px; color: #39473f; font-weight: 820; }
.metric-copy { margin: 2px 0; }
.metric-detail { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.recap-card { margin-top: 16px; overflow: hidden; border-radius: 28px; padding: clamp(28px, 5vw, 52px); background: #fff; box-shadow: var(--shadow); }
.recap-heading { display: flex; justify-content: space-between; align-items: start; gap: 20px; }
.ai-badge { border-radius: 999px; padding: 7px 11px; background: #f0edff; color: #6253a5; font-size: 11px; font-weight: 850; text-transform: uppercase; letter-spacing: .08em; }
.recap-loading { display: flex; align-items: center; gap: 5px; min-height: 120px; color: var(--muted); }
.loading-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); animation: pulse 1.1s infinite ease-in-out; }
.loading-dot:nth-child(2) { animation-delay: .14s; }
.loading-dot:nth-child(3) { margin-right: 6px; animation-delay: .28s; }
@keyframes pulse { 0%, 100% { opacity: .25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }
.recap-summary { max-width: 900px; color: #334139; font-size: 17px; line-height: 1.75; white-space: pre-line; }
.highlight-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 30px 0; padding: 0; list-style: none; }
.highlight-list li { position: relative; border-radius: 15px; padding: 16px 16px 16px 42px; background: var(--green-soft); color: #264c38; font-size: 14px; font-weight: 700; }
.highlight-list li::before { content: "✓"; position: absolute; left: 17px; color: var(--green); font-weight: 900; }
.next-focus { border-left: 4px solid var(--gold); padding: 4px 0 4px 18px; }
.next-focus span { color: var(--gold); font-size: 11px; font-weight: 850; text-transform: uppercase; letter-spacing: .1em; }
.next-focus p { margin: 3px 0 0; font-weight: 750; }
.recap-generated { margin: 20px 0 0; color: #8a958f; font-size: 11px; }

.account-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.content-card { padding: 28px; }
.card-title-row { display: flex; align-items: start; justify-content: space-between; gap: 15px; }
.card-kicker { margin: 0 0 5px; color: var(--muted); font-size: 11px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.card-description { min-height: 48px; color: var(--muted); }
.status-pill { border-radius: 999px; padding: 6px 10px; background: var(--green-soft); color: var(--green); font-size: 11px; font-weight: 850; white-space: nowrap; }
.status-pill-neutral { background: #eef1ef; color: #617067; }
.detail-list { margin: 22px 0; }
.detail-list div { display: flex; justify-content: space-between; gap: 15px; border-top: 1px solid var(--line); padding: 11px 0; }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; font-weight: 760; text-align: right; }

.profile-card { display: grid; gap: 34px; padding: clamp(24px, 5vw, 46px); }
.profile-card fieldset { display: grid; gap: 18px; border: 0; border-top: 1px solid var(--line); margin: 0; padding: 28px 0 0; }
.profile-card fieldset:first-child { border-top: 0; padding-top: 0; }
.profile-card legend { padding: 0 20px 0 0; color: var(--forest); font-size: 18px; font-weight: 850; }
.field-grid { display: grid; gap: 16px; }
.field-grid-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-grid-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.phone-edit-row { display: flex; gap: 7px; }
.field-help { margin: -8px 0 0; color: var(--muted); font-size: 13px; }
.group-label { display: block; margin-bottom: 8px; color: #425048; font-size: 13px; font-weight: 760; }
.day-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.day-picker label { display: block; cursor: pointer; }
.day-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.day-picker span { min-width: 52px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 999px; padding: 8px 11px; background: #fff; color: var(--muted); font-size: 12px; }
.day-picker input:checked + span { border-color: var(--green); background: var(--green-soft); color: var(--green); font-weight: 820; }
.day-picker input:focus-visible + span { outline: 3px solid rgba(47, 125, 89, .18); }
.form-actions { display: flex; align-items: center; gap: 16px; }

.action-grid { display: grid; grid-template-columns: 1.45fr .8fr; gap: 16px; }
.invite-card { border-radius: 28px; padding: clamp(28px, 5vw, 46px); background: var(--forest); color: #fff; box-shadow: var(--shadow); }
.invite-card .eyebrow { color: #89dfb0; }
.invite-card > p:not(.eyebrow) { color: rgba(255,255,255,.72); }
.invite-card label { color: rgba(255,255,255,.82); }
.portal-form-inline { margin-top: 26px; }
.help-card { padding: 32px; }
.help-icon { width: 48px; height: 48px; display: grid; place-items: center; margin-bottom: 28px; border-radius: 50%; background: var(--gold-soft); color: var(--gold); font-size: 22px; font-weight: 900; }
.help-card > p:not(.eyebrow) { color: var(--muted); }
.consent-check { grid-template-columns: 20px 1fr !important; align-items: start; gap: 9px !important; font-weight: 600 !important; }
.consent-check input { width: 18px; min-height: 18px; margin: 2px 0 0; }
.consent-check-dark { color: var(--muted) !important; }

.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 30px; border: 1px solid #efcbc5; border-radius: 22px; padding: 26px 30px; background: var(--danger-soft); }
.danger-zone h2 { font-size: 22px; }
.danger-zone p { max-width: 740px; margin-bottom: 0; color: #795650; }
.eyebrow-danger { color: var(--danger); }
.portal-footer { min-height: 90px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); padding: 22px max(22px, calc((100vw - 1180px) / 2)); color: var(--muted); font-size: 13px; }

.portal-dialog { width: min(540px, calc(100% - 28px)); max-height: calc(100vh - 30px); overflow: auto; border: 0; border-radius: 24px; padding: 0; box-shadow: 0 28px 90px rgba(14, 35, 24, .28); }
.portal-dialog::backdrop { background: rgba(15, 34, 24, .62); backdrop-filter: blur(3px); }
.dialog-card { position: relative; display: grid; gap: 17px; padding: 34px; }
.dialog-card h2, .dialog-card p { margin-bottom: 0; }
.dialog-close { position: absolute; top: 15px; right: 17px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--fog); color: var(--muted); font-size: 24px; cursor: pointer; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 4px; }

@media (max-width: 860px) {
  .portal-header { grid-template-columns: 1fr auto; }
  .portal-header nav { display: none; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .metric-streak { grid-column: 1 / -1; }
  .highlight-list { grid-template-columns: 1fr; }
  .field-grid-three { grid-template-columns: 1fr 1fr; }
  .action-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .portal-header { min-height: 66px; padding: 11px 16px; }
  .portal-logo-small { width: 108px; }
  .portal-header .button { min-height: 38px; padding: 7px 13px; font-size: 12px; }
  .portal-main { width: min(100% - 24px, 1180px); padding-top: 16px; }
  .portal-main > section { margin-top: 52px; }
  .welcome-card { min-height: 330px; align-items: start; flex-direction: column; justify-content: space-between; border-radius: 22px; }
  .plan-badge { text-align: left; }
  .metric-grid, .account-grid, .field-grid-two, .field-grid-three { grid-template-columns: 1fr; }
  .metric-streak { grid-column: auto; flex-direction: column; align-items: start; }
  .section-heading, .section-heading-profile { align-items: start; flex-direction: column; }
  .content-card, .metric-card { border-radius: 18px; padding: 22px; }
  .recap-card { border-radius: 22px; padding: 26px 22px; }
  .recap-heading { align-items: start; flex-direction: column; }
  .profile-card { border-radius: 20px; }
  .form-actions, .danger-zone, .portal-footer { align-items: stretch; flex-direction: column; }
  .danger-zone .button { width: 100%; }
  .portal-footer { justify-content: center; text-align: center; }
  .dialog-card { padding: 30px 22px 24px; }
  .dialog-actions { flex-direction: column-reverse; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
