:root {
  --th-bg: #f4f6f8;
  --th-bg-2: #eef2f6;
  --th-surface: rgba(255, 255, 255, 0.94);
  --th-surface-2: rgba(250, 252, 255, 0.92);
  --th-border: #d7dfe8;
  --th-border-strong: #c3cfdb;

  --th-text: #172133;
  --th-text-soft: #627084;
  --th-heading: #0f1728;

  --th-navy: #14213a;
  --th-navy-2: #1d3152;
  --th-blue: #2b63d9;
  --th-blue-2: #1f56c8;
  --th-cyan: #0ea5c6;
  --th-gold: #b89246;
  --th-gold-soft: rgba(184, 146, 70, 0.12);

  --th-success: #1f7a4d;
  --th-danger: #c14f4f;

  --th-shadow-sm: 0 8px 22px rgba(15, 23, 40, 0.06);
  --th-shadow-md: 0 18px 42px rgba(15, 23, 40, 0.10);
  --th-shadow-lg: 0 26px 64px rgba(15, 23, 40, 0.14);

  --th-radius-sm: 12px;
  --th-radius-md: 18px;
  --th-radius-lg: 28px;

  --th-container: 1200px;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(43, 99, 217, 0.05), transparent 22%),
    radial-gradient(circle at top right, rgba(184, 146, 70, 0.05), transparent 16%),
    linear-gradient(180deg, #f9fbfd 0%, var(--th-bg) 48%, var(--th-bg-2) 100%);
  color: var(--th-text);
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.container {
  max-width: var(--th-container);
}

h1, h2, h3, h4, h5, h6,
.navbar-brand,
.fw-bold,
.fw-semibold {
  color: var(--th-heading);
  letter-spacing: -0.028em;
}

.display-5 {
  font-size: clamp(2.35rem, 4.2vw, 4.1rem);
  line-height: 1.03;
  font-weight: 800 !important;
}

.lead {
  font-size: 1.1rem;
  color: var(--th-text-soft) !important;
}

p,
.text-muted,
.small {
  color: var(--th-text-soft) !important;
}

a {
  color: var(--th-blue);
  transition: color 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

a:hover {
  color: var(--th-blue-2);
}

/* Navbar */
.navbar.bg-dark {
  background:
    linear-gradient(135deg, rgba(11,17,29,0.96), rgba(20,33,58,0.96)) !important;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(10px);
}

.navbar {
  padding-top: 0.98rem;
  padding-bottom: 0.98rem;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.13);
}

.navbar-brand {
  color: #fff !important;
  font-size: 1.08rem;
  font-weight: 700 !important;
}

.navbar .nav-link {
  color: rgba(255,255,255,0.76) !important;
  font-weight: 500;
  padding: 0.62rem 0.88rem !important;
  border-radius: 999px;
}

.navbar .nav-link:hover,
.navbar .nav-link.active {
  color: #fff !important;
  background: rgba(255,255,255,0.08);
}

.navbar .btn-outline-light {
  border-radius: 999px;
  border-color: rgba(255,255,255,0.34);
}

.navbar .btn-outline-light:hover {
  background: rgba(255,255,255,0.08);
}

/* Market ticker */
#marketTicker {
  background: linear-gradient(90deg, #0d1627 0%, #1b2f4b 100%) !important;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 0.9rem;
  letter-spacing: 0.01em;
}

#marketTicker .container {
  min-height: 46px;
}

#marketTicker .up {
  color: #d7b363 !important;
  font-weight: 700;
}

#marketTicker .down {
  color: #ef7d7d !important;
  font-weight: 700;
}

/* Main spacing */
main.container {
  margin-top: 3.4rem !important;
  margin-bottom: 4rem !important;
}

/* Hero */
main > .row.align-items-center.mb-5 {
  margin-bottom: 2.15rem !important;
}

main > .row.align-items-center.mb-5 > .col-lg-7 {
  padding-right: 2rem;
}

main > .row.align-items-center.mb-5 .small.text-muted.mt-3 {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(255,255,255,0.72);
  color: var(--th-navy-2) !important;
  border: 1px solid rgba(43, 99, 217, 0.10);
  padding: 0.58rem 0.9rem;
  border-radius: 999px;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(15, 23, 40, 0.04);
}

main > .row.align-items-center.mb-5 > .col-lg-5 .card {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.96), rgba(248,250,253,0.94));
  border: 1px solid rgba(215, 223, 232, 0.95) !important;
  box-shadow: var(--th-shadow-md) !important;
}

#dashboardInsight {
  font-size: 1.34rem !important;
  font-weight: 700 !important;
  line-height: 1.38;
  color: var(--th-heading);
}

#dashboardInsightTime {
  color: var(--th-text-soft) !important;
}

/* Buttons */
.btn {
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: -0.01em;
  padding: 0.82rem 1.22rem;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-lg {
  padding: 0.95rem 1.42rem;
}

.btn-dark {
  background: linear-gradient(135deg, var(--th-navy) 0%, var(--th-blue) 100%);
  border: none;
  box-shadow: 0 12px 28px rgba(20, 33, 58, 0.18);
}

.btn-dark:hover,
.btn-dark:focus {
  background: linear-gradient(135deg, #101a2d 0%, var(--th-blue-2) 100%);
  box-shadow: 0 16px 34px rgba(20, 33, 58, 0.22);
}

.btn-outline-dark {
  color: var(--th-heading);
  border: 1px solid rgba(184, 146, 70, 0.24);
  background: rgba(255,255,255,0.78);
}

.btn-outline-dark:hover,
.btn-outline-dark:focus {
  background: rgba(184, 146, 70, 0.08);
  border-color: rgba(184, 146, 70, 0.42);
  color: var(--th-heading);
}

.btn-sm {
  padding: 0.58rem 0.96rem;
}

/* Cards */
.card {
  background: var(--th-surface);
  border-radius: var(--th-radius-md);
  border: 1px solid rgba(215, 223, 232, 0.88) !important;
  box-shadow: var(--th-shadow-sm) !important;
  backdrop-filter: blur(6px);
  overflow: hidden;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--th-shadow-md) !important;
  border-color: rgba(184, 146, 70, 0.20) !important;
}

.card .card-body {
  padding: 1.38rem;
}

.bg-light,
.card.bg-light {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.94), rgba(247,250,253,0.92)) !important;
}

.border.rounded,
.rounded {
  border-radius: var(--th-radius-sm) !important;
}

/* Linked cards */
a.text-decoration-none .card {
  position: relative;
}

a.text-decoration-none .card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid transparent;
  transition: border-color 0.2s ease;
  pointer-events: none;
}

a.text-decoration-none:hover .card::after {
  border-color: rgba(43, 99, 217, 0.14);
}

a.text-decoration-none:hover .card {
  transform: translateY(-4px);
  box-shadow: var(--th-shadow-md) !important;
}

a.text-decoration-none .fw-semibold,
a.text-decoration-none h3 {
  color: var(--th-heading);
}

a.text-decoration-none:hover .fw-semibold,
a.text-decoration-none:hover h3 {
  color: var(--th-blue);
}

/* Metric / info boxes */
.border.rounded.p-3.h-100,
.border.rounded.p-3.h-100.bg-light {
  border: 1px solid rgba(215, 223, 232, 0.9) !important;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.90), rgba(248,250,253,0.88)) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.72);
}

/* Numeric display */
#highestRateCard,
#bestTermCard,
#sampleEarningsCard,
#loadedCountCard,
#snapshotBestTerm,
#snapshotTreasuryAfterTax,
#snapshotAdvantage,
#ladderPerStep,
#ladderTotalEarnings,
#ladderEndingValue {
  color: var(--th-heading);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.035em;
}

.fs-4,
.fs-5 {
  font-variant-numeric: tabular-nums;
}

.fs-4 {
  font-size: 1.82rem !important;
  font-weight: 800 !important;
}

.fs-5 {
  font-size: 1.2rem !important;
  font-weight: 700 !important;
}

/* Headings */
.h4,
.h5,
.h6 {
  color: var(--th-heading);
}

h2.h4.mb-0,
h2.h4.mb-3 {
  font-weight: 800;
}

/* Forms */
.form-label {
  color: var(--th-heading) !important;
  font-weight: 700;
  margin-bottom: 0.45rem;
}

.form-control {
  min-height: 50px;
  padding: 0.8rem 0.95rem;
  border-radius: 14px;
  border: 1px solid rgba(195, 207, 219, 0.95);
  background: rgba(255,255,255,0.95);
  color: var(--th-text);
  box-shadow: inset 0 1px 2px rgba(15, 23, 40, 0.02);
}

.form-control:hover {
  border-color: rgba(184, 146, 70, 0.34);
}

.form-control:focus {
  border-color: rgba(43, 99, 217, 0.48);
  box-shadow: 0 0 0 0.22rem rgba(43, 99, 217, 0.11);
}

/* Chart */
#dashboardRatesChart {
  display: block;
}

/* Colors */
.text-success {
  color: var(--th-success) !important;
}

.text-danger {
  color: var(--th-danger) !important;
}

.text-dark {
  color: var(--th-text) !important;
}

/* Footer */
footer.bg-light {
  background:
    linear-gradient(180deg, rgba(248,250,252,0.96), rgba(237,242,247,0.96)) !important;
  border-top: 1px solid rgba(215, 223, 232, 0.95) !important;
}

footer h5,
footer h6 {
  color: var(--th-heading);
}

footer a {
  color: var(--th-text-soft) !important;
}

footer a:hover {
  color: var(--th-blue-2) !important;
}

footer hr {
  border-color: rgba(215, 223, 232, 0.95);
  opacity: 1;
}

/* Utilities */
.shadow-sm {
  box-shadow: var(--th-shadow-sm) !important;
}

.border-0 {
  border-color: transparent !important;
}

/* Spacing rhythm */
section.mb-5,
.card.mb-4,
.row.g-3.mb-4,
.card.mt-4 {
  margin-bottom: 1.55rem !important;
}

/* Responsive */
@media (max-width: 991.98px) {
  main > .row.align-items-center.mb-5 > .col-lg-7 {
    padding-right: calc(var(--bs-gutter-x) * .5);
  }

  .display-5 {
    font-size: clamp(2rem, 8vw, 3.2rem);
  }

  main .d-flex.flex-wrap.gap-2 {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 0.75rem !important;
  }

  .btn-lg {
    width: 100%;
  }

  .navbar .nav-link {
    border-radius: 12px;
  }
}

@media (max-width: 767.98px) {
  body {
    font-size: 0.98rem;
  }

  main.container {
    margin-top: 2rem !important;
    margin-bottom: 2.8rem !important;
  }

  .card .card-body {
    padding: 1.12rem;
  }

  .fs-4 {
    font-size: 1.42rem !important;
  }

  .fs-5 {
    font-size: 1.06rem !important;
  }

  #marketTicker .container {
    gap: 0.65rem !important;
  }
}
