:root {
  --bg: #F4EEDF;
  --bg-tint: #FAF6EC;
  --surface: #FFFFFF;
  --surface-warm: #FBF6EA;
  --ink: #1B1815;
  --ink-soft: #3A3530;
  --muted: #7A6E5C;
  --line: #E6DCC4;
  --line-strong: #C9BB97;
  --teal: #0F5249;
  --teal-deep: #07332D;
  --teal-soft: #DCE9E5;
  --terracotta: #B85F38;
  --terracotta-soft: #F2DECE;
  --gold: #B89352;
  --gold-deep: #8A6B2F;
  --gold-soft: #F1E5C2;
  --shadow-sm: 0 1px 2px rgba(60, 50, 30, 0.05), 0 2px 6px rgba(60, 50, 30, 0.04);
  --shadow-md: 0 2px 4px rgba(60, 50, 30, 0.06), 0 8px 24px rgba(60, 50, 30, 0.08);
  --shadow-lg: 0 4px 8px rgba(60, 50, 30, 0.08), 0 24px 48px rgba(60, 50, 30, 0.12);
  --radius-sm: 12px;
  --radius: 20px;
  --radius-lg: 28px;
  --font-display: "Fraunces", "Source Serif Pro", Georgia, serif;
  --font-body: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { font-size: 18px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(circle at 15% 8%, rgba(184, 95, 56, 0.10), transparent 35%),
    radial-gradient(circle at 88% 14%, rgba(15, 82, 73, 0.10), transparent 40%),
    radial-gradient(circle at 50% 95%, rgba(184, 147, 82, 0.10), transparent 45%);
  min-height: 100vh;
  font-feature-settings: "ss01", "cv11";
}

.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 1000; opacity: .35; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.55  0 0 0 0 0.42  0 0 0 0 0.18  0 0 0 0.07 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* TYPOGRAPHY */
h1, h2, h3 { font-family: var(--font-display); font-weight: 500; color: var(--ink); margin: 0 0 12px; letter-spacing: -0.02em; line-height: 1.08; font-variation-settings: "opsz" 96, "SOFT" 50; }
h2 { font-size: clamp(28px, 3vw, 38px); font-weight: 480; }
h3 { font-size: 18px; font-weight: 600; font-family: var(--font-body); letter-spacing: -0.005em; color: var(--ink); margin-bottom: 10px; }
.display { font-size: clamp(40px, 6.5vw, 76px); font-weight: 450; font-variation-settings: "opsz" 144, "SOFT" 30, "WONK" 0; letter-spacing: -0.035em; line-height: 1.0; }
.display.med { font-size: clamp(30px, 4vw, 46px); font-weight: 460; letter-spacing: -0.025em; line-height: 1.05; }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: 0.22em; color: var(--muted); font-weight: 600; margin: 0 0 14px; }
.eyebrow.accent { color: var(--terracotta); }
.lede { font-size: 19px; line-height: 1.55; color: var(--ink-soft); max-width: 56ch; margin: 18px 0 0; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 14px; margin: 6px 0 0; }
em.acc { font-family: var(--font-display); font-style: italic; color: var(--terracotta); font-weight: 500; }

/* HEADER */
.top {
  max-width: 1200px;
  margin: 0 auto;
  padding: 22px 32px 0;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brandMark {
  width: 48px; height: 48px; border-radius: 14px; background: var(--teal); color: var(--bg-tint);
  display: grid; place-items: center; box-shadow: var(--shadow-sm);
}
.brandName { font-family: var(--font-display); font-weight: 500; font-size: 20px; letter-spacing: -0.015em; line-height: 1; }
.brandTag { color: var(--muted); font-size: 13px; margin-top: 4px; }
.topControls { display: flex; gap: 10px; flex-wrap: wrap; }

/* SEGMENTED CONTROL */
.seg {
  display: inline-flex; padding: 4px; gap: 2px;
  background: var(--surface-warm);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: inset 0 1px 2px rgba(60,50,30,.04);
}
.segBtn {
  appearance: none; background: transparent; color: var(--ink-soft);
  border: 0; padding: 10px 18px; font-family: var(--font-body); font-weight: 600; font-size: 14px;
  border-radius: 999px; cursor: pointer; transition: all .18s ease;
  min-height: 40px;
}
.segBtn:hover { color: var(--ink); }
.segBtn.active {
  background: var(--ink); color: var(--bg-tint);
  box-shadow: var(--shadow-sm);
}

/* MAIN */
main {
  max-width: 1200px; margin: 0 auto; padding: 24px 32px 96px;
}

.hero {
  padding: 56px 0 32px;
  max-width: 880px;
}
.hero .display { margin: 8px 0 0; }

/* GOAL BAR — global preference: Miles / Cashback / Both */
.goalBar {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin: 8px 0 18px;
  flex-wrap: wrap;
}
.goalBarLabel {
  font-family: var(--font-display); font-style: italic;
  font-weight: 500; font-size: 18px;
  color: var(--ink); letter-spacing: -0.005em;
}
.goalSeg { background: var(--bg-tint); border-color: var(--line); }
.goalSeg .segBtn { padding: 12px 22px; font-size: 15px; min-height: 44px; }

/* PANEL */
.card.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin: 18px 0;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s ease;
}
.card.panel:hover { box-shadow: var(--shadow-md); }
.panelHead { display: flex; align-items: flex-start; gap: 18px; margin-bottom: 22px; }
.stepDot {
  flex-shrink: 0; width: 42px; height: 42px; border-radius: 14px;
  background: var(--teal-soft); color: var(--teal-deep);
  display: grid; place-items: center; font-family: var(--font-display);
  font-weight: 600; font-size: 19px;
}

/* WALLET PICKER */
.walletPanel > details > summary { padding: 0; }
.walletPanel > details > summary::after { display: none; }
.walletSummary {
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px; width: 100%; flex-wrap: wrap;
}
.walletHead { display: flex; align-items: flex-start; gap: 18px; flex: 1; min-width: 280px; }
.walletHead h2 { font-size: clamp(22px, 2.3vw, 28px); margin-bottom: 4px; }
.walletHead .muted { font-size: 14px; line-height: 1.4; }
.walletCount {
  font-family: var(--font-display); font-weight: 500;
  font-size: 20px; color: var(--teal-deep);
  background: var(--teal-soft); padding: 10px 18px; border-radius: 14px;
  font-variant-numeric: tabular-nums; letter-spacing: -0.005em;
  white-space: nowrap; flex-shrink: 0;
  position: relative; padding-right: 38px;
}
.walletCount::after {
  content: "▾"; position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  color: var(--teal); font-size: 14px; transition: transform .2s ease;
}
.walletPanel > details[open] .walletCount::after { transform: translateY(-50%) rotate(180deg); }
.walletBody { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--line); }
.walletControls {
  display: flex; gap: 10px; margin: 14px 0 20px; flex-wrap: wrap;
}
.walletControls input[type="search"] {
  flex: 1; min-width: 220px;
  background: var(--surface-warm); border: 1.5px solid var(--line);
  border-radius: 12px; padding: 12px 16px; font: inherit; font-size: 15px;
  min-height: 48px; color: var(--ink);
}
.walletControls input[type="search"]:focus { outline: none; border-color: var(--teal); }
.ghostBtn {
  background: var(--surface-warm); color: var(--ink); border: 1.5px solid var(--line);
  border-radius: 12px; padding: 0 18px; font: inherit; font-weight: 600; font-size: 14px;
  cursor: pointer; min-height: 48px; transition: all .15s ease;
}
.ghostBtn:hover { background: var(--teal-soft); border-color: var(--teal); color: var(--teal-deep); }
.walletList { display: flex; flex-direction: column; gap: 18px; max-height: 520px; overflow-y: auto; padding-right: 4px; }
.walletList::-webkit-scrollbar { width: 8px; }
.walletList::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }
.walletBank { background: var(--surface-warm); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.walletBank h4 {
  margin: 0 0 12px;
  font-family: var(--font-display); font-weight: 500; font-style: italic;
  font-size: 16px; color: var(--terracotta);
  letter-spacing: -0.005em;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.walletBankToggle {
  background: transparent; border: 0; color: var(--muted);
  font: inherit; font-style: normal; font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.08em; cursor: pointer;
  padding: 4px 10px; border-radius: 8px;
}
.walletBankToggle:hover { background: var(--teal-soft); color: var(--teal-deep); }
.walletCards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px; }
.walletItem {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  cursor: pointer; transition: background .12s ease;
  font-size: 14px; line-height: 1.35; color: var(--ink-soft);
  min-height: 44px;
}
.walletItem:hover { background: var(--bg-tint); }
.walletItem.on { background: var(--teal-soft); color: var(--ink); }
.walletItem input[type="checkbox"] {
  appearance: none;
  width: 22px; height: 22px; border: 2px solid var(--line-strong);
  border-radius: 6px; background: var(--surface); cursor: pointer;
  flex-shrink: 0; margin: 1px 0 0;
  transition: all .15s ease;
}
.walletItem input[type="checkbox"]:checked {
  background: var(--teal); border-color: var(--teal);
}
.walletItem input[type="checkbox"]:checked::after {
  content: "✓"; color: #fff; font-size: 14px; font-weight: 800;
  display: grid; place-items: center; line-height: 22px;
}
.walletItem .wn { font-weight: 500; }
.walletItem .wm { font-size: 12px; color: var(--muted); display: block; margin-top: 2px; }
.walletEmpty { padding: 24px; text-align: center; color: var(--muted); font-size: 14px; }

/* CATEGORY CHIPS — large touch targets */
.catGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.catChip {
  appearance: none; cursor: pointer; background: var(--surface-warm);
  border: 2px solid var(--line); border-radius: 18px;
  padding: 16px 14px; text-align: left;
  font: inherit; color: var(--ink);
  display: flex; flex-direction: column; gap: 6px;
  min-height: 80px;
  transition: all .15s ease;
  position: relative;
}
.catChip:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.catChip .ic { font-size: 24px; line-height: 1; }
.catChip .nm { font-weight: 600; font-size: 15px; line-height: 1.2; color: var(--ink); }
.catChip .ds { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.catChip.on {
  background: var(--teal-soft);
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(15, 82, 73, 0.08);
}
.catChip.on::after {
  content: "✓"; position: absolute; top: 10px; right: 12px;
  width: 22px; height: 22px; border-radius: 50%; background: var(--teal);
  color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 800;
}

/* SPEND INPUTS */
.spendGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.spendBox {
  background: var(--surface-warm);
  border: 1px solid var(--line); border-radius: 18px;
  padding: 18px;
  transition: border-color .15s ease;
}
.spendBox:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(15,82,73,.08); }
.spendBox .title { font-weight: 700; font-size: 15px; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.spendBox .desc { color: var(--muted); font-size: 12.5px; margin: 4px 0 12px; line-height: 1.4; }
.spendBox input {
  width: 100%; background: var(--surface); border: 1.5px solid var(--line);
  border-radius: 12px; padding: 12px 14px; font: inherit;
  font-family: var(--font-display); font-weight: 500; font-size: 19px;
  color: var(--ink); font-variant-numeric: tabular-nums;
  min-height: 50px;
}
.spendBox input:focus { outline: none; border-color: var(--teal); }

input, button { font-family: inherit; }

/* ADVANCED */
.advRow {
  display: grid; gap: 28px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.advBlock h3 { margin: 0 0 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  appearance: none; cursor: pointer; background: var(--surface-warm);
  border: 1.5px solid var(--line); border-radius: 999px;
  padding: 10px 16px; font: inherit; font-size: 14px; font-weight: 500;
  color: var(--ink-soft); min-height: 42px;
  transition: all .15s ease;
}
.chip:hover { border-color: var(--line-strong); }
.chip.active {
  background: var(--terracotta); border-color: var(--terracotta);
  color: #fff;
}
.miniGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.miniGrid label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.miniGrid input {
  background: var(--surface); border: 1.5px solid var(--line);
  border-radius: 12px; padding: 12px 14px; font-family: var(--font-display);
  font-size: 17px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--ink);
  min-height: 48px; width: 100%;
}
.miniGrid input:focus { outline: none; border-color: var(--teal); }

/* RESULT SECTION */
.resultSection { margin: 44px 0 20px; }
.resultHead {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 24px; padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}
.resultHead .muted { max-width: 56ch; margin-top: 8px; font-size: 16px; }
.totalBox {
  text-align: right;
  background: var(--teal); color: var(--bg-tint);
  padding: 18px 24px; border-radius: 18px;
  min-width: 200px;
  box-shadow: var(--shadow-md);
}
.totalBox .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: 0.18em; opacity: .75; }
.totalBox .val {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(26px, 3vw, 34px);
  letter-spacing: -0.025em; line-height: 1.05;
  margin-top: 4px; font-variant-numeric: tabular-nums;
  font-variation-settings: "opsz" 144;
}
.totalBox .sub { font-size: 12.5px; opacity: .8; margin-top: 6px; }

/* WALLET — credit-card-styled recommendations */
.wallet {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}
.recCard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 4px;
  cursor: pointer;
  transition: all .2s ease;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.recCard:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.recCard .ccVisual {
  border-radius: 22px;
  padding: 22px 22px 18px;
  position: relative;
  min-height: 180px;
  display: flex; flex-direction: column; justify-content: space-between;
  color: #fff;
  overflow: hidden;
}
.recCard .ccVisual::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(circle at 80% 20%, rgba(255,255,255,0.18), transparent 50%),
    radial-gradient(circle at 10% 90%, rgba(0,0,0,0.18), transparent 50%);
  pointer-events: none;
}
.recCard .ccVisual::after {
  content: ""; position: absolute; right: -40px; bottom: -40px;
  width: 160px; height: 160px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.13);
  pointer-events: none;
}
.recCard .ccTop { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; z-index: 1; }
.recCard .ccCat {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.18em;
  background: rgba(255,255,255,0.18); padding: 6px 10px; border-radius: 999px;
  font-weight: 700;
}
.recCard .ccBank {
  font-family: var(--font-display); font-style: italic; font-weight: 500;
  font-size: 16px; letter-spacing: -0.005em; opacity: .9;
}
.recCard .ccName {
  font-family: var(--font-display); font-weight: 500;
  font-size: 22px; letter-spacing: -0.02em; line-height: 1.12;
  margin-top: 14px; z-index: 1; position: relative;
  font-variation-settings: "opsz" 96;
}
.recCard .ccBottom {
  display: flex; justify-content: space-between; align-items: flex-end; z-index: 1; position: relative;
  margin-top: 16px;
}
.recCard .ccVal {
  font-family: var(--font-display); font-weight: 500;
  font-size: 24px; letter-spacing: -0.02em; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.recCard .ccValLbl { font-size: 11px; opacity: .85; text-transform: uppercase; letter-spacing: 0.15em; margin-bottom: 4px; }
.recCard .ccNet { font-size: 12.5px; opacity: .8; font-weight: 600; letter-spacing: 0.01em; }

/* Per-card warm gradient — varies by category */
.recCard.cat-general .ccVisual { background: linear-gradient(135deg, #0F5249 0%, #07332D 100%); }
.recCard.cat-foreign .ccVisual { background: linear-gradient(135deg, #2F4D6E 0%, #1A2E47 100%); }
.recCard.cat-travel .ccVisual { background: linear-gradient(135deg, #B85F38 0%, #7A3D22 100%); }
.recCard.cat-dining .ccVisual { background: linear-gradient(135deg, #8A6B2F 0%, #574118 100%); }
.recCard.cat-grab .ccVisual { background: linear-gradient(135deg, #2F7A4A 0%, #194E2D 100%); }
.recCard.cat-blibli .ccVisual { background: linear-gradient(135deg, #3A5FB8 0%, #1F3A7A 100%); }
.recCard.cat-mitra10 .ccVisual { background: linear-gradient(135deg, #6B3E78 0%, #3F2148 100%); }
.recCard.cat-garuda .ccVisual { background: linear-gradient(135deg, #1A6B7A 0%, #0D3A45 100%); }
.recCard.cat-cathay .ccVisual { background: linear-gradient(135deg, #2D7060 0%, #16403A 100%); }
.recCard.cat-daily .ccVisual { background: linear-gradient(135deg, #4A6B45 0%, #2A3F26 100%); }
.recCard.cat-other .ccVisual { background: linear-gradient(135deg, #5C5C5C 0%, #2C2C2C 100%); }

/* Stack list inside a recCard — primary + extra cards for this category */
.recCard .stackList {
  padding: 14px 18px 8px;
  display: flex; flex-direction: column; gap: 8px;
  border-top: 1px dashed var(--line);
}
.recCard .stackPrimary, .recCard .stackStep {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 8px 0;
  font-size: 13.5px;
  line-height: 1.4;
}
.recCard .stackPrimary { color: var(--ink); }
.recCard .stackStep { color: var(--ink-soft); }
.recCard .stackStep.leftover { color: var(--muted); font-style: italic; }
.recCard .stackIc {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%;
  background: var(--teal-soft); color: var(--teal-deep);
  display: grid; place-items: center; font-weight: 800; font-size: 12px;
  font-family: var(--font-display); margin-top: 1px;
}
.recCard .stackStep .stackIc { background: var(--gold-soft); color: var(--gold-deep); }
.recCard .stackStep.leftover .stackIc { background: var(--bg-tint); color: var(--muted); }
.recCard .stackPrimary b, .recCard .stackStep b { font-weight: 700; }
.recCard .stackPrimary .muted, .recCard .stackStep .muted { font-size: 12.5px; margin-top: 2px; }
.recCard .capPill {
  display: inline-block; background: var(--terracotta-soft); color: var(--terracotta);
  padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 700;
  margin-left: 6px;
}

.recCard .ccMeta {
  padding: 16px 22px 18px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  border-top: 1px dashed var(--line);
}
.recCard .ccBreak { font-size: 13px; color: var(--muted); line-height: 1.4; }
.recCard .ccBreak b { color: var(--ink); font-weight: 700; }
.recCard .ccDetail {
  font-size: 13px; color: var(--teal); font-weight: 700; text-decoration: none;
  padding: 8px 12px; border-radius: 10px; flex-shrink: 0;
  background: var(--teal-soft);
}

.emptyState {
  grid-column: 1 / -1;
  padding: 48px 24px; text-align: center;
  background: var(--surface-warm); border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
}
.emptyState h3 { font-family: var(--font-display); font-size: 22px; font-weight: 500; }

/* TABLE / DETAILS */
details > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 6px 0;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::after {
  content: "↓"; font-family: var(--font-display); font-size: 22px; color: var(--teal);
  transition: transform .2s ease;
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--teal-soft);
}
details[open] > summary::after { transform: rotate(180deg); }
.sumTitle { font-family: var(--font-display); font-weight: 500; font-size: 22px; color: var(--ink); letter-spacing: -0.015em; }
.sumHint { display: block; font-size: 14px; color: var(--muted); margin-top: 2px; }
details > summary > div { display: flex; flex-direction: column; }
.tableWrap { overflow-x: auto; margin-top: 22px; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td {
  padding: 14px 12px; text-align: left; vertical-align: top;
  border-bottom: 1px solid var(--line);
}
th {
  color: var(--muted); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.16em; font-weight: 700;
}
tbody tr { cursor: pointer; transition: background .12s ease; }
tbody tr:hover { background: var(--surface-warm); }
.money { font-family: var(--font-display); font-weight: 500; font-size: 18px; color: var(--ink); font-variant-numeric: tabular-nums; }
td b { font-weight: 700; color: var(--ink); }

/* FOOT */
.foot { padding: 36px 0 0; color: var(--muted); font-size: 13.5px; max-width: 60ch; }

/* DIALOG */
.detailDialog {
  max-width: 920px; width: 92vw;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 24px;
  padding: 36px; box-shadow: var(--shadow-lg);
  position: relative;
}
.detailDialog::backdrop { background: rgba(27, 24, 21, 0.55); backdrop-filter: blur(4px); }
.close {
  position: absolute; right: 18px; top: 18px;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--surface-warm); border: 1px solid var(--line);
  font-size: 22px; cursor: pointer; color: var(--ink);
  line-height: 1; min-height: 40px;
}
.close:hover { background: var(--terracotta-soft); border-color: var(--terracotta); }
.detailDialog h2 { font-size: 28px; margin-bottom: 4px; }
.detailDialog .lbl { color: var(--muted); font-size: 13px; }
.bigVal {
  font-family: var(--font-display); font-weight: 500;
  font-size: 44px; letter-spacing: -0.025em; line-height: 1;
  margin: 12px 0 4px; color: var(--teal); font-variant-numeric: tabular-nums;
}
.detailGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 22px; }
.detailBox {
  background: var(--surface-warm); border: 1px solid var(--line);
  border-radius: 18px; padding: 18px 20px;
}
.detailBox h3 { font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: 18px; color: var(--terracotta); margin-bottom: 10px; }
.detailBox p { margin: 0; color: var(--ink-soft); line-height: 1.55; white-space: pre-wrap; font-size: 14.5px; }
.detailBox ul { margin: 0; padding-left: 20px; line-height: 1.7; font-size: 14.5px; color: var(--ink-soft); }
.detailBox a { color: var(--teal); word-break: break-all; display: block; margin: 4px 0; }

@media (max-width: 760px) {
  html { font-size: 16px; }
  main, .top { padding: 16px 18px; }
  .hero { padding: 32px 0 24px; }
  .card.panel { padding: 22px; margin: 12px 0; border-radius: 22px; }
  .resultHead { flex-direction: column; align-items: stretch; gap: 14px; }
  .totalBox { text-align: left; }
  .detailGrid { grid-template-columns: 1fr; }
  .miniGrid { grid-template-columns: 1fr; }
  .panelHead { gap: 14px; margin-bottom: 16px; }
  .detailDialog { padding: 24px; }
}
