:root {
  --target-navy: #1b2b4b;
  --target-canvas: #f5f7f6;
  --target-surface: #ffffff;
  --target-surface-muted: #f0f3f2;
  --target-line: #dce3e0;
  --target-line-strong: #c6d1cd;
  --target-ink: #14223a;
  --target-muted: #66716d;
  --target-green: #2d6a4f;
  --target-green-soft: #e9f2ed;
  --target-amber: #a56a20;
  --target-amber-soft: #fbf2e5;
  --target-red: #a63d36;
  --target-red-soft: #faecea;
}

.targets-page { background: var(--target-canvas); color: var(--target-ink); }
.targets-page button,
.targets-page input,
.targets-page select { font: inherit; }
.targets-page button:focus-visible,
.targets-page input:focus-visible,
.targets-page select:focus-visible,
.targets-page a:focus-visible { outline: 3px solid rgba(45, 106, 79, 0.24); outline-offset: 2px; }
.targets-skip-link { position: fixed; top: 12px; left: 12px; z-index: 600; padding: 9px 12px; border-radius: 8px; background: var(--target-navy); color: #fff; transform: translateY(-160%); }
.targets-skip-link:focus { transform: translateY(0); }

.targets-workspace { width: min(100%, 1440px); margin-inline: auto; padding: 30px 38px 72px; }
.targets-intro { margin-bottom: 22px; display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; }
.targets-eyebrow,
.targets-section-heading p,
.target-detail-identity p,
.affordability-verdict > p,
.target-dialog header p,
.target-confirm-dialog > div > p { margin: 0 0 6px; color: var(--target-green); font-size: 10px; font-weight: 750; text-transform: uppercase; }
.targets-intro h1 { margin: 0; font-family: 'Montserrat', sans-serif; font-size: clamp(31px, 3vw, 41px); line-height: 1.08; text-wrap: balance; }
.targets-intro > div:first-child > p:last-child { max-width: 68ch; margin: 9px 0 0; color: var(--target-muted); font-size: 13px; line-height: 1.6; text-wrap: pretty; }
.targets-intro-actions { display: flex; align-items: center; gap: 9px; }
.targets-sync-badge { min-height: 38px; padding: 0 12px; display: inline-flex; align-items: center; gap: 7px; border: 1px solid #cfe0d7; border-radius: 8px; background: var(--target-green-soft); color: var(--target-green); font-size: 10px; font-weight: 650; }
.targets-primary-button,
.targets-quiet-button,
.target-danger-button { min-height: 38px; padding: 0 13px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 8px; font-size: 11px; font-weight: 700; }
.targets-primary-button { border: 0; background: var(--target-green); color: #fff; }
.targets-primary-button:hover { background: #245940; }
.targets-quiet-button { border: 1px solid var(--target-line); background: #fff; color: var(--target-muted); }
.targets-quiet-button:hover { border-color: var(--target-line-strong); color: var(--target-ink); }
.targets-icon-button { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--target-line); border-radius: 50%; background: #fff; color: var(--target-muted); }
.targets-icon-button.danger:hover { border-color: #e7c2bf; background: var(--target-red-soft); color: var(--target-red); }

.targets-section-heading { margin-bottom: 14px; display: flex; align-items: end; justify-content: space-between; gap: 22px; }
.targets-section-heading.compact { margin-bottom: 13px; }
.targets-section-heading p { margin-bottom: 4px; }
.targets-section-heading h2,
.targets-section-heading h3 { margin: 0; font-family: 'Montserrat', sans-serif; line-height: 1.25; text-wrap: balance; }
.targets-section-heading h2 { font-size: 20px; }
.targets-section-heading h3 { font-size: 16px; }
.targets-section-heading > span { color: var(--target-muted); font-size: 10px; }

.targets-overview { margin-bottom: 14px; }
.targets-card-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.target-card { min-width: 0; min-height: 164px; padding: 17px; display: grid; grid-template-rows: auto 1fr auto; gap: 13px; border: 1px solid var(--target-line); border-radius: 13px; background: var(--target-surface); color: inherit; text-align: left; }
.target-card:hover { border-color: var(--target-line-strong); }
.target-card[aria-pressed="true"] { border-color: var(--target-green); box-shadow: inset 0 0 0 1px var(--target-green); }
.target-card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.target-card-icon { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 9px; background: var(--target-green-soft); color: var(--target-green); font-size: 17px; }
.target-card-status { padding: 5px 7px; border-radius: 6px; background: var(--target-surface-muted); color: var(--target-muted); font-size: 8px; font-weight: 750; }
.target-card-status.on-track { background: var(--target-green-soft); color: var(--target-green); }
.target-card-status.behind { background: var(--target-amber-soft); color: var(--target-amber); }
.target-card-copy h3 { margin: 0; overflow: hidden; font-family: 'Montserrat', sans-serif; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.target-card-copy p { margin: 5px 0 0; color: var(--target-muted); font-size: 10px; }
.target-card-progress { height: 6px; overflow: hidden; border-radius: 999px; background: var(--target-surface-muted); }
.target-card-progress span { width: 100%; height: 100%; display: block; border-radius: inherit; background: var(--target-green); transform: scaleX(var(--target-progress, 0)); transform-origin: left; }
.target-card-footer { display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.target-card-footer strong { display: block; font-size: 16px; font-variant-numeric: tabular-nums; }
.target-card-footer small { color: var(--target-muted); font-size: 9px; }

.targets-detail,
.targets-affordability,
.targets-scenarios { margin-top: 14px; padding: 22px; border: 1px solid var(--target-line); border-radius: 15px; background: var(--target-surface); }
.target-detail-header { margin-bottom: 18px; padding-bottom: 17px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--target-line); }
.target-detail-identity { min-width: 0; display: flex; align-items: center; gap: 12px; }
.target-detail-icon { width: 44px; height: 44px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 11px; background: var(--target-green-soft); color: var(--target-green); font-size: 20px; }
.target-detail-identity p { margin-bottom: 3px; }
.target-detail-identity h2 { margin: 0; font-family: 'Montserrat', sans-serif; font-size: 20px; text-wrap: balance; }
.target-detail-identity span:last-child { display: block; margin-top: 4px; color: var(--target-muted); font-size: 10px; }
.target-detail-actions { display: flex; gap: 8px; }
.target-detail-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(310px, 0.65fr); gap: 18px; align-items: start; }
.target-progress-panel { min-width: 0; padding: 19px; border-radius: 13px; background: #21384a; color: #fff; }
.target-progress-summary { display: flex; align-items: center; gap: 16px; }
.target-progress-ring { width: 84px; height: 84px; display: grid; place-items: center; flex: 0 0 auto; border: 8px solid rgba(255, 255, 255, 0.13); border-radius: 50%; color: #fff; }
.target-progress-ring.progress-quarter { border-top-color: #74c69d; }
.target-progress-ring.progress-half { border-top-color: #74c69d; border-right-color: #74c69d; }
.target-progress-ring.progress-three-quarter { border-top-color: #74c69d; border-right-color: #74c69d; border-bottom-color: #74c69d; }
.target-progress-ring.progress-complete { border-color: #74c69d; }
.target-progress-ring span { font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: 750; font-variant-numeric: tabular-nums; }
.target-progress-summary p { margin: 0 0 5px; color: #9fd0b5; font-size: 9px; font-weight: 750; text-transform: uppercase; }
.target-progress-summary h3 { margin: 0; font-family: 'Montserrat', sans-serif; font-size: clamp(19px, 2vw, 25px); line-height: 1.2; text-wrap: balance; }
.target-progress-summary > div > span { display: block; margin-top: 6px; color: rgba(255, 255, 255, 0.6); font-size: 10px; line-height: 1.5; text-wrap: pretty; }
.target-progress-metrics { margin: 18px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid rgba(255, 255, 255, 0.12); border-bottom: 1px solid rgba(255, 255, 255, 0.12); }
.target-progress-metrics div { padding: 13px 10px; }
.target-progress-metrics div + div { border-left: 1px solid rgba(255, 255, 255, 0.12); }
.target-progress-metrics dt { color: rgba(255, 255, 255, 0.5); font-size: 9px; }
.target-progress-metrics dd { margin: 5px 0 0; font-size: 12px; font-weight: 750; font-variant-numeric: tabular-nums; }
.target-chart-shell { min-width: 0; margin-top: 14px; }
.target-chart-shell svg { width: 100%; height: auto; display: block; overflow: visible; }
.target-chart-grid { stroke: rgba(255, 255, 255, 0.1); stroke-width: 1; }
.target-chart-line { fill: none; stroke: #74c69d; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.target-chart-area { fill: rgba(116, 198, 157, 0.11); }
.target-chart-goal { stroke: rgba(255, 255, 255, 0.42); stroke-width: 1.5; stroke-dasharray: 5 5; }
.target-chart-label { fill: rgba(255, 255, 255, 0.52); font-size: 9px; }
.target-chart-dot { fill: #74c69d; stroke: #21384a; stroke-width: 3; }

.target-plan-panel { padding: 17px; border: 1px solid var(--target-line); border-radius: 13px; background: var(--target-surface-muted); }
.target-plan-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.target-plan-form label,
.ownership-form label,
.target-dialog-fields label { min-width: 0; display: grid; gap: 6px; }
.target-plan-form label > span:first-child,
.ownership-form label > span:first-child,
.target-dialog-fields label > span:first-child { color: var(--target-muted); font-size: 9px; font-weight: 650; }
.target-plan-wide { grid-column: 1 / -1; }
.target-input-shell { min-height: 39px; padding: 0 10px; display: flex; align-items: center; gap: 6px; border: 1px solid var(--target-line); border-radius: 8px; background: #fff; color: var(--target-muted); }
.target-input-shell:focus-within { border-color: var(--target-green); box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.1); }
.target-input-shell input { width: 100%; min-width: 0; height: 37px; padding: 0; border: 0; outline: 0; background: transparent; color: var(--target-ink); font-size: 11px; font-variant-numeric: tabular-nums; }
.target-input-shell i { flex: 0 0 auto; font-size: 10px; font-style: normal; }
.target-plan-actions { grid-column: 1 / -1; margin-top: 2px; display: flex; justify-content: flex-end; gap: 7px; }
.target-form-status { grid-column: 1 / -1; min-height: 15px; margin: 0; color: var(--target-green); font-size: 9px; text-align: right; }

.targets-affordability > .targets-section-heading,
.targets-scenarios > .targets-section-heading { padding: 0 1px; }
.targets-data-note { display: inline-flex; align-items: center; gap: 6px; }
.affordability-grid { display: grid; grid-template-columns: minmax(280px, 0.62fr) minmax(0, 1.38fr); gap: 14px; }
.affordability-verdict { padding: 20px; border-radius: 13px; background: #21384a; color: #fff; }
.affordability-verdict[data-status="caution"] { background: #4c3b2b; }
.affordability-verdict[data-status="tight"] { background: #4b3031; }
.affordability-verdict-icon { width: 39px; height: 39px; margin-bottom: 16px; display: grid; place-items: center; border: 1px solid rgba(255, 255, 255, 0.13); border-radius: 9px; background: rgba(255, 255, 255, 0.07); color: #b8dec8; font-size: 18px; }
.affordability-verdict > p { color: #9fd0b5; }
.affordability-verdict h3 { margin: 0; font-family: 'Montserrat', sans-serif; font-size: 22px; text-wrap: balance; }
.affordability-verdict > span:last-of-type { display: block; margin-top: 8px; color: rgba(255, 255, 255, 0.62); font-size: 10px; line-height: 1.55; text-wrap: pretty; }
.affordability-verdict dl { margin: 18px 0 0; }
.affordability-verdict dl div { padding: 10px 0; display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid rgba(255, 255, 255, 0.12); }
.affordability-verdict dt { color: rgba(255, 255, 255, 0.52); font-size: 9px; }
.affordability-verdict dd { margin: 0; font-size: 11px; font-weight: 750; font-variant-numeric: tabular-nums; text-align: right; }
.ownership-panel { padding: 18px; border: 1px solid var(--target-line); border-radius: 13px; background: #fff; }
.ownership-panel .targets-section-heading > strong { font-family: 'Montserrat', sans-serif; font-size: 22px; font-variant-numeric: tabular-nums; }
.ownership-form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; }
.ownership-breakdown { margin: 15px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--target-line); }
.ownership-breakdown div { padding: 13px 10px 0; }
.ownership-breakdown div + div { border-left: 1px solid var(--target-line); }
.ownership-breakdown dt { color: var(--target-muted); font-size: 9px; }
.ownership-breakdown dd { margin: 5px 0 0; font-size: 11px; font-weight: 750; font-variant-numeric: tabular-nums; }

.scenario-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.scenario-card { min-width: 0; padding: 17px; border: 1px solid var(--target-line); border-radius: 12px; background: var(--target-surface-muted); }
.scenario-card.is-recommended { border-color: var(--target-green); background: var(--target-green-soft); }
.scenario-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.scenario-card-header p { margin: 0 0 4px; color: var(--target-muted); font-size: 9px; }
.scenario-card-header h3 { margin: 0; font-family: 'Montserrat', sans-serif; font-size: 15px; }
.scenario-card-header span { padding: 5px 7px; border-radius: 6px; background: #fff; color: var(--target-green); font-size: 8px; font-weight: 750; }
.scenario-inputs { margin-top: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.scenario-inputs label { display: grid; gap: 5px; color: var(--target-muted); font-size: 8px; }
.scenario-inputs input { min-width: 0; width: 100%; height: 34px; padding: 0 8px; border: 1px solid var(--target-line); border-radius: 7px; background: #fff; color: var(--target-ink); font-size: 10px; font-variant-numeric: tabular-nums; }
.scenario-results { margin: 14px 0 0; }
.scenario-results div { padding: 8px 0; display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid rgba(102, 113, 109, 0.16); }
.scenario-results dt { color: var(--target-muted); font-size: 9px; }
.scenario-results dd { margin: 0; font-size: 10px; font-weight: 750; font-variant-numeric: tabular-nums; text-align: right; }
.scenario-disclaimer { margin: 13px 0 0; display: flex; align-items: flex-start; gap: 7px; color: var(--target-muted); font-size: 9px; line-height: 1.5; }

.target-dialog { width: min(620px, calc(100vw - 32px)); max-height: min(680px, calc(100dvh - 32px)); margin: auto; padding: 0; overflow: hidden; border: 1px solid var(--target-line-strong); border-radius: 17px; background: #fff; color: var(--target-ink); box-shadow: 0 22px 52px rgba(20, 34, 58, 0.22); }
.target-dialog::backdrop { background: rgba(20, 34, 58, 0.3); }
.target-dialog > form { max-height: min(680px, calc(100dvh - 32px)); display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; }
.target-dialog header { padding: 18px 20px; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--target-line); }
.target-dialog header p { margin-bottom: 4px; }
.target-dialog h2,
.target-confirm-dialog h2 { margin: 0; font-family: 'Montserrat', sans-serif; font-size: 20px; text-wrap: balance; }
.target-dialog header button { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--target-line); border-radius: 50%; background: var(--target-surface-muted); color: var(--target-muted); }
.target-dialog-fields { padding: 18px 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 13px; overflow-y: auto; }
.target-dialog-fields input,
.target-dialog-fields select { width: 100%; min-width: 0; height: 40px; padding: 0 10px; border: 1px solid var(--target-line); border-radius: 8px; background: #fff; color: var(--target-ink); font-size: 11px; }
.target-dialog-wide { grid-column: 1 / -1; }
.target-dialog-error { min-height: 18px; margin: 0; padding: 0 20px; color: var(--target-red); font-size: 10px; }
.target-dialog footer,
.target-confirm-dialog footer { padding: 13px 20px max(13px, env(safe-area-inset-bottom)); display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--target-line); }
.target-deposit-dialog { width: min(430px, calc(100vw - 32px)); }
.target-confirm-dialog { width: min(460px, calc(100vw - 32px)); }
.target-confirm-dialog > div { padding: 22px; }
.target-confirm-dialog > div > p { margin-bottom: 5px; }
.target-confirm-dialog > div > span { display: block; margin-top: 9px; color: var(--target-muted); font-size: 10px; line-height: 1.55; text-wrap: pretty; }
.target-danger-button { border: 0; background: var(--target-red); color: #fff; }
.targets-toast { position: fixed; right: 22px; bottom: max(22px, env(safe-area-inset-bottom)); z-index: 500; max-width: min(380px, calc(100vw - 32px)); padding: 11px 14px; border-radius: 9px; background: var(--target-ink); color: #fff; font-size: 11px; opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity 160ms ease-out, transform 160ms ease-out; }
.targets-toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1120px) {
  .targets-workspace { padding-inline: 24px; }
  .target-detail-grid,
  .affordability-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .targets-intro { align-items: flex-start; flex-direction: column; }
  .targets-card-row { grid-template-columns: 1fr 1fr; }
  .scenario-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .targets-workspace { padding: 24px 16px 52px; }
  .targets-intro-actions { width: 100%; align-items: stretch; flex-direction: column; }
  .targets-card-row { grid-template-columns: 1fr; }
  .targets-detail,
  .targets-affordability,
  .targets-scenarios { padding: 17px; }
  .target-detail-header,
  .targets-section-heading { align-items: flex-start; flex-direction: column; }
  .target-detail-actions { width: 100%; }
  .target-detail-actions .targets-quiet-button { flex: 1; }
  .target-progress-summary { align-items: flex-start; }
  .ownership-form { grid-template-columns: 1fr 1fr; }
  .ownership-breakdown { grid-template-columns: 1fr; }
  .ownership-breakdown div + div { border-left: 0; }
  .target-progress-metrics { grid-template-columns: 1fr; }
  .target-progress-metrics div + div { border-top: 1px solid rgba(255, 255, 255, 0.12); border-left: 0; }
}

@media (max-width: 520px) {
  .target-plan-form,
  .ownership-form,
  .target-dialog-fields { grid-template-columns: 1fr; }
  .target-plan-wide,
  .target-dialog-wide { grid-column: auto; }
  .target-progress-summary { flex-direction: column; }
  .target-plan-actions { align-items: stretch; flex-direction: column-reverse; }
  .target-plan-actions button { width: 100%; }
  .scenario-inputs { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .targets-toast { transition: none; }
}
