.goal-page-shell {
  --goal-ink: #24364b;
  --goal-accent: #4f6f99;
  --goal-accent-strong: #36577f;
  --goal-accent-mid: #7f9fc5;
  --goal-border: #d5dfeb;
  --goal-soft: #edf3fa;
  --goal-tint: #f8fafd;
  flex: 1 0 100%;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  min-height: 100vh;
  background: linear-gradient(180deg, #f8fafd 0%, #f2f5f9 100%);
  color: var(--goal-ink);
}

.goal-page-root {
  width: 100%;
  max-width: 1800px;
  box-sizing: border-box;
  margin: 0 auto;
  padding: 48px clamp(32px, 4vw, 76px) 96px;
}

.goal-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 24px;
}

.goal-page-header p,
.goal-identity-card__copy p,
.goal-context__header p {
  margin: 0 0 6px;
  color: #5f7898;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.goal-page-header h1 {
  margin: 0 0 10px;
  font-size: clamp(30px, 4vw, 48px);
  letter-spacing: -.04em;
}

.goal-page-header span {
  color: #64748b;
  line-height: 1.6;
}

.goal-page-year-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--goal-border);
  border-radius: 999px;
  padding: 6px;
  background: #fff;
}

.goal-page-year-nav button,
.goal-context__header button,
.goal-page-error button {
  border: 0;
  border-radius: 999px;
  background: var(--goal-soft);
  color: var(--goal-accent-strong);
  cursor: pointer;
  padding: 8px 13px;
  font-weight: 700;
}

.goal-page-year-nav strong { min-width: 58px; text-align: center; }

.goal-page-status {
  min-height: 22px;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
}

.goal-page-status.is-success { color: #27794b; }
.goal-page-status.is-error { color: #b7443d; }

.goal-identity-card {
  display: grid;
  grid-template-columns: minmax(280px, .75fr) minmax(480px, 1fr);
  gap: 30px;
  padding: 28px;
  border: 1px solid var(--goal-border);
  border-radius: 22px;
  background: linear-gradient(135deg, #fff, #edf3fa);
  box-shadow: 0 18px 44px rgba(43, 65, 91, .09);
}

.goal-identity-card.is-focused,
.goal-slot.is-focused { box-shadow: 0 0 0 3px rgba(79, 111, 153, .25); }

.goal-identity-card h2 { margin: 0 0 8px; font-size: 23px; }
.goal-identity-card__copy span { color: #64748b; line-height: 1.55; }

#goal-identity-form {
  width: 100%;
  justify-self: stretch;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

#goal-identity-form label {
  position: relative;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #c8d4e3;
  border-radius: 14px;
  padding: 8px 13px;
  background: #fff;
  color: #52657c;
  font-weight: 700;
}

#goal-identity-form input {
  width: 1ch;
  min-width: 0;
  max-width: 100%;
  flex: 0 1 auto;
  border: 0;
  outline: 0;
  padding: 8px 4px;
  font: inherit;
  color: var(--goal-ink);
}

.goal-identity-input-sizer {
  position: absolute;
  visibility: hidden;
  white-space: pre;
  font: inherit;
}

#goal-identity-form button,
.goal-slot__actions button {
  border: 0;
  border-radius: 11px;
  padding: 11px 16px;
  background: var(--goal-accent-strong);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

button:disabled { cursor: not-allowed; opacity: .48; }

.goal-identity-required {
  margin: 12px 4px 0;
  color: #a14d35;
  font-size: 13px;
  font-weight: 700;
}

.goal-hierarchy {
  margin-top: 34px;
}

.goal-hierarchy.is-locked { opacity: .74; }

.goal-hierarchy__section {
  border: 1px solid var(--goal-border);
  border-radius: 20px;
  padding: 24px;
  background: rgba(255,255,255,.82);
}

.goal-year-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(300px, 1fr));
  align-items: start;
  gap: 18px;
  overflow-x: auto;
  padding: 2px 2px 10px;
}

.goal-year-column {
  min-width: 0;
  padding: 12px;
  border: 1px solid #dce4ee;
  border-radius: 17px;
  background: var(--goal-tint);
}

.goal-hierarchy__section > h2 { margin: 0 0 6px; font-size: 20px; }
.goal-hierarchy__section > p { margin: 0 0 18px; color: #718096; font-size: 13px; line-height: 1.5; }

.goal-slot {
  position: relative;
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  gap: 10px;
  margin: 9px 0;
  scroll-margin-top: 100px;
}

.goal-slot__children {
  position: relative;
  margin: 8px 0 12px 18px;
  padding: 9px 9px 9px 16px;
  border-left: 4px solid #9eb4d0;
  border-radius: 0 14px 14px 0;
  background: linear-gradient(90deg, rgba(225, 233, 244, .82), rgba(248, 250, 253, .42) 72%);
}

.goal-slot:not(.goal-slot--depth-0) {
  grid-template-columns: minmax(0, 1fr);
  margin-left: 0;
}

.goal-slot:not(.goal-slot--depth-0) .goal-slot__rail {
  display: none;
}

.goal-slot__rail {
  border-left: 2px solid #c1cede;
  border-bottom: 2px solid #c1cede;
  border-radius: 0 0 0 9px;
  transform: translateY(-50%);
}

.goal-slot--depth-0 .goal-slot__rail {
  border: 0;
  border-radius: 8px;
  background: var(--goal-accent-mid);
  transform: none;
}

.goal-slot__content {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 11px;
  border: 1px solid #dce4ee;
  border-radius: 13px;
  background: #fff;
}

.goal-slot[data-goal-toggle-surface] .goal-slot__content,
.goal-slot[data-goal-toggle-surface] .goal-slot__rail {
  cursor: pointer;
}

.goal-slot[data-goal-toggle-surface] .goal-slot__content:hover {
  border-color: #7594ba;
  box-shadow: 0 5px 16px rgba(54, 83, 119, .09);
}

.goal-slot.has-goal .goal-slot__content { border-color: #94abc7; background: #fbfdff; }
.goal-slot label { flex: 1; min-width: 0; }
.goal-slot label > span { display: block; margin-bottom: 5px; color: #5f7188; font-size: 11px; font-weight: 800; }

.goal-slot__label {
  display: flex !important;
  align-items: center;
  gap: 6px;
}

.goal-slot__label > span { min-width: 0; }

.goal-slot__fold,
.goal-slot__fold-spacer {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
}

.goal-slot__fold {
  display: inline-grid;
  place-items: center;
  border: 1px solid #b9c9dc;
  border-radius: 6px;
  padding: 0;
  background: var(--goal-soft);
  color: var(--goal-accent-strong);
  cursor: pointer;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
}

.goal-slot textarea {
  width: 100%;
  box-sizing: border-box;
  display: block;
  min-height: 36px;
  max-height: 240px;
  overflow-y: hidden;
  resize: none;
  border: 0;
  border-bottom: 1px solid #dfe5df;
  outline: none;
  padding: 7px 2px;
  color: var(--goal-ink);
  font: inherit;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.goal-slot textarea:focus { border-color: var(--goal-accent); }
.goal-slot__actions { display: flex; justify-content: flex-end; gap: 5px; }
.goal-slot__actions button { padding: 8px 10px; font-size: 11px; }
.goal-slot__actions button.is-danger { background: #f3e7e4; color: #9c453b; }

.goal-page-loading,
.goal-page-error {
  margin-top: 120px;
  text-align: center;
  color: #68766c;
}

.goal-context {
  --goal-ink: #24364b;
  --goal-accent-strong: #36577f;
  --goal-border: #d5dfeb;
  --goal-soft: #edf3fa;
  border: 1px solid var(--goal-border);
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
}

.goal-context__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid #e2e8f0;
}

.goal-context__header h3 { margin: 0; font-size: 15px; }
.goal-context--daily .goal-context__header { padding: 11px 16px; }
.goal-context__header button { padding: 6px 10px; font-size: 11px; }
.goal-context__rows { display: grid; }

.goal-context--daily .goal-context__rows { grid-template-columns: 1fr; }

.goal-context__row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
  border: 0;
  border-bottom: 1px solid #edf1ed;
  padding: 10px 16px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.goal-context__row:last-child { border-bottom: 0; }
.goal-context__row:hover { background: #f2f6fb; }
.goal-context__row span { color: #718096; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.goal-context__row strong { overflow: hidden; color: var(--goal-ink); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.goal-context__row.is-empty strong { color: #a0aaa3; font-weight: 500; }
.goal-context__message { margin: 0; padding: 18px; color: #78847b; font-size: 12px; }
.goal-context--roadmap { margin-bottom: 16px; }
.goal-context--roadmap .goal-context__rows { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.goal-context--roadmap .goal-context__row { display: block; min-width: 0; border-right: 1px solid #edf1ed; border-bottom: 0; }
.goal-context--roadmap .goal-context__row span { display: block; margin-bottom: 5px; }
.goal-context--roadmap .goal-context__row strong { display: block; }

#daily-goal-context { flex: 0 0 auto; margin-bottom: 12px; }
.mv-yearly-goal-context { margin: 12px 20px 0; }

@media (max-width: 900px) {
  .goal-page-root { width: 100%; padding: 28px 14px 72px; }
  .goal-identity-card { grid-template-columns: 1fr; }
  .goal-year-grid { grid-template-columns: 1fr; overflow: visible; }
  #goal-identity-form { align-items: stretch; flex-direction: column; }
  .goal-slot__children { margin-left: 8px; padding-left: 10px; }
  .goal-context--roadmap .goal-context__rows { grid-template-columns: 1fr; }
  .goal-context--roadmap .goal-context__row { border-right: 0; border-bottom: 1px solid #edf1ed; }
}
