:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --ink: #151817;
  --muted: #69716e;
  --line: #e8ebe9;
  --green: #087f5b;
  --green-dark: #066848;
  --green-soft: #eaf7f1;
  --amber: #9a641b;
  --amber-soft: #fff6e7;
  --nav-h: 68px;
  --font: "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { color: inherit; }

:focus-visible {
  outline: 3px solid rgba(8, 127, 91, .28);
  outline-offset: 2px;
}

.app {
  position: relative;
  width: min(100%, 440px);
  min-height: 100vh;
  margin: 0 auto;
  overflow: clip;
  background: var(--surface);
}

.page {
  padding: max(10px, env(safe-area-inset-top)) 16px calc(var(--nav-h) + 30px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: 44px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -.025em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  flex: 0 0 auto;
  border-radius: 8px;
  color: #fff;
  background: var(--ink);
  font-size: 12px;
}

.back {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-left: -10px;
  border-radius: 12px;
}

.topbar-spacer {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
}

.top-actions { display: flex; align-items: center; gap: 2px; }

.icon-link {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  color: var(--ink);
}

.back svg, .icon-link svg, .nav-item svg, .inline-icon {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.view-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 8px 0 0;
  border-bottom: 1px solid var(--line);
}

.view-tab {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 46px;
  color: #838a87;
  font-size: 15px;
  font-weight: 800;
}

.view-tab::after {
  position: absolute;
  right: 24px;
  bottom: -1px;
  left: 24px;
  height: 2px;
  border-radius: 999px 999px 0 0;
  background: transparent;
  content: "";
}

.view-tab.is-active { color: var(--ink); }
.view-tab.is-active::after { background: var(--ink); }

.favorites {
  margin: 12px 0 0;
  padding: 11px 0 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.favorites-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.favorites-head strong { font-size: 12px; }
.favorites-head a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  margin: -10px -8px -10px 0;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
}

.favorite-list {
  display: flex;
  gap: 7px;
  margin-right: -16px;
  padding-right: 16px;
  overflow-x: auto;
  scrollbar-width: none;
}

.favorite-list::-webkit-scrollbar { display: none; }

.favorite-brand {
  display: inline-flex;
  align-items: center;
  min-width: max-content;
  min-height: 44px;
  padding: 0 13px;
  flex: 0 0 auto;
  border: 1px solid #dce2df;
  border-radius: 999px;
  color: #285c49;
  background: var(--green-soft);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.favorite-brand.is-preview {
  color: #616965;
  background: var(--surface);
  cursor: default;
}

.prototype-badge, .badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  color: #557067;
  background: var(--green-soft);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.title {
  margin: 17px 0 0;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.26;
  letter-spacing: -.045em;
  word-break: keep-all;
}

.subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  word-break: keep-all;
}

.payment-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.payment-link strong { color: var(--green); font-size: 11px; }

.section { margin-top: 24px; }
.section.compact { margin-top: 16px; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 28px;
  margin-bottom: 8px;
}

.section-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.03em;
}

.section-head a, .section-head span { color: var(--muted); font-size: 12px; }

.search {
  display: flex;
  align-items: center;
  height: 50px;
  margin-top: 14px;
  border: 1px solid #dde1df;
  border-radius: 14px;
  color: var(--muted);
  background: var(--bg);
}

.search.top-search { margin-top: 12px; }

.search svg { margin-left: 14px; }

.search input {
  width: 100%;
  height: 100%;
  min-width: 0;
  padding: 0 14px 0 10px;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 14px;
}

.search input::placeholder { color: #858d89; opacity: 1; }

.chips {
  display: flex;
  gap: 8px;
  margin: 10px -16px 0;
  padding: 0 16px;
  overflow-x: auto;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar { display: none; }

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #4f5653;
  background: #fff;
  font-size: 13px;
  font-weight: 700;
}

.chip.active { border-color: var(--ink); color: #fff; background: var(--ink); }

.card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.card.soft { border-color: transparent; background: var(--green-soft); }
.card.pad { padding: 16px; }

.row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 88px;
  border-bottom: 1px solid var(--line);
}

.row:last-child { border-bottom: 0; }

button.row {
  width: calc(100% + 12px);
  margin: 0 -6px;
  padding: 0 6px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 12px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

button.row:hover { background: #fafbfa; }

.row-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  color: #256548;
  background: var(--green-soft);
  font-size: 14px;
  font-weight: 800;
}

.row-icon.warm { color: #76552f; background: #f5ecdf; }
.row-icon.violet { color: #5e4f8c; background: #efecf8; }
.row-main { min-width: 0; }

.row-main strong {
  display: block;
  overflow: hidden;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-main p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.35; }
.recommended-method { display: block; margin-top: 3px; overflow: hidden; color: #39423e; font-size: 11px; font-weight: 700; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.list-method { display: block; margin-top: 5px; overflow: hidden; color: var(--muted); font-size: 11px; font-weight: 700; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }

.label { color: var(--ink); font-size: 13px; font-weight: 800; }
.muted { color: var(--muted); }
.amount { color: var(--green); font-size: 17px; font-weight: 800; line-height: 1.15; white-space: nowrap; }

.benefit-value {
  display: grid;
  justify-items: end;
  gap: 4px;
  min-width: 0;
  max-width: 126px;
  text-align: right;
}

.benefit-cap { overflow: hidden; max-width: 100%; color: var(--muted); font-size: 10px; font-weight: 700; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.benefit-cap.is-recorded { min-width: 124px; letter-spacing: -.03em; white-space: nowrap; }

.benefit-type {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  color: #557067;
  background: var(--green-soft);
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}

.row-main .benefit-type,
.merchant-copy .benefit-type { min-height: 18px; margin-top: 6px; }

.saved-benefit {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 88px;
  padding: 15px 16px;
  border-radius: 16px;
  background: var(--green-soft);
}

.summary-item { min-width: 0; }
.summary-item p { margin: 0 0 4px; color: #416d5c; font-size: 12px; font-weight: 700; }
.summary-item strong { display: block; font-size: 18px; line-height: 1.25; letter-spacing: -.025em; }

.summary-arrow {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 50%;
  color: var(--green);
  background: rgba(255,255,255,.72);
}

.promo-banner {
  display: grid;
  gap: 5px;
  width: 100%;
  min-height: 104px;
  padding: 17px 18px;
  border: 0;
  border-radius: 16px;
  color: #fff;
  background: var(--ink);
  text-align: left;
  cursor: pointer;
}

.promo-banner .promo-kicker { color: #a9d8c6; font-size: 11px; font-weight: 800; }
.promo-banner strong { font-size: 18px; line-height: 1.35; letter-spacing: -.035em; }
.promo-banner > span:last-child { color: #d5dcda; font-size: 12px; }

.stack { display: grid; gap: 10px; }
.divider { height: 1px; margin: 16px 0; background: var(--line); }

.notice {
  padding: 13px 14px;
  border-radius: 13px;
  color: #52605b;
  background: var(--bg);
  font-size: 12px;
  line-height: 1.55;
  word-break: keep-all;
}

.notice.caution { color: #785018; background: var(--amber-soft); }
.notice strong { color: var(--ink); }

.field { display: grid; gap: 7px; }
.field label, .field > span { font-size: 12px; font-weight: 800; }

.input {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid #dde1df;
  border-radius: 13px;
  color: var(--ink);
  background: var(--surface);
  font-size: 14px;
}

.input small { color: var(--muted); font-size: 11px; }

.button-row { display: grid; gap: 9px; }

.button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid var(--green);
  border-radius: 13px;
  color: #fff;
  background: var(--green);
  font-size: 14px;
  font-weight: 800;
  text-align: center;
}

.button:hover { background: var(--green-dark); }
.button.secondary { border-color: #d9dddb; color: var(--ink); background: var(--surface); }
.button.compact { width: auto; min-height: 44px; }
.button:disabled { border-color: #cfd5d2; color: #7f8783; background: #e9ecea; cursor: default; }

.result-page { background: var(--surface); }

.result-topbar .brand {
  flex: 1;
  justify-content: center;
  font-size: 16px;
}

.result-hero {
  padding: 24px 0 20px;
  border-bottom: 1px solid var(--line);
}

.recommendation-lede {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -.02em;
}

.result-label {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}

.result-hero h1 {
  margin: 0;
  color: var(--green);
  font-size: clamp(38px, 11vw, 48px);
  line-height: 1.12;
  letter-spacing: -.055em;
}

.result-discount-type {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-top: 10px;
  padding: 0 8px;
  border-radius: 999px;
  color: #557067;
  background: var(--green-soft);
  font-size: 10px;
  font-weight: 800;
}

.result-details { border-bottom: 1px solid var(--line); }

.result-amount-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  column-gap: 16px;
  padding: 17px 0 15px;
  border-bottom: 1px solid var(--line);
}

.result-amount-field label,
.result-detail-row > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.result-amount-control {
  display: flex;
  align-items: center;
  width: 126px;
  min-height: 44px;
  border-bottom: 1px solid #b7bdb9;
}

.result-amount-control:focus-within { border-color: var(--green); }

.result-amount-control input {
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0 4px 0 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  text-align: right;
}

.result-amount-control span { font-size: 14px; font-weight: 800; }
.result-amount-field small { grid-column: 1 / -1; margin-top: 6px; color: var(--muted); font-size: 10px; text-align: right; }

.result-burden,
.sheet-burden {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
}

.result-burden span,
.sheet-burden span { color: var(--muted); font-size: 12px; font-weight: 700; }
.result-burden strong,
.sheet-burden strong { font-size: 16px; letter-spacing: -.025em; }

.result-detail-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px 12px;
  padding: 17px 0;
}

.result-detail-row + .result-detail-row { border-top: 1px solid var(--line); }
.result-detail-row strong { font-size: 14px; line-height: 1.45; text-align: right; word-break: keep-all; }
.result-order small { grid-column: 1 / -1; color: var(--muted); font-size: 11px; text-align: right; }
.alternative-benefit small { grid-column: 1 / -1; color: var(--amber); font-size: 10px; font-weight: 700; line-height: 1.45; text-align: right; }

.benefit-conditions {
  border-bottom: 1px solid var(--line);
}

.benefit-conditions > summary {
  min-height: 56px;
  font-size: 14px;
}

.condition-groups {
  display: grid;
  gap: 0;
  padding-bottom: 6px;
}

.condition-groups section {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 8px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}

.condition-type {
  align-self: start;
  padding: 3px 7px;
  border-radius: 999px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 10px;
  font-weight: 800;
}

.condition-groups strong { min-width: 0; font-size: 13px; line-height: 1.5; }
.condition-groups p { grid-column: 1 / -1; margin: 2px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; word-break: keep-all; }
.condition-groups a { grid-column: 1 / -1; justify-self: start; min-height: 32px; padding-top: 7px; color: var(--green); font-size: 11px; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }

.assumption-note {
  margin: 12px 0 0;
  color: #858d89;
  font-size: 10px;
  line-height: 1.55;
  word-break: keep-all;
}

.benefit-brief {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 50px;
  margin-top: 1px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.benefit-brief strong { color: var(--green); font-size: 12px; }
.benefit-brief span { color: var(--muted); }
.benefit-brief a { min-height: 44px; display: inline-flex; align-items: center; color: var(--green); font-size: 10px; font-weight: 800; }

.usage-recorder { margin-top: 12px; }
.usage-hint { margin: 0 0 9px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.usage-status { margin-bottom: 9px; padding: 11px 12px; border-radius: 12px; background: var(--green-soft); }
.usage-status strong, .usage-status span { display: block; }
.usage-status strong { color: var(--green); font-size: 12px; }
.usage-status span { margin-top: 3px; color: #557067; font-size: 10px; }
.usage-actions { display: grid; gap: 7px; }
.usage-actions .button { min-height: 44px; }
.usage-actions [hidden], .usage-status[hidden] { display: none; }

.detail-hero { padding: 18px; }
.detail-hero .amount { display: block; margin-top: 12px; font-size: 27px; letter-spacing: -.04em; }
.detail-hero .detail-benefit-value { justify-items: start; margin-top: 12px; }
.detail-hero .detail-benefit-value .amount { margin-top: 0; }
.detail-hero h2 { margin: 5px 0 0; font-size: 19px; letter-spacing: -.03em; }
.detail-hero p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }

.detail-list { border-top: 1px solid var(--line); }

.detail-item {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.45;
}

.detail-item span:first-child { color: var(--muted); }
.detail-item strong { max-width: 62%; text-align: right; }

details {
  border-bottom: 1px solid var(--line);
}

summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  list-style: none;
}

summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; color: var(--muted); font-size: 18px; font-weight: 400; }
details[open] summary::after { content: "−"; }
details p { margin: -2px 0 14px; color: var(--muted); font-size: 12px; line-height: 1.6; }

.payment-alternatives,
.benefit-source {
  border-bottom: 1px solid var(--line);
}

.payment-alternatives > summary,
.benefit-source > summary { min-height: 54px; font-size: 14px; }

.payment-option {
  display: grid;
  grid-template-columns: minmax(0, .68fr) minmax(0, 1.32fr);
  gap: 5px 10px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}

.payment-option span { color: var(--muted); font-size: 11px; font-weight: 700; }
.payment-option strong { font-size: 13px; line-height: 1.45; text-align: right; word-break: keep-all; }
.payment-option small { grid-column: 1 / -1; color: var(--amber); font-size: 10px; font-weight: 700; line-height: 1.5; text-align: right; }
.payment-alternatives .combination-note { margin: -2px 0 13px; color: var(--muted); font-size: 10px; text-align: right; }
.benefit-source > p { margin-bottom: 8px; }
.benefit-source > a { display: inline-flex; align-items: center; min-height: 40px; margin-bottom: 8px; color: var(--green); font-size: 11px; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }

.upcoming-page .chips { margin-top: 10px; }
.upcoming-group { margin-top: 20px; }

.date-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}

.date-heading div > span { color: var(--green); font-size: 10px; font-weight: 800; }
.date-heading h2 { margin: 2px 0 0; font-size: 18px; letter-spacing: -.035em; }
.date-count { color: var(--muted); font-size: 11px; }

.upcoming-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 52px;
  align-items: center;
  gap: 10px;
  min-height: 92px;
  padding: 11px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.upcoming-row.is-official { border-color: #d6e9e1; background: #fbfefd; }
.upcoming-row .row-icon { width: 44px; height: 44px; }
.upcoming-row-copy { min-width: 0; }
.upcoming-row-copy h3 { margin: 1px 0 0; font-size: 14px; line-height: 1.25; }
.source-label { color: var(--green); font-size: 9px; font-weight: 800; }
.source-label.preview { color: #7e8582; }
.upcoming-row-copy p { margin: 3px 0 0; color: var(--muted); font-size: 11px; line-height: 1.35; word-break: keep-all; }

.reminder-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  min-height: 44px;
  padding: 0;
  border: 1px solid #dce1de;
  border-radius: 12px;
  color: #8b928e;
  background: #f4f6f5;
  font-size: 12px;
  font-weight: 800;
}

.safe-note {
  margin: 14px 0 0;
  color: #929996;
  font-size: 10px;
  line-height: 1.5;
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.manage-row {
  display: grid;
  grid-template-columns: 24px 44px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 112px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.order { color: #939a97; font-size: 12px; text-align: center; }

.manage-actions {
  grid-column: 2 / 4;
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.move-control,
.remove {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: var(--bg);
  font-size: 17px;
}

.move-control.is-muted { color: #b9bfbc; }

.remove {
  color: #7b5555;
  font-size: 16px;
}

.check {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--green);
  border-radius: 50%;
  color: #fff;
  background: var(--green);
  font-size: 13px;
  font-weight: 800;
}

/* 즐겨찾는 브랜드 관리 화면 */
.brands-page .page {
  padding-bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom));
}

.brands-page .topbar {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
}

.brands-page .topbar .brand {
  justify-content: center;
  font-size: 16px;
}

.brand-search {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  min-height: 44px;
  margin-top: 8px;
  border: 1px solid #dde1df;
  border-radius: 12px;
  color: var(--muted);
  background: var(--bg);
}

.brand-search .inline-icon {
  width: 18px;
  height: 18px;
  margin-left: 13px;
}

.brand-search input {
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0 12px 0 2px;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 14px;
}

.brand-search:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(8, 127, 91, .12);
}

.brand-search input::placeholder { color: #858d89; opacity: 1; }

.brand-categories {
  display: flex;
  gap: 8px;
  margin: 10px -16px 0;
  padding: 0 16px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
}

.brand-categories::-webkit-scrollbar { display: none; }

.brand-category {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: max-content;
  min-height: 44px;
  padding: 0 14px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #4f5653;
  background: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.brand-category:hover { background: #fafbfa; }
.brand-category.is-active { border-color: var(--ink); color: #fff; background: var(--ink); }
.brand-category:focus-visible { outline: 3px solid rgba(8, 127, 91, .28); outline-offset: 2px; }

.brands-selection-summary {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.brands-selection-summary strong {
  flex: 0 0 auto;
  color: var(--green);
  font-size: 13px;
}

.brands-selection-summary > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brands-prototype-note {
  margin: 3px 0 0;
  color: #929996;
  font-size: 10px;
  line-height: 1.45;
}

.brands-section { margin-top: 17px; }

.brands-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 28px;
  margin-bottom: 4px;
}

.brands-section-head h1 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -.025em;
}

.brands-section-head span { color: var(--muted); font-size: 12px; }

.brand-picker {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.brand-option {
  position: relative;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 60px;
  padding: 7px 4px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.brand-option:hover { background: #fafbfa; }
.brand-option.is-selected { background: #f6fbf8; }
.brand-option[hidden] { display: none; }

.brand-option:focus-within {
  z-index: 1;
  border-radius: 8px;
  outline: 3px solid rgba(8, 127, 91, .28);
  outline-offset: -3px;
}

.brand-check-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.brand-monogram {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  color: #256548;
  background: var(--green-soft);
  font-size: 11px;
  font-weight: 800;
}

.brand-monogram.warm { color: #76552f; background: #f5ecdf; }
.brand-monogram.violet { color: #5e4f8c; background: #efecf8; }

.brand-option-copy { min-width: 0; }

.brand-option-copy strong {
  display: block;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-option-copy small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.brand-toggle-state {
  display: grid;
  grid-template-columns: 18px auto;
  align-items: center;
  gap: 5px;
  min-width: 58px;
  min-height: 44px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.brand-check-mark {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1.5px solid #b6bdb9;
  border-radius: 6px;
  background: var(--surface);
}

.brand-check-input:checked ~ .brand-toggle-state { color: var(--green); }
.brand-check-input:checked ~ .brand-toggle-state .brand-check-mark { border-color: var(--green); background: var(--green); }
.brand-check-input:checked ~ .brand-toggle-state .brand-check-mark::after {
  width: 7px;
  height: 4px;
  border-bottom: 1.8px solid #fff;
  border-left: 1.8px solid #fff;
  content: "";
  transform: translateY(-1px) rotate(-45deg);
}

.brand-empty {
  margin: 0;
  padding: 30px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.brand-empty[hidden] { display: none; }
.brands-complete { margin-top: 16px; }

/* 첫 사용 수단 선택 */
.onboarding-page .app { min-height: 100dvh; }
.onboarding-page .page { padding-bottom: calc(94px + env(safe-area-inset-bottom)); }

.onboarding-topbar {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
}

.onboarding-topbar .brand { justify-content: center; font-size: 16px; }

.onboarding-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin-top: 20px;
  padding: 4px;
  border-radius: 12px;
  background: var(--bg);
}

.onboarding-tab {
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.onboarding-tab.is-active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 1px 4px rgba(28, 35, 32, .08);
}

.onboarding-summary {
  min-height: 36px;
  padding-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.onboarding-summary strong { color: var(--green); }
.onboarding-list { border-top: 1px solid var(--line); }

.onboarding-option {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.onboarding-option.is-selected { background: #f8fcfa; }

.onboarding-option-head {
  position: relative;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 66px;
  padding: 8px 4px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.onboarding-option-head:focus-within {
  border-radius: 8px;
  outline: 3px solid rgba(8, 127, 91, .28);
  outline-offset: -3px;
}

.onboarding-option-head .brand-check-input:checked ~ .brand-toggle-state { color: var(--green); }
.onboarding-option-head .brand-check-input:checked ~ .brand-toggle-state .brand-check-mark { border-color: var(--green); background: var(--green); }
.onboarding-option-head .brand-check-input:checked ~ .brand-toggle-state .brand-check-mark::after {
  width: 7px;
  height: 4px;
  border-bottom: 1.8px solid #fff;
  border-left: 1.8px solid #fff;
  content: "";
  transform: translateY(-1px) rotate(-45deg);
}

.method-details {
  display: grid;
  gap: 12px;
  padding: 1px 4px 14px 52px;
}

.method-details fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.method-details legend { margin-bottom: 7px; color: var(--muted); font-size: 11px; font-weight: 800; }

.method-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.method-choices-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.method-choices-wrap { display: flex; flex-wrap: wrap; }

.method-choice { min-width: 0; cursor: pointer; }
.method-choice input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.method-choice span {
  display: grid;
  place-items: center;
  min-width: 52px;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid #dce1de;
  border-radius: 10px;
  color: #555d59;
  background: var(--surface);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.method-choice input:checked + span { border-color: var(--green); color: var(--green); background: var(--green-soft); }
.method-choice input:focus-visible + span { outline: 3px solid rgba(8, 127, 91, .28); outline-offset: 2px; }

.onboarding-action {
  position: fixed;
  z-index: 10;
  right: max(16px, calc((100vw - 440px) / 2 + 16px));
  bottom: 0;
  left: max(16px, calc((100vw - 440px) / 2 + 16px));
  padding: 12px 0 max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, .96);
}

.method-add-link {
  display: grid;
  place-items: center;
  min-width: 52px;
  min-height: 44px;
  margin: -8px -8px -8px 0;
  color: var(--green) !important;
  font-weight: 800;
}

.owned-method-list { border-top: 1px solid var(--line); }
.owned-method-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 66px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.owned-method-copy { min-width: 0; }
.owned-method-copy strong,
.owned-method-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.owned-method-copy strong { font-size: 13px; }
.owned-method-copy small { margin-top: 3px; color: var(--muted); font-size: 11px; }

.owned-method-actions { display: flex; align-items: center; }
.owned-method-actions a,
.owned-method-actions button {
  display: grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 6px;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.owned-method-actions a { color: var(--green); }
.owned-method-empty { margin: 0; padding: 22px 8px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; text-align: center; }
.owned-method-empty[hidden] { display: none; }
.owned-method-count { margin: 8px 0 0; color: #929996; font-size: 10px; text-align: right; }

@media (max-width: 340px) {
  .onboarding-option-head { grid-template-columns: 36px minmax(0, 1fr) auto; gap: 8px; padding-inline: 2px; }
  .method-details { padding-left: 46px; }
  .method-choice span { min-width: 46px; padding-inline: 7px; font-size: 11px; }
  .owned-method-row { grid-template-columns: 36px minmax(0, 1fr) auto; gap: 7px; }
  .owned-method-actions a, .owned-method-actions button { min-width: 42px; padding-inline: 3px; }
}

@media (max-width: 340px) {
  .brand-option { grid-template-columns: 36px minmax(0, 1fr) auto; gap: 8px; padding-inline: 2px; }
  .brand-toggle-state { min-width: 54px; gap: 4px; font-size: 10px; }
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 52px;
  color: var(--muted);
  font-size: 11px;
}

.loading i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #b7bdba;
}

.bottom-nav {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: min(100%, 440px);
  min-height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding: 5px 12px calc(5px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,.97);
  backdrop-filter: blur(12px);
}

.nav-item {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 58px;
  border-radius: 12px;
  color: #808784;
  font-size: 10px;
  font-weight: 700;
}

.nav-item svg { margin-bottom: 4px; }
.nav-item.active { color: var(--green); }

body.sheet-open { overflow: hidden; }

.result-sheet {
  inset: auto 0 0;
  width: min(100%, 440px);
  max-width: none;
  max-height: calc(100dvh - max(18px, env(safe-area-inset-top)));
  margin: auto auto 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 22px 22px 0 0;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 -12px 42px rgba(10, 20, 16, .16);
}

.result-sheet[open] { animation: sheet-rise 240ms cubic-bezier(.2, .8, .2, 1); }
.result-sheet::backdrop { background: rgba(15, 20, 18, .42); }

.sheet-panel {
  max-height: calc(100dvh - max(18px, env(safe-area-inset-top)));
  padding: 8px 16px calc(18px + env(safe-area-inset-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sheet-handle {
  width: 36px;
  height: 5px;
  margin: 0 auto 3px;
  border-radius: 999px;
  background: #d4d8d6;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 62px;
}

.sheet-header p {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.sheet-header p span { color: #7f8783; font-weight: 600; }
.sheet-header h2 { margin: 0; font-size: 19px; letter-spacing: -.035em; }

.sheet-close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #4f5753;
  background: #f0f2f1;
  cursor: pointer;
}

.sheet-close svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.sheet-summary {
  display: grid;
  gap: 8px;
  margin: 0;
}

.sheet-summary .summary-saving { min-width: 0; padding: 13px 14px; border-radius: 14px; background: var(--green-soft); }
.sheet-summary .summary-saving span { display: block; margin-bottom: 2px; color: #547267; font-size: 11px; font-weight: 700; }
.sheet-summary .summary-saving strong { display: block; color: var(--green); font-size: 26px; line-height: 1.2; letter-spacing: -.045em; }
.sheet-summary .summary-saving {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}
.sheet-summary .summary-saving span,
.sheet-summary .summary-saving strong { grid-column: 1; }
.sheet-summary .summary-saving small {
  grid-column: 2;
  grid-row: 1 / 3;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  color: #557067;
  background: rgba(255,255,255,.72);
  font-size: 10px;
  font-weight: 800;
}

.sheet-details { margin-top: 10px; border-top: 1px solid var(--line); }

.sheet-amount-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 4px 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.sheet-amount-field label,
.sheet-detail-row > span { color: var(--muted); font-size: 12px; font-weight: 700; }

.sheet-amount-control {
  display: flex;
  align-items: center;
  width: 126px;
  min-height: 44px;
  border-bottom: 1px solid #b7bdb9;
}

.sheet-amount-control:focus-within { border-color: var(--green); }
.sheet-amount-control input { width: 100%; min-width: 0; height: 44px; padding: 0 4px 0 0; border: 0; outline: 0; background: transparent; font-size: 20px; font-weight: 800; text-align: right; }
.sheet-amount-control span { font-size: 14px; font-weight: 800; }
.sheet-amount-field small { grid-column: 1 / -1; color: var(--muted); font-size: 10px; text-align: right; }

.sheet-detail-row {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 6px 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.sheet-detail-row strong { min-width: 0; font-size: 13px; line-height: 1.45; text-align: right; word-break: keep-all; }
.result-sheet .recommendation-lede { margin: -3px 0 10px; }
.result-sheet .assumption-note { margin-bottom: 2px; }

@media (max-width: 350px) {
  .row { grid-template-columns: 42px minmax(0, 1fr) minmax(92px, auto); gap: 8px; }
  .row-icon { width: 42px; height: 42px; }
  .amount { font-size: 14px; }
  .benefit-value { max-width: 124px; }
  .benefit-brief { grid-template-columns: auto minmax(0, 1fr); }
  .benefit-brief a { grid-column: 1 / -1; min-height: 36px; }
  .upcoming-row { grid-template-columns: 42px minmax(0, 1fr) 48px; gap: 8px; padding-inline: 7px; }
  .upcoming-row .row-icon { width: 42px; height: 42px; }
  .reminder-button { width: 48px; }
}

@keyframes sheet-rise {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@media (min-width: 700px) {
  body { padding: 32px 0; }
  .app {
    min-height: calc(100vh - 64px);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: 0 20px 60px rgba(28,35,32,.08);
  }
  .bottom-nav { bottom: 32px; border-radius: 0 0 22px 22px; }
  .result-sheet { bottom: 32px; border-radius: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
  .result-sheet[open] { animation: none; }
}
