@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500;600&display=swap");

:root {
  color-scheme: light;
  --bg: #ececec;
  --panel: #ffffff;
  --ink: #111111;
  --ink-soft: #3f3f3f;
  --line: #cfcfcf;
  --line-strong: #a7a7a7;
  --chip: #ededed;
  --focus: #1f1f1f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background:
    linear-gradient(180deg, #f5f5f5 0%, var(--bg) 100%),
    repeating-linear-gradient(
      0deg,
      rgba(0, 0, 0, 0.02) 0,
      rgba(0, 0, 0, 0.02) 1px,
      transparent 1px,
      transparent 36px
    );
}

.page {
  width: min(1160px, 100% - 2rem);
  margin: 0 auto;
  padding: 1.1rem 0 1.45rem;
  flex: 1 0 auto;
}

.hero {
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 0.8rem;
  padding: 1.2rem 1.25rem;
  display: flex;
  gap: 1.2rem;
  justify-content: space-between;
  align-items: flex-end;
  box-shadow: 0 16px 35px rgba(0, 0, 0, 0.08);
}

.kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.72rem;
  color: #2f2f2f;
}

h1,
h2 {
  margin: 0.45rem 0;
  line-height: 1.15;
  letter-spacing: 0.01em;
}

h1 {
  font-size: clamp(1.7rem, 2.5vw, 2.7rem);
}

h2 {
  font-size: clamp(1.2rem, 2vw, 1.7rem);
}

.lead,
.chart-series-subtitle {
  margin: 0;
  color: var(--ink-soft);
  max-width: 65ch;
}

button {
  font: inherit;
  border: 1px solid #202020;
  background: #111111;
  color: #f7f7f7;
  border-radius: 0.6rem;
  padding: 0.65rem 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease;
}

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

button:disabled {
  opacity: 0.58;
  cursor: wait;
  transform: none;
}

button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.status {
  margin-top: 1rem;
  font-size: 0.94rem;
  color: var(--ink-soft);
}

.cards {
  margin-top: 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.card-row {
  display: grid;
  gap: 0.8rem;
}

.card-row-usd {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.card-row-usd .card {
  flex: 0 1 calc((100% - 2.4rem) / 4);
  max-width: calc((100% - 2.4rem) / 4);
}

.card-row-market {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.card {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 0.8rem;
  padding: 0.95rem;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
  transition: border-color 130ms ease, transform 130ms ease;
}

.card:hover {
  border-color: #909090;
  transform: translateY(-1px);
}

.card.is-selected {
  border-color: #141414;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.09);
}

.card:focus-visible {
  outline: 2px solid #111111;
  outline-offset: 1px;
}

.card.is-stale {
  border-color: #bc7a7a;
}

@media (max-width: 1120px) {
  .card-row-usd .card {
    flex-basis: calc((100% - 1.6rem) / 3);
    max-width: calc((100% - 1.6rem) / 3);
  }

  .card-row-market {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 740px) {
  .card-row-usd .card {
    flex-basis: calc((100% - 0.8rem) / 2);
    max-width: calc((100% - 0.8rem) / 2);
  }

  .card-row-market {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .card-row-usd .card {
    flex-basis: 100%;
    max-width: 100%;
  }

  .card-row-market {
    grid-template-columns: 1fr;
  }
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.65rem;
}

.card-title {
  margin: 0;
  color: #444444;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  line-height: 1;
  flex-shrink: 0;
  font-size: 0.69rem;
  border-radius: 999px;
  padding: 0.18rem 0.48rem;
  background: var(--chip);
  color: #2d2d2d;
  border: 1px solid #d9d9d9;
}

.chip.pos {
  background: #e7f6ec;
  border-color: #8bc7a0;
  color: #1f6b37;
}

.chip.neg {
  background: #fbe9e9;
  border-color: #d69999;
  color: #8d2a2a;
}

.chip.neutral {
  background: #efefef;
  border-color: #cfcfcf;
  color: #353535;
}

.chip.risk-chip.risk-pos {
  background: #dcefe5;
  border-color: #6c9f83;
  color: #184f36;
}

.chip.risk-chip.risk-neg {
  background: #f6dddd;
  border-color: #bc7373;
  color: #7a2020;
}

.chip.risk-chip.risk-neutral {
  background: #ece9e0;
  border-color: #b8ab8f;
  color: #5f5641;
}

.card-value {
  margin: 0.85rem 0 0.32rem;
  font-size: 1.86rem;
  font-weight: 700;
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.value-inline-sub {
  font-size: 0.52em;
  font-weight: 600;
  color: #111111;
  letter-spacing: 0.01em;
}

.card-subtitle {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.86rem;
  line-height: 1.42;
}

.card-meta {
  margin-top: 0.52rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  font-size: 0.72rem;
}

.source-badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid #c8c8c8;
  background: #f4f4f4;
  border-radius: 999px;
  padding: 0.12rem 0.45rem;
  color: #262626;
  text-decoration: none;
  line-height: 1.2;
}

.updated-age {
  color: #3a3a3a;
  line-height: 1.2;
}

.stale-flag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.12rem 0.42rem;
  border: 1px solid #c47d7d;
  background: #f9e7e7;
  color: #7a2222;
  line-height: 1.2;
}

.tax-calc {
  margin-top: 1.15rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.9rem;
  padding: 1.15rem;
  background: var(--panel);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.08);
}

.tax-calc-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-end;
}

.tax-calc-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.48rem;
  align-items: end;
}

.tax-field {
  display: grid;
  gap: 0.28rem;
  font-size: 0.76rem;
  color: #333333;
}

.tax-field input {
  border: 1px solid var(--line-strong);
  border-radius: 0.56rem;
  background: #f8f8f8;
  color: #171717;
  padding: 0.48rem 0.58rem;
  font: inherit;
  min-width: 130px;
}

.tax-field-currency input {
  text-align: center;
  min-width: 88px;
}

.tax-list-wrap {
  margin-top: 0.58rem;
  border: 1px solid #d8d8d8;
  border-radius: 0.68rem;
  background: #fbfbfb;
  overflow: auto;
}

.tax-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

.tax-table th,
.tax-table td {
  text-align: left;
  padding: 0.54rem 0.62rem;
  border-bottom: 1px solid #e5e5e5;
  font-size: 0.82rem;
  white-space: nowrap;
}

.tax-table th {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.72rem;
  color: #525252;
  background: #f2f2f2;
}

.tax-table tbody tr:last-child td {
  border-bottom: 0;
}

.tax-method-cell {
  display: flex;
  align-items: center;
  gap: 0.48rem;
}

.tax-method-icon {
  display: inline-grid;
  place-items: center;
  width: 1.36rem;
  height: 1.36rem;
  border: 1px solid #c7c7c7;
  border-radius: 999px;
  background: #ffffff;
  font-size: 0.82rem;
  line-height: 1;
  flex-shrink: 0;
}

.tax-value,
.tax-rate {
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  font-weight: 600;
}

.tax-table tr.is-best td {
  background: #eef6f0;
}

.market-compare {
  margin-top: 1.15rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.9rem;
  padding: 1.15rem;
  background: var(--panel);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.08);
}

.market-compare-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-end;
}

.market-compare-grid {
  margin-top: 0.6rem;
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 0.62rem;
  align-items: start;
}

.market-field {
  display: grid;
  gap: 0.28rem;
  font-size: 0.76rem;
  color: #333333;
}

.market-items-input {
  border: 1px solid var(--line-strong);
  border-radius: 0.56rem;
  background: #f8f8f8;
  color: #171717;
  padding: 0.56rem 0.62rem;
  font: inherit;
  resize: vertical;
  min-height: 138px;
}

.market-list-wrap {
  border: 1px solid #d8d8d8;
  border-radius: 0.68rem;
  background: #fbfbfb;
  overflow: auto;
}

.market-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.market-table th,
.market-table td {
  text-align: left;
  padding: 0.54rem 0.62rem;
  border-bottom: 1px solid #e5e5e5;
  font-size: 0.82rem;
  white-space: nowrap;
}

.market-table th {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.72rem;
  color: #525252;
  background: #f2f2f2;
}

.market-table tbody tr:last-child td {
  border-bottom: 0;
}

.market-money-input {
  border: 1px solid var(--line-strong);
  border-radius: 0.48rem;
  background: #ffffff;
  color: #171717;
  font: inherit;
  padding: 0.34rem 0.48rem;
  width: 140px;
}

.market-change,
.market-per-item {
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  font-size: 0.8rem;
}

.market-change.market-pos {
  color: #8d2a2a;
}

.market-change.market-neg {
  color: #1f6b37;
}

.market-change.market-neutral {
  color: #4b4b4b;
}

.market-table tr.is-best td {
  background: #edf4ef;
}

.chart-panel {
  margin-top: 1.15rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.9rem;
  padding: 1.15rem;
  background: var(--panel);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.08);
}

.chart-panel.is-hidden {
  display: none;
}

.fci {
  margin-top: 1.15rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.9rem;
  padding: 1.15rem;
  background: var(--panel);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.08);
}

.fci-form {
  margin-top: 0.7rem;
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.55rem;
  align-items: end;
}

.fci-toolbar {
  margin-top: 0.72rem;
  display: flex;
  gap: 0.52rem;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.fci-search-field {
  margin-left: auto;
  display: grid;
  gap: 0.28rem;
  font-size: 0.74rem;
  color: #333333;
  min-width: 260px;
}

.fci-search-input {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #f8f8f8;
  color: #171717;
  padding: 0.42rem 0.72rem;
  font: inherit;
}

.fci-search-input::placeholder {
  color: #656565;
}

.fci-field {
  display: grid;
  gap: 0.36rem;
  font-size: 0.83rem;
  color: #3b3b3b;
}

.fci-field input {
  border: 1px solid var(--line-strong);
  border-radius: 0.56rem;
  background: #f8f8f8;
  padding: 0.52rem 0.6rem;
  color: #171717;
  font: inherit;
}

.fci-pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.38rem;
}

.fci-pill {
  border: 1px solid #b9b9b9;
  background: #f4f4f4;
  color: #202020;
  border-radius: 999px;
  padding: 0.28rem 0.62rem;
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.1;
  white-space: nowrap;
}

.fci-pill.is-active {
  background: #131313;
  color: #f8f8f8;
  border-color: #131313;
}

.fci-pill:disabled {
  opacity: 0.58;
  cursor: wait;
}

.fci-top-cards {
  margin-top: 0.72rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.52rem;
}

.fci-top-card {
  border: 1px solid #d8d8d8;
  border-radius: 0.66rem;
  background: #fbfbfb;
  padding: 0.62rem;
  display: grid;
  gap: 0.3rem;
}

.fci-top-rank {
  margin: 0;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #5d5d5d;
}

.fci-top-name {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.2;
}

.fci-top-rate {
  margin: 0.05rem 0 0;
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  font-size: 1rem;
  font-weight: 700;
}

.fci-top-meta {
  margin: 0;
  color: #484848;
  font-size: 0.76rem;
}

.fci-list-wrap {
  margin-top: 0.68rem;
  border: 1px solid #d8d8d8;
  border-radius: 0.68rem;
  background: #fbfbfb;
  overflow: auto;
}

.fci-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
}

.fci-table th,
.fci-table td {
  text-align: left;
  padding: 0.56rem 0.62rem;
  border-bottom: 1px solid #e5e5e5;
  font-size: 0.82rem;
  white-space: nowrap;
}

.fci-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.72rem;
  color: #525252;
  background: #f2f2f2;
}

.fci-sort-btn {
  border: 0;
  background: transparent;
  color: #3b3b3b;
  padding: 0;
  font: inherit;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
}

.fci-table tbody tr:last-child td {
  border-bottom: 0;
}

.fci-table-name {
  font-weight: 600;
}

.fci-fund-link {
  border: 0;
  background: transparent;
  color: #121212;
  font: inherit;
  font-weight: 700;
  padding: 0;
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.fci-table-yearly {
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  font-weight: 600;
}

.fci-table-vcp,
.fci-table-patrimonio {
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  font-weight: 600;
}

.fci-table-empty {
  text-align: center;
  color: #575757;
  font-size: 0.84rem;
  padding: 0.85rem;
}

.fci-list-actions {
  margin-top: 0.58rem;
  display: flex;
  justify-content: center;
}

.fci-more-btn {
  background: #f3f3f3;
  color: #191919;
  border: 1px solid #b4b4b4;
  border-radius: 999px;
  padding: 0.4rem 0.86rem;
}

.fci-more-btn.is-hidden {
  display: none;
}

.fci-results {
  margin-top: 0.75rem;
  display: grid;
  gap: 0.52rem;
}

.fci-row {
  border: 1px solid #d8d8d8;
  border-radius: 0.68rem;
  background: #fbfbfb;
  padding: 0.7rem 0.78rem;
  display: grid;
  gap: 0.42rem;
}

.fci-row-top {
  display: flex;
  justify-content: space-between;
  gap: 0.9rem;
  align-items: baseline;
}

.fci-name {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.fci-rate {
  margin: 0;
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  font-size: 0.91rem;
}

.fci-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.42rem;
}

.fci-metric {
  border: 1px solid #e1e1e1;
  border-radius: 0.5rem;
  padding: 0.46rem 0.52rem;
  background: #ffffff;
}

.fci-metric-label {
  margin: 0;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #616161;
}

.fci-metric-value {
  margin: 0.25rem 0 0;
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  font-size: 0.84rem;
}

.fci-foot {
  margin: 0;
  color: #5f5f5f;
  font-size: 0.76rem;
}

.fci-detail {
  margin-top: 0.82rem;
  border: 1px solid #d8d8d8;
  border-radius: 0.72rem;
  background: #fcfcfc;
  padding: 0.78rem;
  display: grid;
  gap: 0.58rem;
}

.fci-detail.is-hidden {
  display: none;
}

.fci-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
}

.fci-detail-close {
  border: 1px solid #bbbbbb;
  background: #f2f2f2;
  color: #1a1a1a;
  border-radius: 999px;
  padding: 0.28rem 0.74rem;
  font-size: 0.75rem;
}

.fci-detail-content {
  display: grid;
  gap: 0.7rem;
}

.fci-detail-main {
  display: grid;
  gap: 0.2rem;
}

.fci-detail-title {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}

.fci-detail-subtitle {
  margin: 0;
  color: #292929;
  font-weight: 600;
}

.fci-detail-line {
  margin: 0;
  color: #333333;
  font-size: 0.83rem;
}

.fci-detail-warning {
  margin: 0;
  border: 1px solid #d8d8d8;
  border-radius: 0.5rem;
  background: #f5f5f5;
  padding: 0.5rem 0.6rem;
  color: #2f2f2f;
  font-size: 0.78rem;
}

.fci-class-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.fci-class-chip {
  border: 1px solid #bcbcbc;
  background: #f5f5f5;
  color: #212121;
  border-radius: 999px;
  padding: 0.24rem 0.62rem;
  font-size: 0.72rem;
  line-height: 1.1;
  white-space: nowrap;
}

.fci-class-chip.is-active {
  border-color: #151515;
  background: #151515;
  color: #fafafa;
}

.fci-detail-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}

.fci-detail-kpi {
  border: 1px solid #dddddd;
  border-radius: 0.56rem;
  background: #ffffff;
  padding: 0.5rem 0.6rem;
}

.fci-detail-kpi-label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.67rem;
  color: #5a5a5a;
}

.fci-detail-kpi-value {
  margin: 0.3rem 0 0;
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  font-size: 0.97rem;
  font-weight: 700;
}

.fci-detail-kpi-meta {
  margin: 0.26rem 0 0;
  font-size: 0.74rem;
  color: #3d3d3d;
}

.fci-detail-section {
  border: 1px solid #dddddd;
  border-radius: 0.56rem;
  background: #ffffff;
  padding: 0.56rem 0.62rem;
  display: grid;
  gap: 0.42rem;
}

.fci-detail-section h4 {
  margin: 0;
  font-size: 0.84rem;
  letter-spacing: 0.03em;
}

.fci-detail-returns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
}

.fci-detail-return {
  border: 1px solid #e3e3e3;
  border-radius: 0.48rem;
  padding: 0.42rem 0.48rem;
  display: grid;
  gap: 0.18rem;
  background: #fbfbfb;
}

.fci-detail-return-label {
  margin: 0;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #5c5c5c;
}

.fci-detail-return-value {
  margin: 0;
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  font-size: 0.87rem;
  font-weight: 700;
}

.fci-detail-return-tna {
  margin: 0;
  font-size: 0.71rem;
  color: #444444;
}

.fci-comp-list {
  display: grid;
  gap: 0.24rem;
}

.fci-comp-row {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: baseline;
  border-bottom: 1px dashed #e2e2e2;
  padding-bottom: 0.2rem;
}

.fci-comp-name {
  font-size: 0.78rem;
}

.fci-comp-share {
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  font-size: 0.77rem;
}

.fci-fees {
  display: grid;
  gap: 0.22rem;
}

.fci-fee-row {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  align-items: baseline;
  border-bottom: 1px dashed #e2e2e2;
  padding-bottom: 0.2rem;
  font-size: 0.77rem;
}

.site-footer {
  margin-top: auto;
  border-top: 1px solid #cfcfcf;
  background: #f4f4f4;
}

.site-footer-inner {
  width: min(1160px, 100% - 2rem);
  margin: 0 auto;
  padding: 0.5rem 0 0.66rem;
  font-size: 0.9rem;
  color: #1c1c1c;
  text-align: center;
}

.site-footer-inner a {
  color: #111111;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.chart-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-end;
}

.range-group {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.42rem;
  min-width: 340px;
}

.range-group.is-hidden {
  display: none;
}

.inflation-range-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.42rem;
  min-width: 230px;
}

.inflation-range-group.is-hidden {
  display: none;
}

.range-btn {
  border: 1px solid #a8a8a8;
  background: #efefef;
  color: #191919;
  padding: 0.44rem 0.6rem;
  border-radius: 0.5rem;
  font-size: 0.8rem;
}

.range-btn.is-active {
  background: #141414;
  color: #f7f7f7;
  border-color: #141414;
}

.inflation-range-btn {
  border: 1px solid #a8a8a8;
  background: #efefef;
  color: #191919;
  padding: 0.44rem 0.6rem;
  border-radius: 0.5rem;
  font-size: 0.8rem;
}

.inflation-range-btn.is-active {
  background: #141414;
  color: #f7f7f7;
  border-color: #141414;
}

.chart-metrics {
  margin-top: 0.85rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
}

.metric {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 0.62rem;
  padding: 0.62rem 0.74rem;
  background: #fafafa;
}

.metric-label {
  margin: 0;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #5b5b5b;
}

.metric-value {
  margin: 0.36rem 0 0;
  font-size: 1.12rem;
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
}

.chart-wrap {
  margin-top: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 0.72rem;
  background: linear-gradient(180deg, #fafafa 0%, #f2f2f2 100%);
  padding: 0.4rem;
  position: relative;
  min-height: 290px;
}

#history-chart {
  width: 100%;
  height: 275px;
  display: block;
}

#history-grid line {
  stroke: #dadada;
  stroke-width: 1;
}

#history-area {
  fill: rgba(0, 0, 0, 0.08);
}

#history-line {
  fill: none;
  stroke: #171717;
  stroke-width: 2.2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

#history-overlay .chart-point {
  fill: #111111;
  stroke: #ffffff;
  stroke-width: 1.4;
}

#history-overlay .chart-point-subtle {
  fill: #1a1a1a;
  opacity: 0.7;
}

#history-overlay .chart-point-hit {
  fill: transparent;
  stroke: transparent;
  pointer-events: all;
}

#history-overlay .point-value-label {
  fill: #111111;
  font-size: 10px;
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  text-anchor: middle;
}

#history-overlay .point-x-label {
  fill: #4a4a4a;
  font-size: 10px;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  text-anchor: middle;
}

#history-overlay .axis-y-label {
  fill: #303030;
  font-size: 11px;
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  text-anchor: end;
}

#history-overlay .axis-x-label {
  fill: #303030;
  font-size: 11px;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  text-anchor: middle;
}

.chart-tooltip {
  position: absolute;
  z-index: 6;
  pointer-events: none;
  left: 0;
  top: 0;
  transform: translate(-50%, -110%);
  min-width: 140px;
  max-width: 260px;
  border: 1px solid #1a1a1a;
  border-radius: 0.54rem;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
  padding: 0.34rem 0.48rem;
  display: grid;
  gap: 0.16rem;
}

.chart-tooltip.is-hidden {
  display: none;
}

.chart-tooltip-value {
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  font-size: 0.8rem;
  color: #111111;
  font-weight: 700;
}

.chart-tooltip-date {
  font-size: 0.75rem;
  color: #222222;
}

.chart-empty {
  margin: 0;
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #3f3f3f;
  font-size: 0.94rem;
}

.range-btn:focus-visible,
.inflation-range-btn:focus-visible {
  outline: 2px solid #111111;
  outline-offset: 1px;
}

.chart-empty.is-hidden {
  display: none;
}

.history-points {
  display: none;
}

.history-points li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid #e4e4e4;
  border-radius: 0.48rem;
  background: #fbfbfb;
  padding: 0.42rem 0.55rem;
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  font-size: 0.78rem;
}

@media (max-width: 860px) {
  .tax-calc-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .tax-calc-controls {
    width: 100%;
    grid-template-columns: 1fr 120px;
  }

  .market-compare-grid {
    grid-template-columns: 1fr;
  }

  .market-money-input {
    width: 100%;
    min-width: 120px;
  }

  .tax-list-wrap,
  .market-list-wrap {
    -webkit-overflow-scrolling: touch;
  }

  .tax-table th:first-child,
  .tax-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background: #fbfbfb;
  }

  .tax-table th:first-child {
    background: #f2f2f2;
    z-index: 2;
  }

  .tax-table tr.is-best td:first-child {
    background: #eef6f0;
  }

  .market-table th:first-child,
  .market-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background: #fbfbfb;
  }

  .market-table th:first-child {
    background: #f2f2f2;
    z-index: 2;
  }

  .market-table tr.is-best td:first-child {
    background: #edf4ef;
  }

  .chart-panel-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .range-group {
    min-width: 0;
    width: 100%;
  }

  .inflation-range-group {
    min-width: 0;
    width: 100%;
  }

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

  .fci-form {
    grid-template-columns: 1fr;
  }

  .fci-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .fci-search-field {
    margin-left: 0;
    min-width: 0;
  }

  .fci-top-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .fci-detail-returns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

}

@media (max-width: 760px) {
  .page {
    width: min(1160px, 100% - 1.25rem);
    padding: 0.88rem 0 calc(1.35rem + env(safe-area-inset-bottom));
  }

  .hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.72rem;
    padding: 1rem 1.02rem;
    border-radius: 0.74rem;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.09);
  }

  .kicker {
    letter-spacing: 0.14em;
  }

  h1 {
    font-size: clamp(1.46rem, 6vw, 1.92rem);
  }

  .lead {
    max-width: none;
    font-size: 0.92rem;
    line-height: 1.45;
  }

  .status {
    margin-top: 0.78rem;
    font-size: 0.88rem;
  }
}

@media (max-width: 560px) {
  .page {
    width: min(1160px, 100% - 0.9rem);
    padding-top: 0.72rem;
  }

  .cards {
    gap: 0.62rem;
  }

  .card {
    padding: 0.78rem;
    border-radius: 0.68rem;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.06);
  }

  .card-title {
    font-size: 0.66rem;
    letter-spacing: 0.06em;
  }

  .chip {
    font-size: 0.63rem;
    padding: 0.16rem 0.42rem;
  }

  .card-value {
    margin-top: 0.64rem;
    margin-bottom: 0.26rem;
    font-size: 1.42rem;
    line-height: 1.2;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }

  .card-subtitle {
    font-size: 0.79rem;
    line-height: 1.38;
  }

  .card-meta {
    font-size: 0.67rem;
    gap: 0.28rem;
  }

  .tax-calc,
  .market-compare,
  .chart-panel,
  .fci {
    border-radius: 0.78rem;
    padding: 0.88rem;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.07);
  }

  .tax-calc-controls {
    grid-template-columns: 1fr;
  }

  .tax-table {
    min-width: 520px;
  }

  .market-table {
    min-width: 640px;
  }

  .chart-metrics {
    grid-template-columns: 1fr;
    gap: 0.42rem;
  }

  .metric {
    padding: 0.52rem 0.6rem;
  }

  .metric-value {
    font-size: 1rem;
  }

  .range-group {
    display: flex;
    flex-wrap: nowrap;
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    gap: 0.38rem;
    padding-bottom: 0.14rem;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  .inflation-range-group {
    display: flex;
    flex-wrap: nowrap;
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    gap: 0.38rem;
    padding-bottom: 0.14rem;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  .range-btn,
  .inflation-range-btn {
    flex: 0 0 auto;
    min-width: 58px;
    scroll-snap-align: start;
  }

  .chart-wrap {
    min-height: 250px;
    padding: 0.3rem;
  }

  #history-chart {
    height: 232px;
  }

  .site-footer-inner {
    width: min(1160px, 100% - 1rem);
    font-size: 0.84rem;
    padding-bottom: calc(0.6rem + env(safe-area-inset-bottom));
  }

  .fci-metrics {
    grid-template-columns: 1fr;
  }

  .fci-top-cards {
    grid-template-columns: 1fr;
  }

  .fci-detail-kpis {
    grid-template-columns: 1fr;
  }

  .fci-detail-returns {
    grid-template-columns: 1fr;
  }
}

@media (hover: none) {
  button:hover,
  .card:hover {
    transform: none;
  }
}
