:root {
  --ink: #17211b;
  --muted: #667169;
  --paper: #f5f3ec;
  --surface: #fffdf8;
  --line: #deddd4;
  --green: #246b4b;
  --green-dark: #174b35;
  --lime: #d9f08d;
  --orange: #e97c46;
  --red: #ae4b46;
  --shadow: 0 18px 55px rgba(40, 53, 43, .08);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, Aptos, "Segoe UI", sans-serif;
  line-height: 1.5;
}
a { color: var(--green); text-decoration: none; }
a:hover { color: var(--green-dark); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.skip-link { position: fixed; left: -999px; top: 1rem; z-index: 20; }
.skip-link:focus { left: 1rem; background: white; padding: .7rem 1rem; }

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(23, 33, 27, .1);
  padding: 0 clamp(1rem, 4vw, 4rem);
  background: rgba(245, 243, 236, .92);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: inline-flex; align-items: center; gap: .65rem; color: var(--ink); font-family: Inter, Aptos, "Segoe UI", sans-serif; font-weight: 800; letter-spacing: -.03em; }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: white; background: var(--green); font: 800 1.05rem Inter, Aptos, "Segoe UI", sans-serif; transform: rotate(-3deg); }
.brand-mark-large { width: 52px; height: 52px; border-radius: 15px; font-size: 1.4rem; }
.nav { display: flex; align-items: center; gap: 1.5rem; }
.nav a, .nav-button { color: var(--ink); font-weight: 600; font-size: .94rem; }
.nav form { margin: 0; }
.nav-button { border: 0; background: transparent; padding: 0; }

.shell { width: min(1180px, calc(100% - 2rem)); margin: 0 auto; padding: 3.5rem 0 5rem; }
.shell-auth { min-height: 100vh; display: grid; place-items: center; padding: 2rem 0; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; margin-bottom: 2.25rem; }
.compact-header { max-width: 780px; margin-inline: auto; }
h1, h2, h3 { font-family: Inter, Aptos, "Segoe UI", sans-serif; letter-spacing: -.04em; line-height: 1.1; margin-top: 0; }
h1 { font-size: clamp(2.25rem, 5vw, 4.8rem); max-width: 850px; margin-bottom: .8rem; }
h2 { font-size: 1.45rem; margin-bottom: .5rem; }
h3 { font-size: 1.05rem; }
p { margin-top: 0; }
.eyebrow { color: var(--green); font-size: .75rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; margin-bottom: .8rem; }
.page-subtitle { color: var(--muted); max-width: 690px; font-size: 1.05rem; margin-bottom: 0; }
.muted { color: var(--muted); }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: .72rem 1.05rem; border: 1px solid transparent; border-radius: 12px; font-weight: 700; transition: .15s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { background: var(--green); color: white; box-shadow: 0 10px 25px rgba(36, 107, 75, .18); }
.button-primary:hover { background: var(--green-dark); color: white; }
.button-secondary { color: var(--green-dark); background: #e6efdf; }
.button-ghost { color: var(--ink); background: transparent; border-color: var(--line); }
.button-success { color: white; background: var(--green); }
.button-tiny { min-height: 32px; padding: .35rem .6rem; border-radius: 9px; font-size: .78rem; }
.button-wide { width: 100%; }
.button-group, .form-actions, .task-actions { display: flex; align-items: center; gap: .65rem; flex-wrap: wrap; }

.messages { display: grid; gap: .5rem; margin-bottom: 1.25rem; }
.message { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--green); padding: .8rem 1rem; border-radius: 10px; }
.message-error { border-left-color: var(--red); }

.panel, .goal-card, .metric-card, .auth-card { background: var(--surface); border: 1px solid rgba(23, 33, 27, .09); border-radius: 22px; box-shadow: var(--shadow); }
.panel { padding: clamp(1.25rem, 3vw, 2rem); }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.3rem; }
.panel-heading h2 { margin-bottom: 0; }
.panel-heading p { color: var(--muted); }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .8fr); gap: 1.25rem; }
.plan-grid { align-items: start; }

.next-action-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1.25rem;
  color: white;
  background: var(--green-dark);
  border-radius: 22px;
  padding: 1.35rem 1.5rem;
  margin-bottom: 1rem;
  box-shadow: 0 18px 45px rgba(23, 75, 53, .18);
}
.next-action-number { display: grid; place-items: center; width: 58px; height: 58px; border-radius: 17px; background: var(--lime); color: var(--green-dark); font-weight: 800; font-size: .72rem; text-transform: uppercase; }
.next-action-copy h2 { margin-bottom: .25rem; }
.next-action-copy p { color: rgba(255,255,255,.72); margin-bottom: 0; }
.next-action-copy .eyebrow { color: var(--lime); margin-bottom: .45rem; }
.next-action-card .button-primary { background: var(--lime); color: var(--green-dark); box-shadow: none; }
.onboarding-strip { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.2rem; margin-bottom: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.onboarding-strip p { margin-bottom: .2rem; }
.onboarding-strip ol { display: flex; gap: 1.2rem; list-style: none; margin: 0; padding: 0; }
.onboarding-strip li { display: flex; align-items: center; gap: .45rem; color: var(--muted); font-size: .82rem; font-weight: 700; }
.onboarding-strip li span { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; background: #ecece5; color: var(--ink); }
.onboarding-strip .step-done { color: var(--green); }
.onboarding-strip .step-done span { background: var(--green); color: white; }

.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.metric-card { padding: 1.35rem; display: grid; gap: .2rem; box-shadow: none; }
.metric-card strong { font: 750 1.55rem Inter, Aptos, "Segoe UI", sans-serif; letter-spacing: -.04em; }
.metric-card span:last-child { color: var(--muted); font-size: .84rem; }
.metric-label { color: var(--green); text-transform: uppercase; letter-spacing: .09em; font-weight: 800; font-size: .68rem; }
.metric-accent { background: var(--green); color: white; }
.metric-accent .metric-label, .metric-accent span:last-child { color: rgba(255,255,255,.72); }

.task-list { display: grid; }
.task-list.separated { border-top: 1px solid var(--line); }
.task-row { display: flex; align-items: center; gap: .85rem; min-height: 64px; border-bottom: 1px solid var(--line); }
.task-row:last-child { border-bottom: 0; }
.task-row-action { flex-wrap: wrap; }
.extra-activity-panel { margin-top: 1.25rem; }
.extra-activity-intro { max-width: 760px; }
.extra-activity-list { margin-bottom: 1rem; }
.quick-activity-form { display: grid; grid-template-columns: minmax(0, 1fr) 120px auto; gap: .65rem; align-items: center; padding-top: 1rem; border-top: 1px solid var(--line); }
.quick-activity-form input { width: 100%; min-height: 44px; padding: .7rem .8rem; border: 1px solid var(--line); border-radius: 11px; background: white; color: var(--ink); }
.steps-metric-card { color: var(--ink); }
.steps-metric-card:hover { color: var(--ink); }
.steps-metric-card strong small { color: var(--muted); font-size: .7em; }
.mini-progress { display: block; height: 7px; overflow: hidden; border-radius: 999px; background: #dfe5db; }
.mini-progress i { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.health-header { margin-inline: 0; }
.step-hero { display: grid; grid-template-columns: auto minmax(180px, 1fr) auto; align-items: center; gap: 1.5rem; margin-bottom: 1.25rem; }
.step-hero-value { display: grid; }
.step-hero-value strong { font-size: clamp(2.4rem, 6vw, 4.8rem); line-height: 1; letter-spacing: -.06em; }
.step-hero-value > span:last-child, .step-hero-meta span { color: var(--muted); }
.step-progress-large { height: 18px; overflow: hidden; border-radius: 999px; background: #dfe5db; }
.step-progress-large span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green), #78a85f); }
.step-hero-meta { display: grid; text-align: right; }
.step-hero-meta strong { font-size: 1.4rem; }
.goal-step-form { display: grid; gap: .7rem; }
.goal-step-form input { width: 100%; min-height: 44px; padding: .7rem .8rem; border: 1px solid var(--line); border-radius: 11px; background: white; }
.automation-callout { display: grid; gap: .25rem; margin: 1rem 0; padding: 1rem; border-radius: 14px; background: #eef3e8; }
.automation-callout span { color: var(--muted); }
.recent-steps { display: grid; gap: .55rem; margin-top: 1.5rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.recent-steps > div { display: flex; justify-content: space-between; gap: 1rem; }
.task-copy { min-width: 0; flex: 1; display: grid; }
.task-copy strong { overflow-wrap: anywhere; }
.task-copy span { color: var(--muted); font-size: .83rem; }
.status-dot { width: 10px; height: 10px; flex: 0 0 10px; border-radius: 50%; background: #adb4ae; box-shadow: 0 0 0 4px #eef0ea; }
.status-in_progress { background: var(--orange); box-shadow: 0 0 0 4px #fbe8de; }
.status-completed { background: var(--green); box-shadow: 0 0 0 4px #e3efe6; }
.status-postponed { background: #92754d; box-shadow: 0 0 0 4px #f1e9da; }
.status-cancelled { background: var(--red); box-shadow: 0 0 0 4px #f5e3e1; }
.status-pill { display: inline-flex; width: fit-content; color: var(--muted); background: #eeeee8; border-radius: 999px; padding: .27rem .55rem; font-size: .71rem; font-weight: 700; white-space: nowrap; }

.empty-state { text-align: center; padding: 2.2rem 1rem; color: var(--muted); }
.empty-state h2, .empty-state h3 { color: var(--ink); }
.empty-state-small { padding: 1.2rem .5rem; }
.hero-empty { padding: 5rem 1rem; }
.empty-icon { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--lime); color: var(--green-dark); margin-bottom: 1rem; font-size: 1.35rem; }
.empty-inline { color: var(--muted); border-top: 1px solid var(--line); padding: 1.25rem 0 .25rem; }

.goal-mini-list, .available-list { display: grid; }
.goal-mini { display: flex; align-items: center; gap: .8rem; color: var(--ink); padding: .85rem 0; border-bottom: 1px solid var(--line); }
.goal-mini:last-child, .available-task:last-child { border-bottom: 0; }
.goal-mini > span:last-child { display: grid; }
.goal-mini small { color: var(--muted); }
.priority-number { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--lime); color: var(--green-dark); font-weight: 800; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.goal-card { padding: 1.5rem; color: var(--ink); min-height: 245px; display: flex; flex-direction: column; transition: .16s ease; }
.goal-card:hover { color: var(--ink); transform: translateY(-3px); box-shadow: 0 22px 60px rgba(40, 53, 43, .12); }
.goal-card-top, .goal-card footer { display: flex; justify-content: space-between; gap: 1rem; }
.goal-card h2 { font-size: 1.7rem; margin: 1.2rem 0 .6rem; }
.goal-card p { color: var(--muted); flex: 1; }
.goal-card footer { color: var(--muted); font-size: .78rem; border-top: 1px solid var(--line); padding-top: .9rem; }
.priority-label { color: var(--green); font-size: .75rem; font-weight: 700; }
.success-strip { background: var(--lime); color: var(--green-dark); border-radius: 16px; padding: 1rem 1.2rem; margin-bottom: 1.25rem; display: grid; gap: .2rem; }
.success-strip span { font-size: .66rem; font-weight: 800; letter-spacing: .1em; }
.project-stack { display: grid; gap: 1rem; }
.project-panel .panel-heading h2 { margin: .7rem 0 .4rem; }

.capacity-badge { background: #eef0ea; color: var(--muted); border-radius: 999px; padding: .35rem .65rem; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.capacity-warning { background: #fff0e8; border: 1px solid #f2c6ac; color: #8c4223; border-radius: 12px; padding: .8rem 1rem; margin-bottom: 1rem; }
.available-task { display: flex; align-items: center; gap: .75rem; padding: .85rem 0; border-bottom: 1px solid var(--line); }
.available-task > div { flex: 1; display: grid; }
.available-task span { color: var(--muted); font-size: .8rem; }
.icon-button { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 9px; background: transparent; color: var(--muted); font-size: 1.2rem; }
.icon-button-add { border: 0; background: var(--lime); color: var(--green-dark); font-weight: 800; }

.form-panel { max-width: 780px; margin: 0 auto; }
.form-stack { display: grid; gap: 1.1rem; }
.field { display: grid; gap: .42rem; }
.field label { font-weight: 700; font-size: .9rem; }
.field input, .field textarea, .field select { width: 100%; border: 1px solid #cfd2c9; border-radius: 11px; background: white; color: var(--ink); padding: .72rem .8rem; outline: 0; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(36, 107, 75, .1); }
.field small { color: var(--muted); }
.field-error { color: var(--red); font-size: .82rem; }
.checkbox-field { grid-template-columns: auto 1fr; align-items: center; padding: .75rem; background: #f4f4ee; border-radius: 11px; }
.checkbox-field input { width: auto; }

.auth-card { width: min(560px, 100%); padding: clamp(1.5rem, 5vw, 3rem); }
.auth-card-wide { width: min(650px, 100%); }
.auth-heading { text-align: center; margin-bottom: 2rem; }
.auth-heading .brand-mark { margin-bottom: 1.4rem; }
.auth-heading h1 { font-size: clamp(2.1rem, 8vw, 3.3rem); margin-inline: auto; }
.auth-heading > p:last-child { color: var(--muted); }
.auth-footnote { text-align: center; color: var(--muted); font-size: .86rem; margin: 1rem 0 0; }

.calendar-header { align-items: center; }
.month-navigation { display: flex; align-items: center; gap: .55rem; }
.month-navigation .icon-button { display: grid; place-items: center; color: var(--ink); }
.calendar-legend { display: flex; flex-wrap: wrap; gap: 1rem; color: var(--muted); font-size: .8rem; margin-bottom: .8rem; }
.calendar-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.legend-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #d8d9d2; }
.legend-complete { background: var(--green); }
.legend-partial { background: var(--orange); }
.legend-planned { background: #779a88; }
.legend-not_completed { background: var(--red); }
.legend-empty { background: #d8d9d2; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; overflow: hidden; background: var(--line); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.weekday { color: var(--muted); background: #ecebe4; padding: .7rem; text-align: center; text-transform: uppercase; font-size: .67rem; font-weight: 800; letter-spacing: .08em; }
.calendar-day { min-height: 120px; display: flex; flex-direction: column; gap: .35rem; color: var(--ink); background: var(--surface); padding: .8rem; position: relative; }
.calendar-day:hover { color: var(--ink); background: #f8f8f1; }
.calendar-day::after { content: ""; position: absolute; left: .8rem; bottom: .8rem; width: 10px; height: 10px; border-radius: 50%; background: #d8d9d2; }
.calendar-day.state-complete::after { background: var(--green); }
.calendar-day.state-partial::after { background: var(--orange); }
.calendar-day.state-planned::after { background: #779a88; }
.calendar-day.state-not_completed::after { background: var(--red); }
.calendar-day.outside-month { opacity: .38; }
.calendar-day.today { box-shadow: inset 0 0 0 2px var(--green); z-index: 1; }
.day-number { font-weight: 800; font-size: 1.05rem; }
.day-state { color: var(--muted); font-size: .72rem; line-height: 1.25; }
.day-progress { margin-top: auto; align-self: flex-end; font-weight: 800; color: var(--green-dark); font-size: .8rem; }
.calendar-mobile-list { display: none; }
.calendar-mobile-day { display: grid; grid-template-columns: 50px 1fr auto; align-items: center; gap: .9rem; color: var(--ink); padding: .8rem 0; border-bottom: 1px solid var(--line); }
.calendar-mobile-date { display: grid; place-items: center; color: var(--muted); border-radius: 11px; padding: .3rem; }
.calendar-mobile-date strong { color: var(--ink); font-size: 1.1rem; }
.calendar-mobile-date.today { background: var(--lime); }
.calendar-mobile-day > span:nth-child(2) { display: grid; }
.calendar-mobile-day small { color: var(--muted); }

.setup-stack { display: grid; gap: 1rem; max-width: 820px; margin: 0 auto; }
.journal-history { padding-top: .5rem; padding-bottom: .5rem; }
.journal-history-row { display: grid; grid-template-columns: 74px 1fr auto; align-items: center; gap: 1rem; color: var(--ink); padding: 1rem 0; border-bottom: 1px solid var(--line); }
.journal-history-row:last-child { border-bottom: 0; }
.journal-history-row:hover { color: var(--ink); }
.journal-history-row time { display: grid; place-items: center; min-height: 62px; border-radius: 14px; background: #eef0e8; }
.journal-history-row time strong { font-size: 1.35rem; line-height: 1; }
.journal-history-row time span { color: var(--muted); font-size: .72rem; text-transform: uppercase; }
.journal-preview { min-width: 0; display: grid; gap: .25rem; }
.journal-preview small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.journal-entry-header h1 { font-size: clamp(2rem, 4vw, 3.6rem); }
.journal-date-navigation { display: flex; align-items: center; justify-content: space-between; margin: -1rem 0 1rem; font-weight: 700; font-size: .9rem; }
.journal-workspace { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .75fr); align-items: start; gap: 1rem; }
.journal-editor-panel { min-width: 0; }
.journal-template-prompt { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem; margin-bottom: 1.2rem; border-radius: 14px; background: #eef3e8; }
.journal-template-prompt p { color: var(--muted); margin-bottom: 0; }
.journal-form textarea { min-height: 55vh; resize: vertical; font: 1rem/1.75 Georgia, "Times New Roman", serif; }
.journal-save-bar { justify-content: space-between; position: sticky; bottom: .75rem; padding: .75rem; border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 253, 248, .94); backdrop-filter: blur(12px); }
.journal-guide { position: sticky; top: 90px; }
.journal-guide h2 { font-size: 1.55rem; }
.journal-guide ol { display: grid; gap: .9rem; margin: 1.25rem 0; padding-left: 1.35rem; }
.journal-guide li { padding-left: .2rem; }
.journal-guide li strong, .journal-guide li span { display: block; }
.journal-guide li span { color: var(--muted); font-size: .82rem; margin-top: .1rem; }
.journal-guide-connection { display: grid; gap: .5rem; border-top: 1px solid var(--line); margin-top: 1.2rem; padding-top: 1.2rem; }
.journal-guide-connection p { color: var(--muted); font-size: .86rem; margin-bottom: .2rem; }
.secret-once { display: grid; gap: .65rem; padding: 1rem; margin: 1rem 0; border: 1px solid #b8d49a; border-radius: 14px; background: #f1f8de; }
.secret-once code, .endpoint-box code { overflow-wrap: anywhere; }
.endpoint-box { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 1rem; margin: .7rem 0 1rem; border: 1px solid var(--line); border-radius: 12px; background: #f3f3ed; }
.instruction-list { display: grid; gap: .65rem; padding-left: 1.4rem; }
.code-sample { overflow-x: auto; padding: 1rem; border-radius: 12px; background: #17211b; color: #eef5e8; }

@media (max-width: 820px) {
  .shell { padding-top: 2rem; }
  .page-header { align-items: flex-start; flex-direction: column; }
  .page-header .button, .page-header form, .page-header form .button { width: 100%; }
  .content-grid, .metric-grid { grid-template-columns: 1fr; }
  .dashboard-header { margin-bottom: 1.5rem; }
  .task-actions { width: 100%; padding: 0 0 .7rem 1.8rem; }
  .next-action-card { grid-template-columns: auto 1fr; }
  .next-action-card .button { grid-column: 1 / -1; width: 100%; }
  .onboarding-strip { align-items: flex-start; flex-direction: column; }
  .onboarding-strip ol { width: 100%; justify-content: space-between; }
  .journal-workspace { grid-template-columns: 1fr; }
  .journal-guide { position: static; grid-row: 1; }
  .quick-activity-form { grid-template-columns: 1fr 110px; }
  .quick-activity-form .button { grid-column: 1 / -1; }
  .step-hero { grid-template-columns: 1fr auto; }
  .step-progress-large { grid-column: 1 / -1; grid-row: 2; }
}

@media (max-width: 520px) {
  .topbar { padding-inline: 1rem; }
  .nav { gap: .8rem; }
  .brand > span:last-child { display: none; }
  .admin-link { display: none; }
  .nav { gap: .55rem; }
  .nav a, .nav-button { font-size: .76rem; }
  .shell { width: min(100% - 1rem, 1180px); }
  h1 { font-size: 2.35rem; }
  .panel { border-radius: 17px; }
  .goal-card-top { align-items: flex-start; }
  .task-row .status-pill { display: none; }
  .next-action-card { padding: 1rem; gap: .8rem; }
  .next-action-number { width: 45px; height: 45px; border-radius: 13px; font-size: .6rem; }
  .onboarding-strip ol { display: grid; gap: .6rem; }
  .calendar-grid, .calendar-legend { display: none; }
  .calendar-mobile-list { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 0 1rem; box-shadow: var(--shadow); }
  .journal-history-row { grid-template-columns: 58px 1fr; }
  .journal-history-row > .status-pill { display: none; }
  .journal-template-prompt, .endpoint-box { align-items: stretch; flex-direction: column; }
  .journal-template-prompt form, .journal-template-prompt .button { width: 100%; }
  .journal-save-bar { align-items: stretch; flex-direction: column; }
  .journal-save-bar .button { width: 100%; }
  .quick-activity-form { grid-template-columns: 1fr; }
  .quick-activity-form .button { grid-column: auto; width: 100%; }
  .step-hero { grid-template-columns: 1fr; }
  .step-progress-large { grid-column: auto; grid-row: auto; }
  .step-hero-meta { text-align: left; }
}

