:root {
  color-scheme: light;
  --charcoal: #151715;
  --ink: #262b25;
  --muted: #6e756d;
  --paper: #f4f0e8;
  --panel: #fffaf1;
  --line: #d6cab8;
  --green: #5c744f;
  --green-dark: #354b39;
  --terracotta: #b95f45;
  --terracotta-dark: #8f432f;
  --blue: #496f87;
  --shadow: 0 24px 70px rgba(21, 23, 21, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.is-hidden {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(21, 23, 21, 0.04), rgba(185, 95, 69, 0.08) 54%, rgba(244, 240, 232, 0)),
    var(--paper);
  color: var(--ink);
  font-family:
    ui-serif, Georgia, Cambria, "Times New Roman", serif;
}

body.modal-open {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
}

.site-header,
.site-footer,
.calculator-shell {
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 26px 0 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--charcoal);
  text-decoration: none;
}

.brand__mark {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(244, 240, 232, 0.18);
  border-radius: 8px;
  background: var(--charcoal);
  box-shadow: 0 12px 26px rgba(21, 23, 21, 0.16);
}

.brand__mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.05;
}

.brand strong,
.header-link,
.site-footer,
.eyebrow,
.hero__text,
.hero__note,
.tool-button,
.source-note,
.controls-card,
.input-section,
.scenario-strip,
.metric,
.table-card,
.advisory-note {
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

.brand strong {
  font-size: 0.98rem;
  font-weight: 760;
}

.brand small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.header-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 16px;
}

.header-link,
.site-footer a {
  color: var(--green-dark);
  font-size: 0.9rem;
  font-weight: 760;
  text-decoration: none;
}

.header-link:hover,
.site-footer a:hover {
  color: var(--terracotta-dark);
}

.calculator-shell {
  padding: 56px 0 64px;
}

.calculator-hero {
  position: relative;
  max-width: 1040px;
  border-bottom: 1px solid rgba(21, 23, 21, 0.16);
}

.calculator-hero::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  width: min(360px, 38vw);
  height: 1px;
  background: var(--terracotta);
  content: "";
}

.calculator-hero__content {
  display: flex;
  min-height: 390px;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 42px 0 58px;
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--terracotta-dark);
  font-size: 0.74rem;
  font-weight: 820;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 980px;
  margin-bottom: 18px;
  color: var(--charcoal);
  font-size: clamp(3.1rem, 7.2vw, 6.7rem);
  font-weight: 500;
  line-height: 0.9;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  color: var(--charcoal);
  font-family:
    ui-serif, Georgia, Cambria, "Times New Roman", serif;
  font-size: clamp(1.75rem, 2.8vw, 2.45rem);
  font-weight: 520;
  line-height: 1.04;
}

.hero__text {
  max-width: 820px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(1.04rem, 1.45vw, 1.18rem);
  line-height: 1.68;
}

.hero__note {
  max-width: 780px;
  margin: 18px 0 24px;
  color: var(--green-dark);
  font-size: 0.95rem;
  font-weight: 650;
  line-height: 1.62;
}

.hero-actions,
.controls-card__header,
.controls-card__footer {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.tool-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border: 1px solid var(--charcoal);
  border-radius: 8px;
  padding: 0 20px;
  font-weight: 780;
  text-decoration: none;
  cursor: pointer;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.tool-button--primary {
  background: var(--charcoal);
  color: var(--paper);
}

.tool-button--primary:hover {
  border-color: var(--terracotta);
  background: var(--terracotta-dark);
  transform: translateY(-1px);
}

.tool-button--quiet {
  border-color: rgba(21, 23, 21, 0.24);
  background: rgba(255, 250, 241, 0.54);
  color: var(--green-dark);
}

.tool-button--quiet:hover {
  border-color: var(--green);
  background: rgba(255, 250, 241, 0.9);
}

.source-note,
.advisory-note {
  margin-top: 34px;
  border: 1px solid rgba(21, 23, 21, 0.12);
  border-left: 4px solid rgba(92, 116, 79, 0.52);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.42);
  padding: 20px 22px;
}

.source-note p,
.advisory-note p {
  max-width: 960px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.68;
}

.tool-workspace {
  display: grid;
  grid-template-columns: minmax(300px, 440px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  margin-top: 44px;
}

.controls-card,
.table-card,
.scenario-strip {
  border: 1px solid rgba(21, 23, 21, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 250, 241, 0.96), rgba(231, 221, 207, 0.58)),
    var(--panel);
  box-shadow: var(--shadow);
}

.controls-card {
  display: grid;
  gap: 18px;
  padding: clamp(22px, 3vw, 30px);
}

.controls-card__header {
  align-items: flex-start;
  justify-content: space-between;
}

.controls-card__helper {
  max-width: 320px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 620;
  line-height: 1.5;
}

.controls-card__footer {
  border-top: 1px solid rgba(21, 23, 21, 0.12);
  padding-top: 18px;
}

.currency-section {
  display: grid;
  gap: 14px;
  border-top: 1px solid rgba(21, 23, 21, 0.12);
  padding-top: 18px;
}

.currency-section h3 {
  margin-bottom: 8px;
  color: var(--charcoal);
  font-family:
    ui-serif, Georgia, Cambria, "Times New Roman", serif;
  font-size: 1.16rem;
  font-weight: 620;
  line-height: 1.24;
}

.currency-section p:not(.eyebrow) {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 620;
  line-height: 1.58;
}

#investment-form:has(select[name="displayCurrency"] option:not([value="idr"]):checked) [data-fx-field].is-hidden {
  display: grid !important;
}

.input-section {
  border-top: 1px solid rgba(21, 23, 21, 0.12);
  padding-top: 16px;
}

.input-section summary,
.optional-group summary {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--green-dark);
  font-size: 0.95rem;
  font-weight: 820;
  cursor: pointer;
  list-style: none;
}

.input-section summary::-webkit-details-marker,
.optional-group summary::-webkit-details-marker {
  display: none;
}

.input-section summary::after,
.optional-group summary::after {
  color: var(--terracotta-dark);
  content: "+";
  font-size: 1.2rem;
  line-height: 1;
}

.input-section[open] summary::after,
.optional-group[open] summary::after {
  content: "-";
}

.input-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.input-grid--compact {
  margin-top: 12px;
}

.optional-group {
  margin-top: 24px;
  border: 1px solid rgba(21, 23, 21, 0.1);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.42);
  padding: 14px;
}

.optional-group summary {
  min-height: 34px;
  align-items: center;
  font-size: 0.86rem;
}

.optional-group__helper {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 620;
  line-height: 1.5;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--green-dark);
  font-size: 0.8rem;
  font-weight: 780;
  line-height: 1.35;
}

.field input,
.field select {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(21, 23, 21, 0.16);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.78);
  color: var(--ink);
  padding: 0 12px;
}

.field input:focus,
.field select:focus {
  outline: 2px solid rgba(92, 116, 79, 0.28);
  outline-offset: 1px;
}

.results-stack {
  display: grid;
  gap: 20px;
}

.scenario-strip {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 22px;
}

.scenario-strip p:last-child {
  max-width: 320px;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 680;
  line-height: 1.5;
}

.scenario-meta {
  display: grid;
  gap: 6px;
  max-width: 360px;
}

.scenario-meta p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 680;
  line-height: 1.5;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.metric {
  display: grid;
  align-content: start;
  min-height: 160px;
  border: 1px solid rgba(21, 23, 21, 0.12);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.9);
  box-shadow: 0 14px 36px rgba(21, 23, 21, 0.08);
  padding: 22px;
}

.metric::before {
  display: block;
  width: 44px;
  height: 3px;
  margin-bottom: 16px;
  background: var(--green);
  content: "";
}

.metric--higher::before {
  background: var(--terracotta);
}

.metric span {
  color: var(--green-dark);
  font-size: 0.76rem;
  font-weight: 820;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 12px;
  color: var(--charcoal);
  font-family:
    ui-serif, Georgia, Cambria, "Times New Roman", serif;
  font-size: clamp(1.42rem, 2.4vw, 1.9rem);
  font-weight: 560;
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.metric small {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 620;
  line-height: 1.5;
}

.table-card {
  overflow: hidden;
}

.table-card__heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 24px 0;
}

.table-card__heading > p {
  max-width: 300px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.6;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 20px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

th,
td {
  border-top: 1px solid rgba(21, 23, 21, 0.1);
  padding: 14px 24px;
  text-align: left;
  vertical-align: top;
}

th {
  width: 56%;
  color: var(--green-dark);
  font-size: 0.82rem;
  font-weight: 820;
}

th span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.42;
}

td {
  color: var(--charcoal);
  font-size: 0.92rem;
  font-weight: 760;
  overflow-wrap: anywhere;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid rgba(21, 23, 21, 0.12);
  padding: 28px 0 40px;
  color: var(--muted);
}

.logic-modal {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  align-items: start;
  justify-items: center;
  overflow-y: auto;
  background: rgba(21, 23, 21, 0.48);
  padding: min(7vh, 56px) 20px;
}

.logic-modal[hidden] {
  display: none;
}

.logic-modal__panel {
  width: min(920px, 100%);
  border: 1px solid rgba(21, 23, 21, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 250, 241, 0.98), rgba(231, 221, 207, 0.72)),
    var(--panel);
  box-shadow: 0 28px 90px rgba(21, 23, 21, 0.24);
  padding: clamp(24px, 4vw, 42px);
}

.logic-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid rgba(21, 23, 21, 0.12);
  padding-bottom: 20px;
}

.modal-close {
  min-height: 42px;
  border: 1px solid rgba(21, 23, 21, 0.22);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.7);
  color: var(--green-dark);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-weight: 780;
  padding: 0 14px;
  cursor: pointer;
}

.modal-close:hover {
  border-color: var(--green);
  background: rgba(255, 250, 241, 0.95);
}

.logic-modal__intro,
.definition-list p,
.model-logic,
.logic-modal__note {
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

.logic-modal__intro {
  max-width: 760px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.68;
}

.definition-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 26px;
}

.definition-list article {
  border-top: 1px solid rgba(21, 23, 21, 0.12);
  padding-top: 16px;
}

.definition-list h3,
.model-logic h3 {
  margin-bottom: 8px;
}

.definition-list p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.62;
}

.model-logic {
  margin-top: 30px;
  border-top: 1px solid rgba(21, 23, 21, 0.12);
  padding-top: 20px;
}

.model-logic dl {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
}

.model-logic div {
  display: grid;
  gap: 4px;
  border: 1px solid rgba(21, 23, 21, 0.1);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.52);
  padding: 12px 14px;
}

.model-logic dt {
  color: var(--green-dark);
  font-size: 0.78rem;
  font-weight: 850;
}

.model-logic dd {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.logic-modal__note {
  margin-top: 28px;
  border: 1px solid rgba(21, 23, 21, 0.12);
  border-left: 4px solid rgba(92, 116, 79, 0.52);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.52);
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.66;
  padding: 18px 20px;
}

@media (max-width: 980px) {
  .tool-workspace {
    grid-template-columns: 1fr;
  }

  .controls-card {
    order: 0;
  }

  .results-stack {
    order: 1;
  }
}

@media (max-width: 720px) {
  .site-header,
  .site-footer,
  .calculator-shell {
    width: min(100% - 28px, 1160px);
  }

  .site-header,
  .site-footer,
  .scenario-strip,
  .logic-modal__header,
  .table-card__heading {
    align-items: flex-start;
    flex-direction: column;
  }

  h1 {
    font-size: clamp(2.75rem, 16vw, 4.5rem);
  }

  .calculator-hero__content {
    min-height: auto;
    padding: 38px 0 46px;
  }

  .input-grid,
  .summary-grid,
  .definition-list {
    grid-template-columns: 1fr;
  }

  .tool-button {
    width: 100%;
  }

  .controls-card {
    gap: 14px;
    padding: 20px;
  }

  .input-section {
    padding-top: 14px;
  }

  .optional-group {
    margin-top: 16px;
    padding: 12px;
  }

  th,
  td {
    display: block;
    width: 100%;
    padding: 12px 18px;
  }

  td {
    border-top: 0;
    padding-top: 0;
  }

  .logic-modal {
    padding: 12px;
  }
}
