:root {
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #142235;
  background: #f1f5f8;
  color-scheme: light;
  line-height: 1.5;
  --muted: #47586c;
  --border: #d6e0e9;
  --teal: #005755;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2rem, 5vw, 3rem); line-height: 1.12; letter-spacing: -.045em; }
h2 { font-size: 1.25rem; line-height: 1.25; }
h3 { font-size: 1.0625rem; }
p { color: var(--muted); }

.shell { width: min(100% - 2rem, 59rem); margin-inline: auto; }
.masthead { background: #101d30; color: #fff; }
.masthead-inner {
  min-height: 4.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.wordmark { font-size: 1.375rem; font-weight: 750; letter-spacing: -.05em; }
.wordmark span { color: #8be3ca; }

.page-title { padding-block: clamp(2rem, 6vw, 4rem) 1.5rem; }
.page-title p, .sign-in p, .checkout p, dialog p { margin-top: .65rem; }
.sign-in { padding-block-start: clamp(2.75rem, 9vw, 5.75rem); max-width: 29rem; }
.sign-in > p { margin-bottom: 1.5rem; max-width: 28rem; }
.sign-in-form { display: grid; gap: .55rem; padding: clamp(1.1rem, 5vw, 1.75rem); }
.sign-in-form label { font-weight: 650; }
.sign-in-form input {
  width: 100%;
  min-height: 2.75rem;
  border: 1px solid #8ea0b2;
  border-radius: .5rem;
  padding-inline: .65rem;
  font: inherit;
  margin-bottom: .45rem;
}
.sign-in-form .button { justify-self: start; }
#payment-error, #sign-in-error { color: #97212f; }
#payment-error:empty, #sign-in-error:empty { display: none; }

.balance {
  padding: clamp(1.5rem, 4vw, 2rem);
  border-radius: 1.2rem;
  color: #fff;
  background: linear-gradient(124deg, #172743 0%, #124659 80%, #075551 100%);
}
.balance h2 { color: #b7e9de; font-size: .9375rem; font-weight: 600; }
.balance strong {
  display: block;
  margin-top: .4rem;
  font-size: clamp(2rem, 7vw, 2.75rem);
  line-height: 1.15;
  letter-spacing: -.04em;
}
.balance p { margin-top: .5rem; color: #d9f2ee; font-size: .9375rem; }
.contracts { margin-block: 2rem 3rem; }
.contracts-header, .contract-heading { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: .55rem; margin-bottom: .8rem; }
.surface { background: #fff; border: 1px solid var(--border); border-radius: 1rem; }
.contract { margin-bottom: .85rem; padding: .95rem 1.2rem 0; }
.contract h3 { margin-bottom: .65rem; }
.installments { padding: 0; margin: 0; list-style: none; }
.installment {
  display: grid;
  grid-template-columns: minmax(7.5rem, 1fr) 7.5rem minmax(13rem, auto);
  align-items: center;
  gap: .5rem 1rem;
  padding-block: .8rem;
  border-top: 1px solid var(--border);
}
.installment strong { display: block; }
.due, .status { font-size: .875rem; color: var(--muted); }
.status-paid { color: var(--teal); font-weight: 650; }
.installment-actions { justify-self: end; display: flex; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }
.contract-history { border-top: 1px solid var(--border); padding-block: .85rem; }
.contract-history summary { cursor: pointer; width: fit-content; color: var(--teal); font-weight: 650; }
.contract-history p { margin-top: .55rem; }
.payment-history { list-style: none; margin: .55rem 0 0; padding: 0; }
.payment-history li { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .8rem; padding-block: .4rem; }

.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: .55rem .85rem;
  min-height: 2.75rem;
  border: 1px solid transparent;
  border-radius: .55rem;
  font: inherit;
  font-size: .9375rem;
  font-weight: 650;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.button-primary { background: var(--teal); color: white; }
.button-primary:hover { background: #004442; }
.button-secondary { background: #e8f5f2; border-color: #b7dbd3; color: var(--teal); }
.button-secondary:hover { background: #d6eee8; }
.button-text { background: transparent; color: var(--teal); }
.button-text:hover { text-decoration: underline; }
.button-quiet { background: transparent; border-color: #73869f; color: #fff; }
.button-quiet:hover { background: #263951; }
.button:disabled { opacity: .65; cursor: wait; }
:focus-visible { outline: 2px solid #007a75; outline-offset: 3px; }
.masthead :focus-visible { outline-color: #8be3ca; }

dialog {
  padding: clamp(1.25rem, 5vw, 2rem);
}
.checkout-amount { display: block; margin-top: .45rem; font-size: 1.75rem; letter-spacing: -.035em; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
dialog {
  width: min(100% - 2rem, 32rem);
  border: 1px solid var(--border);
  border-radius: 1rem;
  color: inherit;
}
dialog::backdrop { background: rgb(16 29 48 / 65%); }
dialog label { display: block; margin-block: .8rem .25rem; font-weight: 650; font-size: .875rem; }
.link-group { display: flex; gap: .5rem; }
.link-group input {
  min-width: 0;
  flex: 1;
  padding-inline: .6rem;
  border: 1px solid #8ea0b2;
  border-radius: .5rem;
  color: inherit;
  font: inherit;
}
.copy-status { color: var(--teal); font-size: .875rem; }
.copy-status:not(:empty) { display: block; margin-top: .4rem; }
.payment-result:not(:empty) {
  margin-top: 1rem;
  padding: .75rem 1rem;
  border-radius: .55rem;
  color: var(--teal);
  background: #dff3ed;
}

@media (max-width: 36rem) {
  .installment { grid-template-columns: minmax(0, 1fr) auto; }
  .installment-value { text-align: end; }
  .installment-actions { grid-column: 1 / -1; justify-self: start; justify-content: flex-start; }
}
