/* goals-home: Goals home (empty state, Current/Complete grid) and goal detail (Figma "Goals Desktop"). */

.gh-page {
  display: flex;
  flex-direction: column;
  gap: 40px;
  width: 100%;
  max-width: 960px;
  color: var(--white);
}

.gh-home {
  padding-top: 32px; /* list frames use 80px top padding vs the shell's 48px */
}

.gh-title {
  margin: 0;
  font-size: 40px;
  font-weight: 500;
  line-height: 1.2;
}

.gh-muted {
  margin: 0;
  font-size: 16px;
  line-height: 1.4;
  color: var(--light-gray);
}

.gh-placeholder {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  padding: 24px;
  border-radius: 12px;
  background: var(--navy-card);
}

.gh-placeholder p {
  margin: 0;
}

.gh-eyebrow {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--gold);
}

.gh-eyebrow-lg {
  font-size: 18px;
}

.gh-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.gh-divider {
  height: 1px;
  width: 100%;
  background: var(--navy-border);
}

/* --- Buttons --- */

.gh-circle-btn {
  width: 40px;
  height: 40px;
  border-radius: 40px;
  border: none;
  padding: 0;
  background: var(--navy-card);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
}

.gh-circle-btn-bordered {
  border: 1px solid var(--navy-border);
}

.gh-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  background: none;
  border: none;
  color: var(--white);
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  align-self: flex-start;
}

.gh-back .gh-circle-btn {
  cursor: inherit;
}

.gh-btn-primary,
.gh-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 8px 24px;
  border-radius: 40px;
  border: 1px solid var(--navy-border);
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  line-height: 25px;
  cursor: pointer;
  text-decoration: none;
}

.gh-btn-primary {
  background: var(--white);
  color: var(--navy-mid);
}

.gh-btn-secondary {
  background: transparent;
  color: var(--white);
}

.gh-btn-primary:disabled,
.gh-btn-secondary:disabled {
  opacity: 0.4;
  cursor: default;
}

.gh-btn-full {
  width: 100%;
}

.gh-btn-complete {
  width: 254px;
  max-width: 100%;
  margin-top: -16px;
}

.gh-text-link {
  padding: 0 8px;
  background: none;
  border: none;
  color: var(--white);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  line-height: 25px;
  cursor: pointer;
}

.gh-icon-btn {
  display: flex;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
}

/* --- Label/value pairs --- */

.gh-lv {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  white-space: nowrap;
}

.gh-lv-label {
  font-size: 14px;
  line-height: 1.4;
  color: var(--light-gray);
}

.gh-lv-value {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--white);
}

.gh-lv-value.lg {
  font-size: 18px;
}

.gh-lv-value.coral {
  color: #D1817E;
}

.gh-lv-value.muted {
  color: var(--light-gray);
}

/* --- Home --- */

.gh-home-head {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.gh-home-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gh-tabs {
  display: flex;
  gap: 8px;
}

.gh-tab {
  display: flex;
  align-items: center;
  height: 40px;
  padding: 6px 24px;
  border-radius: 24px;
  background: var(--navy-card);
  color: var(--white);
  font-size: 16px;
  text-decoration: none;
}

.gh-tab.active {
  background: var(--white);
  color: var(--navy-mid);
}

.gh-home .gh-section {
  gap: 16px;
}

.gh-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  /* ul reset (the grid is a list for screen readers) */
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Each li is the grid cell; its card fills it as before. */
.gh-card-grid > li {
  display: flex;
  min-width: 0;
}

.gh-card-grid > li > .gh-card {
  flex: 1 1 auto;
}

.gh-card {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px;
  border-radius: 12px;
  border: 1px solid var(--navy-border);
  background: var(--navy-card);
  box-shadow: 0 4px 12px #061225;
  color: var(--white);
  text-decoration: none;
  min-width: 0;
}

a.gh-card:hover {
  border-color: var(--gold);
}

.gh-card-top {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gh-card-heading {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.gh-goal-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  color: var(--white);
}

.gh-goal-logo {
  background: var(--white);
}

.gh-goal-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gh-card-name {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.gh-card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  line-height: 19px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gh-card-sub {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  overflow: hidden;
  font-size: 12px;
  font-weight: 700;
  line-height: 16px;
  color: var(--light-gray);
  white-space: nowrap;
}

.gh-card-status {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gh-card-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.gh-card-row .gh-lv-label {
  font-weight: 500;
  line-height: 20px;
}

.gh-card-steps {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
}

.gh-card-check {
  display: flex;
  justify-content: center;
}

.gh-bar {
  height: 8px;
  border-radius: 8px;
  background: #101F38;
  overflow: hidden;
}

.gh-bar-navy {
  border-radius: 8px;
  background: var(--navy-mid);
}

.gh-bar-fill {
  height: 100%;
  border-radius: 8px;
  background: #12A566;
}

.gh-habit-title-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.gh-habit-edit {
  display: inline-flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--light-gray);
  text-decoration: none;
}

.gh-habit-quote {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
}

/* --- Empty state --- */

.gh-empty-heading {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.gh-empty-sub {
  margin: 0;
  font-size: 16px;
  line-height: 1.4;
  color: var(--light-gray);
}

.gh-empty-groups {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.gh-empty-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0 16px;
}

.gh-empty-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gh-empty-caption {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--light-gray);
}

.gh-type-row {
  display: flex;
  gap: 8px;
}

.gh-type-tile {
  flex: 1 0 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px;
  border-radius: 8px;
  border: 1px solid var(--navy-border);
  background: var(--navy-card);
  box-shadow: 0 4px 12px rgba(2, 9, 22, 0.35);
  color: var(--white);
  font-size: 18px;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
}

.gh-type-tile:hover {
  border-color: var(--gold);
}

/* --- Detail --- */

.gh-detail-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gh-detail-head {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.gh-detail-title-row {
  display: flex;
  align-items: center;
  gap: 24px;
}

.gh-detail-title-row .gh-goal-icon {
  width: 48px;
  height: 48px;
}

.gh-detail-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 40px;
  font-weight: 500;
  line-height: 1.2;
}

.gh-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
}

.gh-detail-meta .gh-lv-value {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
}

.gh-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 8px;
}

.gh-step {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-radius: 12px;
  background: var(--navy-card);
  overflow: hidden;
}

.gh-step-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
}

.gh-step-counter {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  color: #71C59E;
}

.gh-step-text {
  margin: 0;
  font-size: 16px;
  line-height: 1.4;
}

.gh-step-link {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 700;
  line-height: 16px;
  color: var(--light-gray);
  text-decoration: none;
}

.gh-step-link span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gh-step-link img {
  flex-shrink: 0;
}

.gh-step-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  padding: 11px 16px;
  border: none;
  border-top: 1px solid var(--navy-border);
  background: var(--navy-card-secondary);
  color: var(--white);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  cursor: pointer;
}

.gh-step-status:disabled {
  cursor: default;
}

.gh-step-status.complete {
  background: #12A566;
}

.gh-step-circle,
.gh-step-check {
  width: 18px;
  height: 18px;
  border-radius: 24px;
  flex-shrink: 0;
}

.gh-step-circle {
  border: 1px solid var(--white);
}

.gh-step-check {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--white);
}

.gh-progress-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.gh-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px;
  border-radius: 12px;
  background: var(--navy-card);
  min-width: 0;
}

.gh-panel-grow {
  flex: 1 1 0;
}

.gh-panel-side {
  flex: 0 0 425px;
}

.gh-panel-stats {
  flex: 0 0 auto;
  min-height: 255px;
  justify-content: center;
  align-items: center;
  gap: 32px;
  padding: 40px;
}

.gh-panel-head {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.gh-panel-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.gh-panel-title {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
}

.gh-panel-sub {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--light-gray);
}

.gh-panel-foot {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gh-panel-foot p {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
  color: var(--light-gray);
}

.gh-panel-foot p.white {
  color: var(--white);
}

.gh-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}

.gh-big {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  white-space: nowrap;
}

.gh-big-value {
  font-size: 32px;
  font-weight: 500;
  line-height: 1.2;
}

.gh-big-suffix {
  font-size: 16px;
  line-height: 1.4;
  color: var(--light-gray);
}

.gh-split {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.gh-chart-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gh-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gh-legend-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--light-gray);
}

.gh-legend-swatch {
  width: 16px;
  height: 8px;
}

.gh-legend-line {
  width: 12px;
  height: 4px;
  background: #12A566;
}

.gh-legend-value {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
}

.gh-spend-progress {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gh-stats-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gh-stats-sep {
  width: 1px;
  height: 56px;
  background: var(--navy-border);
}

.gh-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
}

.gh-stat-bar {
  display: flex;
  gap: 2px;
  width: 96px;
  height: 8px;
  border-radius: 2px;
  overflow: hidden;
}

.gh-stat-wide {
  width: 310px;
  max-width: 100%;
}

.gh-stat-wide .gh-stat-bar {
  width: 100%;
}

.gh-stat-rest {
  flex: 1;
  background: #F6F6F6;
}

.gh-years {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.gh-year {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.gh-year-head,
.gh-prev-year-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0;
  background: none;
  border: none;
  color: var(--white);
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
}

.gh-year-head.open {
  color: var(--gold);
}

.gh-year-months {
  display: grid;
  grid-template-columns: repeat(3, auto);
  justify-content: space-between;
  gap: 16px 8px;
}

.gh-year-months .gh-lv {
  gap: 2px;
}

.gh-contrib-row {
  display: flex;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
}

.gh-content-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
}

.gh-pager {
  display: flex;
  gap: 8px;
}

.gh-pager-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--navy-border);
  background: var(--navy-card-secondary);
  cursor: pointer;
}

.gh-pager-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.gh-articles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

/* --- Previous contributions --- */

.gh-prev-title {
  margin: 0;
  font-size: 32px;
  font-weight: 500;
  line-height: 1.2;
}

.gh-prev-list {
  display: flex;
  flex-direction: column;
  gap: 23px;
  width: 700px;
  max-width: 100%;
}

.gh-prev-year {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gh-prev-year-head {
  height: 40px;
  font-size: 24px;
}

.gh-prev-month {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid var(--navy-border);
  background: var(--navy-card);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
}

.gh-prev-amount {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* --- Modals --- */

.gh-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(1.5px);
  overflow-y: auto;
}

.gh-modal {
  display: flex;
  flex-direction: column;
  gap: 40px;
  width: 551px;
  max-width: 100%;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 24px 40px 40px;
  border-radius: 24px;
  border: 2px solid var(--navy-border);
  background: var(--navy-mid);
  box-shadow: 0 4px 4px rgba(0, 0, 0, 0.25);
  color: var(--white);
}

.gh-modal-top {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gh-modal-x {
  align-self: flex-end;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
}

.gh-modal-title {
  margin: 0;
  font-size: 24px;
  font-weight: 500;
  line-height: 1.2;
}

.gh-modal-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gh-modal-details .gh-lv {
  gap: 8px;
}

.gh-modal-hint {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
  color: var(--white);
}

.gh-field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.gh-modal .goals-panel {
  align-items: stretch;
  padding: 16px 12px;
}

.gh-modal .goals-or {
  text-align: center;
}

.gh-modal-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
}

.gh-delete {
  padding: 0;
  background: none;
  border: none;
  color: #D1817E;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  line-height: 25px;
  cursor: pointer;
}

.gh-delete:disabled {
  opacity: 0.4;
}

/* Delete confirm, stacked over the edit modal. */
.gh-confirm {
  max-width: 420px;
}

.gh-confirm-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}

.gh-btn-primary.gh-btn-danger {
  background: #D1817E;
  border-color: #D1817E;
  color: var(--navy-mid);
}

.gh-completed {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.gh-completed + .gh-modal-actions {
  gap: 16px;
}

/* --- Accessibility (WCAG 1.3.1, 2.5.8) --- */

/* Accordion panels stay in the DOM (aria-controls targets) but collapse. */
.gh-prev-months {
  display: contents;
}

.gh-year-months[hidden],
.gh-prev-months[hidden] {
  display: none;
}

/* 20px icon buttons: pad the hit area to 24px without moving anything. */
.gh-icon-btn {
  padding: 2px;
  margin: -2px;
}

/* --- Retirement goal: ACTUAL / PROJECTED summary boxes (Figma 19063:44414) --- */

.gh-ret-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--navy-card-secondary);
}

.gh-ret-box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.gh-ret-box-title {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--gold);
}

.gh-ret-box-total {
  font-size: 14px;
  line-height: 1.4;
}

.gh-ret-legend-end {
  align-items: flex-end;
}

/* --- Reflow (WCAG 1.4.10): desktop (>=1024px) unchanged --- */

@media (max-width: 1023.98px) {
  .gh-card-grid,
  .gh-steps,
  .gh-articles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Detail panels: side-by-side → stacked. */
  .gh-progress-row {
    flex-direction: column;
    align-items: stretch;
  }

  .gh-panel-side,
  .gh-panel-stats {
    flex: 0 0 auto;
  }
}

@media (max-width: 767.98px) {
  /* Narrow cards: wrap goal names instead of truncating them. */
  .gh-card-title {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .gh-card-sub {
    flex-wrap: wrap;
    gap: 0 16px;
  }

  .gh-home-title-row,
  .gh-detail-top,
  .gh-content-head {
    flex-wrap: wrap;
    gap: 16px;
  }

  .gh-tabs,
  .gh-type-row {
    flex-wrap: wrap;
  }

  .gh-type-tile {
    flex: 1 0 calc(50% - 4px);
  }

  .gh-stats-row {
    flex-wrap: wrap;
    justify-content: center;
    max-width: 100%;
  }

  .gh-big {
    flex-wrap: wrap;
  }

  .gh-panel-stats {
    padding: 24px;
  }

  .gh-overlay {
    padding: 16px;
  }

  .gh-modal {
    width: min(551px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    padding: 24px;
    gap: 32px;
  }
}

@media (max-width: 479.98px) {
  .gh-card-grid,
  .gh-steps,
  .gh-articles {
    grid-template-columns: minmax(0, 1fr);
  }

  .gh-year-months {
    grid-template-columns: minmax(0, 1fr);
  }

  .gh-stats-sep {
    display: none;
  }
}
