:root {
  --ink: #15201d;
  --muted: #65716d;
  --line: #e5eae7;
  --surface: #ffffff;
  --canvas: #f6f8f6;
  --green: #296b56;
  --green-soft: #e3f0e9;
  --blue: #345f89;
  --blue-soft: #e4edf6;
}

html {
  font-size: 16px;
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: radial-gradient(circle at 12% 4%, rgba(207, 229, 218, 0.58), transparent 28rem), var(--canvas);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

.app-navbar {
  padding: 1.15rem 0;
  background: rgba(246, 248, 246, 0.84);
  border-bottom: 1px solid rgba(229, 234, 231, 0.8);
  backdrop-filter: blur(14px);
}

.navbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.brand-mark {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  color: white;
  background: var(--ink);
  border-radius: 0.65rem;
}

.brand-mark svg {
  width: 1.05rem;
  height: 1.05rem;
}

.app-nav-links {
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem;
  background: rgba(229, 234, 231, 0.58);
  border: 1px solid rgba(217, 224, 220, 0.8);
  border-radius: 0.85rem;
}

.app-nav-links .nav-link {
  padding: 0.55rem 0.9rem;
  color: var(--muted);
  border-radius: 0.6rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.app-nav-links .nav-link:hover,
.app-nav-links .nav-link:focus {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
}

.app-nav-links .nav-link.active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 2px 8px rgba(34, 50, 44, 0.08);
}

.signout-nav-item {
  margin-left: 0.35rem;
  padding-left: 0.65rem;
  border-left: 1px solid #cfd7d2;
}

.logout-button {
  width: 100%;
  border: 0;
  text-align: left;
}

.login-page {
  display: grid;
  min-height: calc(100vh - 155px);
  padding: 3rem 0;
  place-items: center;
}

.login-card {
  width: min(100%, 430px);
  padding: clamp(2rem, 6vw, 3.25rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 1.5rem;
  box-shadow: 0 20px 60px rgba(34, 50, 44, 0.1);
}

.login-icon {
  display: grid;
  width: 3.25rem;
  height: 3.25rem;
  margin-bottom: 1.75rem;
  place-items: center;
  color: var(--green);
  background: var(--green-soft);
  border-radius: 1rem;
}

.login-icon svg {
  width: 1.5rem;
  height: 1.5rem;
}

.login-card h1 {
  margin: 0.35rem 0 0.5rem;
  font-size: 2.25rem;
  font-weight: 720;
  letter-spacing: -0.05em;
}

.login-card > p {
  margin: 0;
  color: var(--muted);
}

.login-form {
  display: flex;
  margin-top: 2rem;
  flex-direction: column;
  gap: 1.15rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-field label {
  color: #4e5a56;
  font-size: 0.78rem;
  font-weight: 700;
}

.form-field input {
  width: 100%;
  padding: 0.8rem 0.9rem;
  color: var(--ink);
  background: #fbfcfb;
  border: 1px solid #dce3df;
  border-radius: 0.75rem;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.form-field input:focus {
  border-color: #75a994;
  box-shadow: 0 0 0 3px rgba(76, 146, 120, 0.13);
}

.form-field > span,
.login-error {
  color: #a34848;
  font-size: 0.74rem;
}

.login-error:empty,
.form-field > span:empty {
  display: none;
}

.login-button {
  margin-top: 0.35rem;
  padding: 0.85rem 1rem;
  color: white;
  background: var(--ink);
  border: 0;
  border-radius: 0.75rem;
  font-size: 0.88rem;
  font-weight: 700;
  transition: transform 150ms ease, background 150ms ease;
}

.login-button:hover {
  background: #24332f;
  transform: translateY(-1px);
}

.app-shell {
  min-height: calc(100vh - 154px);
}

.dashboard-section {
  padding: 4.5rem 0 6rem;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 1.4rem;
}

.section-kicker {
  display: block;
  margin-bottom: 0.4rem;
  color: #88938f;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.035em;
}

.section-count {
  color: #89928f;
  font-size: 0.82rem;
}

.dashboard-card {
  display: flex;
  min-height: 190px;
  padding: 1.8rem;
  align-items: flex-start;
  gap: 1.2rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 1.35rem;
  box-shadow: 0 14px 42px rgba(34, 50, 44, 0.055);
  text-decoration: none;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.dashboard-card:hover {
  color: var(--ink);
  border-color: #d4dcd7;
  box-shadow: 0 20px 50px rgba(34, 50, 44, 0.1);
  transform: translateY(-4px);
}

.card-icon,
.detail-icon {
  display: grid;
  flex: 0 0 auto;
  width: 3.2rem;
  height: 3.2rem;
  place-items: center;
  border-radius: 1rem;
}

.card-icon svg,
.detail-icon svg {
  width: 1.55rem;
  height: 1.55rem;
}

.family-loan-card .card-icon,
.family-detail .detail-icon {
  color: var(--green);
  background: var(--green-soft);
}

.bank-loan-card .card-icon,
.bank-detail .detail-icon {
  color: var(--blue);
  background: var(--blue-soft);
}

.budget-card .card-icon,
.budget-icon {
  color: #8a6534;
  background: #f5ead8;
}

.mortgage-card .card-icon,
.mortgage-icon {
  color: #775b91;
  background: #eee7f5;
}

.nomad-card .card-icon,
.nomad-icon {
  color: #b64f31;
  background: #fae9e2;
}

.nomad-page { padding: 3.5rem 0 6rem; }

.nomad-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.nomad-header h1 {
  margin: 0.3rem 0 0.55rem;
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  font-weight: 720;
  letter-spacing: -0.055em;
}

.nomad-header p { margin: 0; color: var(--muted); }
.nomad-icon { width: 3.7rem; height: 3.7rem; }

.nomad-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.nomad-summary article,
.nomad-timeline-card,
.nomad-table-card {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 14px 42px rgba(34, 50, 44, 0.055);
}

.nomad-summary article {
  display: flex;
  min-height: 145px;
  padding: 1.3rem;
  flex-direction: column;
  border-radius: 1.1rem;
}

.nomad-summary span,
.nomad-summary small { color: var(--muted); }
.nomad-summary span { font-size: 0.75rem; font-weight: 750; letter-spacing: 0.05em; text-transform: uppercase; }
.nomad-summary strong { margin: auto 0 0.1rem; font-size: 2rem; letter-spacing: -0.04em; }
.nomad-summary small { font-size: 0.78rem; }

.nomad-timeline-card,
.nomad-table-card { padding: 1.5rem; border-radius: 1.25rem; }
.nomad-timeline-card { margin-bottom: 1.25rem; }
.nomad-card-heading { margin-bottom: 1.35rem; }
.nomad-card-heading h2 { margin: 0.15rem 0 0; font-size: 1.25rem; }
.nomad-timeline-scroll { overflow-x: auto; padding-bottom: 0.5rem; }
.nomad-timeline { min-width: 880px; padding-left: 100px; }

.nomad-months {
  position: relative;
  height: 2rem;
  margin-left: 0;
}

.nomad-months span {
  position: absolute;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 750;
  text-transform: uppercase;
  transform: translateX(0.35rem);
}

.nomad-chart { position: relative; }

.nomad-month-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: #e4e9e6;
}

.nomad-country-row {
  position: relative;
  display: grid;
  min-height: 3.35rem;
  grid-template-columns: 100px 1fr;
  align-items: center;
  margin-left: -100px;
}

.nomad-country-row > strong {
  padding-right: 0.8rem;
  font-size: 0.8rem;
  text-align: right;
}

.nomad-country-track { position: relative; height: 2.25rem; }

.nomad-stay {
  position: absolute;
  top: 0;
  display: grid;
  min-width: 1.45rem;
  height: 2.25rem;
  place-items: center;
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 0.55rem;
  box-shadow: 0 4px 10px rgba(28, 38, 34, 0.15);
  font-size: 0.78rem;
  font-weight: 800;
  cursor: default;
}

.nomad-stay::after {
  position: absolute;
  bottom: calc(100% + 0.55rem);
  left: 50%;
  z-index: 5;
  width: max-content;
  max-width: 13rem;
  padding: 0.5rem 0.65rem;
  color: #fff;
  background: var(--ink);
  border-radius: 0.5rem;
  box-shadow: 0 7px 20px rgba(21, 32, 29, 0.2);
  content: attr(data-tooltip);
  font-size: 0.7rem;
  font-weight: 650;
  line-height: 1.3;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 0.25rem);
  transition: opacity 120ms ease, transform 120ms ease;
}

.nomad-stay:hover,
.nomad-stay:focus-visible {
  z-index: 4;
  outline: none;
}

.nomad-stay:hover::after,
.nomad-stay:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.nomad-peru { background: #e75d32; }
.nomad-colombia { background: #36b88a; }
.nomad-chile { background: #7259d9; }
.nomad-argentina { background: #e64e92; }
.nomad-bolivia { background: #e9a623; }
.nomad-england { background: #83bd24; }

.nomad-totals {
  display: flex;
  gap: 0.65rem 1.2rem;
  margin-top: 1.35rem;
  flex-wrap: wrap;
}

.nomad-totals > span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.nomad-totals i,
.nomad-dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
}

.nomad-totals strong { color: var(--ink); }
.nomad-table { width: 100%; border-collapse: collapse; }
.nomad-table th,
.nomad-table td { padding: 0.95rem 0.7rem; border-bottom: 1px solid var(--line); }
.nomad-table thead th { color: var(--muted); font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; }
.nomad-table tbody tr:last-child th,
.nomad-table tbody tr:last-child td { border-bottom: 0; }
.nomad-table tbody th { font-size: 0.88rem; font-weight: 700; }
.nomad-table tbody th span { color: var(--muted); font-weight: 500; }
.nomad-table tbody td { color: var(--muted); font-size: 0.85rem; }
.nomad-dot { margin-right: 0.55rem; }

.mortgage-page { padding: 3.5rem 0 6rem; }

.mortgage-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.mortgage-header h1 {
  margin: 0.3rem 0 0.55rem;
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  font-weight: 720;
  letter-spacing: -0.055em;
}

.mortgage-header p { margin: 0; color: var(--muted); }
.mortgage-icon { width: 3.7rem; height: 3.7rem; }

.mortgage-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.mortgage-summary-card,
.mortgage-flow-card,
.mortgage-tax-card,
.mortgage-annual-card {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 14px 42px rgba(34, 50, 44, 0.055);
}

.mortgage-summary-card {
  display: flex;
  min-height: 155px;
  padding: 1.35rem;
  flex-direction: column;
  border-radius: 1.15rem;
}

.mortgage-summary-card span,
.mortgage-summary-card small { color: var(--muted); }
.mortgage-summary-card span { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; }
.mortgage-summary-card strong { margin: auto 0 0.2rem; font-size: 2rem; letter-spacing: -0.045em; }
.mortgage-summary-card small { font-size: 0.78rem; }

.mortgage-rent-card {
  color: #fff;
  background: linear-gradient(145deg, #59446d, #745a8d);
  border-color: transparent;
}

.mortgage-rent-card span,
.mortgage-rent-card small { color: rgba(255, 255, 255, 0.72); }
.mortgage-left-card strong { color: var(--green); }

.mortgage-content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.mortgage-flow-card,
.mortgage-tax-card,
.mortgage-annual-card { padding: 1.5rem; border-radius: 1.25rem; }
.mortgage-card-heading { padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.mortgage-card-heading h2,
.mortgage-tax-card h2 { margin: 0.15rem 0 0; font-size: 1.2rem; }
.mortgage-flow { display: grid; }

.mortgage-flow-row {
  display: flex;
  justify-content: space-between;
  padding: 0.8rem 0;
  color: var(--muted);
  border-bottom: 1px solid #edf1ef;
  font-size: 0.9rem;
}

.mortgage-flow-row strong { color: var(--ink); }
.mortgage-flow-income strong { color: var(--green); }
.mortgage-flow-subtotal { color: var(--ink); font-weight: 700; }

.mortgage-flow-result {
  margin-top: 0.75rem;
  padding: 1rem;
  color: var(--green);
  background: var(--green-soft);
  border: 0;
  border-radius: 0.85rem;
  font-weight: 750;
}

.mortgage-flow-result strong { color: inherit; }
.tax-calculation { display: grid; gap: 0.95rem; margin-top: 1.5rem; }
.tax-calculation > div { display: flex; justify-content: space-between; gap: 1rem; color: var(--muted); font-size: 0.88rem; }
.tax-calculation strong { color: var(--ink); }
.tax-calculation .tax-total { padding-top: 1rem; color: var(--ink); border-top: 1px solid var(--line); font-weight: 750; }
.mortgage-tax-card p { margin: 1.5rem 0 0; color: var(--muted); font-size: 0.78rem; line-height: 1.5; }

.mortgage-table { width: 100%; margin-top: 0.5rem; border-collapse: collapse; }
.mortgage-table th,
.mortgage-table td { padding: 0.9rem 0.5rem; border-bottom: 1px solid var(--line); }
.mortgage-table thead th { color: var(--muted); font-size: 0.72rem; letter-spacing: 0.05em; text-transform: uppercase; }
.mortgage-table tbody th { font-weight: 600; }
.mortgage-table-total th,
.mortgage-table-total td { color: var(--green); font-weight: 800; border-bottom: 0; }

.budget-page { padding: 3.5rem 0 6rem; }

.budget-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.budget-header h1 {
  margin: 0.3rem 0 0.55rem;
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  font-weight: 720;
  letter-spacing: -0.055em;
}

.budget-header p { margin: 0; color: var(--muted); }
.budget-icon { width: 3.7rem; height: 3.7rem; }

.budget-tabs {
  display: inline-flex;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  padding: 0.3rem;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: var(--surface);
}

.budget-tabs a {
  padding: 0.55rem 1rem;
  border-radius: 0.6rem;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
}

.budget-tabs a:hover { color: var(--ink); }

.budget-tabs a.active {
  color: #fff;
  background: var(--ink);
}

.budget-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.budget-total-card,
.budget-list-card {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 14px 42px rgba(34, 50, 44, 0.055);
}

.budget-total-card {
  display: flex;
  min-height: 155px;
  padding: 1.35rem;
  flex-direction: column;
  border-radius: 1.15rem;
}

.budget-total-card > span,
.budget-total-card small { color: var(--muted); }

.budget-total-card > span {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.budget-total-card strong {
  margin: auto 0 0.2rem;
  font-size: 2rem;
  letter-spacing: -0.045em;
}

.budget-total-card small { font-size: 0.78rem; }

.budget-income-card {
  color: #fff;
  background: linear-gradient(145deg, #304d43, #41675a);
  border-color: transparent;
}

.budget-income-card > span,
.budget-income-card small { color: rgba(255, 255, 255, 0.72); }
.budget-disposable-card strong { color: var(--green); }

.budget-progress {
  height: 0.45rem;
  margin: 1.15rem 0 1.7rem;
  overflow: hidden;
  background: #e7ece9;
  border-radius: 999px;
}

.budget-progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #477d69, #69a28c);
  border-radius: inherit;
}

.budget-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  gap: 1.25rem;
}

.budget-list-card { padding: 1.5rem; border-radius: 1.25rem; }

.budget-card-heading,
.budget-item-row,
.budget-balance {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.budget-card-heading { padding-bottom: 1.2rem; border-bottom: 1px solid var(--line); }
.budget-card-heading h2 { margin: 0.15rem 0 0; font-size: 1.2rem; }
.budget-card-heading > strong { font-size: 1.25rem; }
.budget-items { display: grid; gap: 1.15rem; padding: 1.35rem 0; }
.budget-item-row { margin-bottom: 0.45rem; font-size: 0.9rem; }
.budget-item-row strong { font-size: 0.92rem; }

.budget-item-bar {
  height: 0.35rem;
  overflow: hidden;
  background: #edf1ef;
  border-radius: 999px;
}

.budget-item-bar span {
  display: block;
  height: 100%;
  background: #719a8a;
  border-radius: inherit;
}

.budget-plan-bar span { background: #bd9055; }

.budget-balance {
  padding: 1rem;
  color: var(--green);
  background: var(--green-soft);
  border-radius: 0.9rem;
  font-size: 0.88rem;
  font-weight: 650;
}

.budget-balance-over { color: #a24d45; background: #faece9; }

.card-content {
  display: flex;
  flex: 1;
  flex-direction: column;
}

.card-label {
  margin: 0.1rem 0 1.45rem;
  color: #8a9490;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card-content strong {
  margin-bottom: 0.35rem;
  font-size: 1.3rem;
  letter-spacing: -0.025em;
}

.card-content > span:last-child {
  color: var(--muted);
  font-size: 0.9rem;
}

.card-arrow {
  align-self: flex-end;
  color: #8b9591;
  font-size: 1.4rem;
  transition: transform 180ms ease;
}

.dashboard-card:hover .card-arrow {
  transform: translateX(4px);
}

.detail-page {
  max-width: 860px;
  margin: 0 auto;
  padding: 4.5rem 0 6rem;
}

.back-link {
  display: inline-block;
  margin-bottom: 1.4rem;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
}

.back-link:hover {
  color: var(--ink);
}

.detail-card {
  padding: clamp(2rem, 6vw, 4.5rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 1.5rem;
  box-shadow: 0 18px 55px rgba(34, 50, 44, 0.07);
}

.detail-icon {
  width: 3.7rem;
  height: 3.7rem;
  margin-bottom: 2rem;
}

.detail-card h1 {
  margin: 0.35rem 0 0.7rem;
  font-size: clamp(2.4rem, 6vw, 4rem);
  font-weight: 720;
  letter-spacing: -0.055em;
}

.detail-card > p {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.empty-state {
  margin-top: 3rem;
  padding: 2.25rem;
  color: #7a8581;
  background: #f8faf8;
  border: 1px dashed #d5ddd8;
  border-radius: 1rem;
  text-align: center;
}

.loan-page {
  padding: 3.5rem 0 6rem;
}

.loan-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.loan-header h1 {
  margin: 0.3rem 0 0.55rem;
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  font-weight: 720;
  letter-spacing: -0.055em;
}

.loan-header p {
  margin: 0;
  color: var(--muted);
}

.family-loan-icon {
  width: 3.7rem;
  height: 3.7rem;
  color: var(--green);
  background: var(--green-soft);
}

.bank-loan-icon {
  width: 3.7rem;
  height: 3.7rem;
  color: var(--blue);
  background: var(--blue-soft);
}

.schedule-count {
  padding: 0.45rem 0.7rem;
  color: var(--muted);
  background: #f3f6f5;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.balance-chart-card {
  position: relative;
  margin-bottom: 1.5rem;
  padding: 1.5rem 1.65rem 1rem;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  box-shadow: 0 14px 42px rgba(34, 50, 44, 0.055);
}

.balance-chart-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.balance-chart-heading h2 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.chart-change {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
}

.chart-change span {
  color: #8a9490;
  font-size: 0.68rem;
}

.chart-change strong {
  color: var(--green);
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.balance-chart {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 800 / 245;
  margin-top: 0.65rem;
  overflow: visible;
}

.chart-grid-line {
  stroke: #e8ece9;
  stroke-width: 1;
  stroke-dasharray: 4 6;
}

.chart-area {
  fill: url(#balance-area-gradient);
}

.chart-line {
  fill: none;
  stroke: var(--green);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.chart-start-point,
.chart-end-point {
  fill: var(--surface);
  stroke: var(--green);
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}

.chart-end-halo {
  fill: rgba(76, 146, 120, 0.16);
}

.chart-hover-points circle {
  fill: transparent;
  stroke: transparent;
  cursor: crosshair;
  outline: none;
}

.chart-hover-points circle:hover,
.chart-hover-points circle:focus {
  fill: var(--surface);
  stroke: var(--green);
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}

.chart-axis-label {
  fill: #97a09c;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.chart-values {
  display: flex;
  margin: -0.4rem 0 0;
  justify-content: space-between;
  color: #6f7a76;
  font-size: 0.72rem;
  font-weight: 650;
}

.chart-tooltip {
  position: absolute;
  z-index: 2;
  display: flex;
  min-width: 130px;
  padding: 0.65rem 0.75rem;
  flex-direction: column;
  gap: 0.1rem;
  color: white;
  background: var(--ink);
  border-radius: 0.65rem;
  box-shadow: 0 10px 28px rgba(21, 32, 29, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 12px));
  transition: opacity 100ms ease;
}

.chart-tooltip.is-visible {
  opacity: 1;
}

.chart-tooltip span {
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.65rem;
}

.chart-tooltip strong {
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.loan-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.summary-card {
  display: flex;
  min-height: 150px;
  padding: 1.35rem;
  flex-direction: column;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  box-shadow: 0 10px 30px rgba(34, 50, 44, 0.04);
}

.summary-card > span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
}

.summary-card strong {
  display: block;
  font-size: clamp(1.35rem, 2.3vw, 1.85rem);
  letter-spacing: -0.045em;
}

.summary-card small {
  color: #8a9490;
  font-size: 0.7rem;
  line-height: 1.4;
}

.summary-card-primary {
  color: white;
  background: var(--ink);
  border-color: var(--ink);
}

.summary-card-primary > span,
.summary-card-primary small {
  color: rgba(255, 255, 255, 0.65);
}

.ledger-card {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  box-shadow: 0 14px 42px rgba(34, 50, 44, 0.055);
}

.ledger-heading {
  display: flex;
  padding: 1.5rem 1.65rem;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.ledger-heading h2 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.sort-button {
  display: inline-flex;
  padding: 0.65rem 0.85rem;
  align-items: center;
  gap: 0.45rem;
  color: #43504c;
  background: #f5f7f5;
  border: 1px solid #e2e7e4;
  border-radius: 0.7rem;
  font-size: 0.76rem;
  font-weight: 650;
  text-decoration: none;
}

.sort-button:hover {
  color: var(--ink);
  background: #eef2ef;
}

.sort-button svg {
  width: 1rem;
  height: 1rem;
}

.loan-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.loan-table th,
.loan-table td {
  padding: 1rem 1.65rem;
  border-bottom: 1px solid #edf0ee;
  white-space: nowrap;
}

.loan-table thead th {
  color: #89928f;
  background: #fafbfa;
  font-size: 0.67rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.loan-table tbody tr:last-child th,
.loan-table tbody tr:last-child td {
  border-bottom: 0;
}

.loan-table tbody tr:hover {
  background: #fbfcfb;
}

.loan-table .projected-row {
  background: #f7faf8;
}

.loan-table .projected-row:hover {
  background: #f1f7f3;
}

.loan-table tbody th {
  font-size: 0.86rem;
  font-weight: 700;
}

.loan-table tbody td {
  color: #5f6b67;
  font-size: 0.84rem;
}

.principal-reduction {
  color: var(--blue);
  font-weight: 700;
}

.month-name,
.month-year {
  display: block;
}

.month-year {
  margin-top: 0.12rem;
  color: #98a09d;
  font-size: 0.68rem;
  font-weight: 550;
}

.projected-label {
  display: inline-block;
  margin-top: 0.35rem;
  padding: 0.16rem 0.38rem;
  color: var(--green);
  background: var(--green-soft);
  border-radius: 0.35rem;
  font-size: 0.52rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.interest-amount {
  color: #a15f43 !important;
}

.repayment-amount {
  color: var(--green);
  font-weight: 700;
}

.no-payment {
  color: #a9b0ad;
}

.balance-amount {
  color: var(--ink) !important;
  font-weight: 750;
}

.calculation-note {
  max-width: 760px;
  margin: 1.1rem auto 0;
  color: #8a9490;
  font-size: 0.72rem;
  line-height: 1.55;
  text-align: center;
}

.projection-button {
  display: flex;
  max-width: 440px;
  margin: 1.6rem auto 0;
  padding: 1rem 1.15rem;
  align-items: center;
  gap: 0.9rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid #dce3df;
  border-radius: 1rem;
  box-shadow: 0 10px 30px rgba(34, 50, 44, 0.055);
  text-decoration: none;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.projection-button:hover {
  color: var(--ink);
  border-color: #cbd7d0;
  box-shadow: 0 14px 34px rgba(34, 50, 44, 0.1);
  transform: translateY(-2px);
}

.projection-button-active {
  border-color: #bad4c8;
  background: #f5faf7;
}

.projection-icon {
  display: grid;
  width: 2.65rem;
  height: 2.65rem;
  flex: 0 0 auto;
  place-items: center;
  color: var(--green);
  background: var(--green-soft);
  border-radius: 0.8rem;
}

.projection-icon svg {
  width: 1.25rem;
  height: 1.25rem;
}

.projection-button > span:last-child {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}

.projection-button strong {
  font-size: 0.9rem;
}

.projection-button small {
  color: var(--muted);
  font-size: 0.72rem;
}

.app-footer {
  padding: 1.5rem 0;
  color: #8b9491;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
}

.app-footer .container {
  display: flex;
  justify-content: space-between;
}

.btn:focus,
.nav-link:focus,
a:focus-visible {
  outline: 3px solid rgba(52, 95, 137, 0.25);
  outline-offset: 3px;
  box-shadow: none;
}

@media (max-width: 767.98px) {
  .budget-summary-grid,
  .budget-columns,
  .mortgage-summary-grid,
  .mortgage-content-grid,
  .nomad-summary {
    grid-template-columns: 1fr;
  }

  .app-navbar {
    padding: 0.85rem 0;
  }

  .navbar-collapse {
    padding-top: 0.8rem;
  }

  .app-nav-links {
    align-items: stretch;
    gap: 0.2rem;
    padding: 0.45rem;
  }

  .signout-nav-item {
    margin: 0.35rem 0 0;
    padding: 0.35rem 0 0;
    border-top: 1px solid #cfd7d2;
    border-left: 0;
  }

  .dashboard-section {
    padding-top: 2.75rem;
  }

  .dashboard-card {
    min-height: 175px;
  }

  .detail-page {
    padding-top: 2.5rem;
  }

  .loan-page {
    padding-top: 2.5rem;
  }

  .loan-header .detail-icon {
    display: none;
  }

  .loan-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .balance-chart-card {
    padding: 1.25rem 1rem 0.9rem;
  }

  .ledger-heading {
    align-items: flex-start;
    gap: 1rem;
  }

  .sort-button {
    flex: 0 0 auto;
  }

  .loan-table th,
  .loan-table td {
    padding: 0.9rem 1rem;
  }
}

@media (max-width: 420px) {
  .loan-summary-grid {
    grid-template-columns: 1fr;
  }

  .summary-card {
    min-height: 130px;
  }

  .ledger-heading {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dashboard-card,
  .card-arrow {
    transition: none;
  }
}
