:root {
  --paper: #f3eee6;
  --paper-2: #ebe4d8;
  --card: #fffdf8;
  --ink: #1f1a16;
  --ink-soft: #5c534b;
  --rule: #e3d8cb;
  --save: #1b6b48;
  --save-bg: #e6f3eb;
  --warn: #8a4b12;
  --warn-bg: #f8ecd9;
  --vodafone: #e60000;
  --amaysim: #5b2d8c;
  --belong: #7c3aed;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
  --radius: 18px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--paper);
  color: var(--ink);
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

.wrap {
  width: min(100%, 430px);
  margin: 0 auto;
  min-height: 100dvh;
  padding:
    calc(18px + var(--safe-top))
    16px
    calc(36px + var(--safe-bot));
}

header.mast {
  margin-bottom: 18px;
}

.kicker {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 600;
}

h1 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 500;
  font-size: clamp(34px, 10vw, 44px);
  letter-spacing: -0.03em;
  line-height: 1;
  margin: 4px 0 6px;
}

.lede {
  color: var(--ink-soft);
  font-size: 15px;
}

.hero {
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius);
  padding: 20px 20px 18px;
  margin-bottom: 14px;
}

.hero .kicker { color: #c4b8ab; }

.hero .dollars {
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(52px, 16vw, 64px);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 0.95;
  margin: 6px 0 4px;
}

.hero .dollars small {
  font-size: 0.38em;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: #c4b8ab;
}

.hero .split {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(243, 238, 230, 0.16);
}

.hero .split div {
  flex: 1;
}

.hero .split dt {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #c4b8ab;
  font-weight: 600;
}

.hero .split dd {
  font-size: 18px;
  font-weight: 700;
  margin-top: 2px;
}

.hero .split dd span {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #c4b8ab;
}

.save-bar {
  background: var(--save-bg);
  color: var(--save);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 18px;
}

.save-bar strong {
  font-family: "Fraunces", Georgia, serif;
  font-size: 22px;
  font-weight: 550;
  letter-spacing: -0.03em;
  display: block;
}

.save-bar span {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-top: 2px;
}

.section-label {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 700;
  margin: 4px 0 10px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.chip {
  appearance: none;
  border: 1px solid var(--rule);
  background: var(--card);
  color: var(--ink);
  border-radius: 999px;
  padding: 10px 13px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  min-height: 44px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.35;
}

.chip[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.chip[aria-pressed="true"] .dot { opacity: 1; background: var(--paper); }

.card h2 .per,
h2 .per {
  font-size: 0.55em;
  color: var(--ink-soft);
  font-family: "Figtree", sans-serif;
  font-weight: 600;
}

.cycle {
  font-weight: 600;
  color: var(--ink-soft);
  font-size: 12px;
}

.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}

.card h2 {
  font-family: "Fraunces", Georgia, serif;
  font-size: 22px;
  font-weight: 550;
  letter-spacing: -0.02em;
  margin-bottom: 2px;
}

.card .sub {
  color: var(--ink-soft);
  font-size: 14px;
  margin-bottom: 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.brand i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

.totals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.total {
  background: var(--paper);
  border-radius: 14px;
  padding: 12px 12px 10px;
}

.total .when {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink-soft);
  line-height: 1.3;
}

.total .amt {
  font-family: "Fraunces", Georgia, serif;
  font-size: 28px;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin: 2px 0;
}

.total .amt small {
  font-size: 0.45em;
  color: var(--ink-soft);
}

.total p {
  font-size: 12px;
  color: var(--ink-soft);
}

.lines {
  display: grid;
  gap: 10px;
}

.line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
}

.line dt {
  font-weight: 700;
  font-size: 15px;
}

.line .meta {
  grid-column: 1 / -1;
  font-size: 13px;
  color: var(--ink-soft);
}

.line dd {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

fieldset.sims {
  border: 0;
  margin: 4px 0 8px;
}

fieldset.sims legend {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

.sim-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.sim {
  position: relative;
}

.sim input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.sim span {
  display: block;
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 10px 10px 9px;
  min-height: 64px;
  background: var(--paper);
  cursor: pointer;
}

.sim input:focus-visible + span {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.sim input:checked + span {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.sim .p {
  font-weight: 800;
  font-size: 15px;
}

.sim .d {
  font-size: 12px;
  opacity: 0.75;
}

.note {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 8px;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

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

table.cmp th,
table.cmp td {
  text-align: left;
  padding: 10px 8px;
  vertical-align: top;
  border-bottom: 1px solid var(--rule);
}

table.cmp th {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 700;
}

table.cmp td:first-child {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
  width: 18%;
}

table.cmp.cols3 th,
table.cmp.cols3 td {
  padding: 10px 6px;
}

table.cmp.cols3 tfoot strong {
  font-size: 20px;
}

table.cmp td strong {
  display: block;
  font-size: 16px;
}

table.cmp td em {
  display: block;
  font-style: normal;
  font-size: 12px;
  color: var(--ink-soft);
  font-weight: 500;
}

table.cmp tfoot td {
  border-bottom: 0;
  padding-top: 12px;
}

table.cmp tfoot strong {
  font-family: "Fraunces", Georgia, serif;
  font-size: 22px;
  font-weight: 550;
}

.year {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.year.three {
  grid-template-columns: 1fr 1fr 1fr;
}

.year.three .n {
  font-size: 20px;
}

.year .box {
  background: var(--paper);
  border-radius: 14px;
  padding: 12px;
}

.year .box.win {
  background: var(--save-bg);
  color: var(--save);
}

.year .lbl {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

.year .n {
  font-family: "Fraunces", Georgia, serif;
  font-size: 26px;
  letter-spacing: -0.03em;
}

.year p {
  font-size: 12px;
  margin-top: 2px;
}

ul.checks {
  list-style: none;
  display: grid;
  gap: 4px;
}

ul.checks li label {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  align-items: start;
  font-size: 14px;
  min-height: 44px;
  padding: 6px 0;
  cursor: pointer;
}

ul.checks input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--ink);
}

.links {
  display: grid;
  gap: 8px;
}

.links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 14px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
}

.links a span {
  color: var(--ink-soft);
  font-weight: 500;
  font-size: 13px;
}

.chart-tabs {
  display: flex;
  gap: 8px;
  margin: 4px 0 12px;
}

.chart-tab {
  appearance: none;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 14px;
  min-height: 40px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.chart-tab[aria-selected="true"] {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.chart-svg {
  width: 100%;
  overflow: hidden;
}

.chart-svg svg {
  display: block;
  width: 100%;
  height: auto;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.legend-item {
  appearance: none;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  border-radius: 12px;
  padding: 8px 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-height: 40px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.legend-item i {
  width: 10px;
  height: 10px;
  border-radius: 99px;
  flex-shrink: 0;
}

.legend-item span {
  color: var(--ink-soft);
  font-weight: 600;
}

.legend-item.is-off {
  opacity: 0.4;
}

.fine {
  margin-top: 18px;
  font-size: 12px;
  color: var(--ink-soft);
}

.fine a { color: inherit; }

@media (max-width: 400px) {
  table.cmp th,
  table.cmp td { padding: 10px 6px; }
}

@media (min-width: 760px) {
  .wrap {
    width: min(100%, 720px);
    padding-top: calc(28px + var(--safe-top));
  }

  .desk {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    align-items: start;
  }

  .desk .span {
    grid-column: 1 / -1;
  }
}
