
:root {
  color-scheme: dark;
  --bg: #090a0c;
  --bg2: #0d0f12;
  --panel: #121519;
  --panel2: #171b20;
  --panel3: #1c2127;
  --line: #272d35;
  --line2: #343b45;
  --text: #f4f6f8;
  --muted: #959da8;
  --muted2: #b5bbc3;
  --green: #45d38a;
  --green-bg: rgba(69,211,138,.12);
  --amber: #efb868;
  --amber-bg: rgba(239,184,104,.13);
  --blue: #65a7ff;
  --blue-bg: rgba(101,167,255,.12);
  --danger: #ff7777;
  --radius: 18px;
  --shadow: 0 14px 40px rgba(0,0,0,.32);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 50% -20%, rgba(80,88,100,.16), transparent 38%),
    linear-gradient(180deg, var(--bg2), var(--bg));
  color: var(--text);
}

body {
  min-height: 100svh;
  padding:
    max(env(safe-area-inset-top), 10px)
    env(safe-area-inset-right)
    calc(92px + env(safe-area-inset-bottom))
    env(safe-area-inset-left);
  -webkit-tap-highlight-color: transparent;
}

button, input { font: inherit; }
button { cursor: pointer; }

.app-shell {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 18px 18px 32px;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 4px 19px;
}

.brand {
  margin: 0;
  font-family: ui-serif, Georgia, serif;
  font-size: 34px;
  font-weight: 720;
  letter-spacing: -.045em;
}

.tagline {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.round-btn {
  width: 43px;
  height: 43px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel2);
  color: var(--muted2);
  display: inline-grid;
  place-items: center;
  font-size: 19px;
}

.round-btn.small {
  width: 36px;
  height: 36px;
  font-size: 22px;
}

.view { display: none; }
.view.active { display: block; }

.search-wrap {
  min-height: 60px;
  padding: 0 15px;
  border: 1px solid var(--line2);
  border-radius: 17px;
  display: flex;
  align-items: center;
  gap: 11px;
  background: linear-gradient(180deg, #1a1f25, #15191e);
  box-shadow: inset 0 1px rgba(255,255,255,.025);
}

.search-wrap:focus-within {
  border-color: #56606d;
  box-shadow: 0 0 0 3px rgba(130,145,165,.08);
}

.search-icon {
  color: #d3d8df;
  font-size: 27px;
  transform: rotate(-12deg);
}

.search-wrap input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 19px;
  font-weight: 560;
}

.search-wrap input::placeholder {
  color: #777f89;
  font-weight: 450;
}

.clear-btn {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: #30363e;
  color: #c8ced5;
  font-size: 20px;
  display: grid;
  place-items: center;
}

.fresh-row {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  color: var(--muted);
  font-size: 12.5px;
}

.fresh-left {
  display: flex;
  align-items: center;
  gap: 7px;
}

.fresh-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(69,211,138,.08);
}

.text-btn {
  border: 0;
  background: transparent;
  color: #c7ccd3;
  padding: 8px 0 8px 12px;
  font-size: 12.5px;
}

.search-hero {
  text-align: center;
  padding: 56px 22px 36px;
  color: var(--muted);
}

.hero-icon {
  width: 54px;
  height: 54px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--panel2);
  border: 1px solid var(--line);
  color: #cfd5dc;
  font-size: 28px;
}

.search-hero h2 {
  margin: 0;
  color: var(--text);
  font-size: 21px;
  letter-spacing: -.02em;
}

.search-hero p {
  max-width: 390px;
  margin: 8px auto 18px;
  line-height: 1.5;
  font-size: 14px;
}

.example-chips {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.example-chip, .count-pill {
  border: 1px solid var(--line);
  background: var(--panel2);
  color: #c6ccd3;
  border-radius: 999px;
}

.example-chip {
  padding: 8px 12px;
}

.section-title-row, .view-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-title-row {
  margin: 11px 2px 10px;
}

.section-title-row h2,
.view-head h2 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -.02em;
}

.count-pill {
  min-width: 28px;
  height: 26px;
  padding: 0 8px;
  display: inline-grid;
  place-items: center;
  font-size: 12px;
  font-weight: 750;
}

.best-banner {
  border: 1px solid rgba(69,211,138,.28);
  background: var(--green-bg);
  border-radius: var(--radius);
  padding: 13px 14px;
  margin-bottom: 11px;
}

.best-banner .eyebrow {
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.best-banner strong {
  display: block;
  margin-top: 4px;
  font-size: 15px;
}

.best-banner span {
  display: block;
  margin-top: 3px;
  color: #b8c6be;
  font-size: 12px;
}

.offer-list {
  display: grid;
  gap: 11px;
}

.offer-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #14181c, #111418);
  color: inherit;
  padding: 15px;
  text-align: left;
  box-shadow: inset 0 1px rgba(255,255,255,.018);
}

.offer-card.best {
  border-color: rgba(69,211,138,.35);
}

.offer-main {
  display: grid;
  grid-template-columns: 92px 1fr auto;
  gap: 13px;
  align-items: start;
}

.card-thumb {
  width: 92px;
  height: 58px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.13);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: 7px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .035em;
  color: white;
  box-shadow: inset 0 0 28px rgba(255,255,255,.05);
}

.card-thumb::after {
  content: "";
  position: absolute;
  inset: -30% -20%;
  transform: rotate(-16deg);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.12), transparent);
}

.card-thumb.amex {
  color: #202429;
  background: linear-gradient(135deg, #d7d9dc, #949ba2 50%, #e4e6e8);
}
.card-thumb.chase {
  background: linear-gradient(135deg, #092b61, #0a5d9b 52%, #061d3b);
}
.card-thumb.other {
  background: linear-gradient(135deg, #363b43, #14171b);
}

.offer-copy { min-width: 0; }

.bank-line {
  color: var(--muted);
  font-size: 11.5px;
  margin-bottom: 2px;
}

.card-name {
  font-size: 16px;
  font-weight: 760;
  line-height: 1.2;
}

.offer-headline {
  margin-top: 9px;
  font-size: 17px;
  font-weight: 760;
  line-height: 1.25;
}

.offer-headline .value {
  color: var(--green);
}

.offer-details {
  margin-top: 3px;
  color: #aeb5be;
  font-size: 12.5px;
  line-height: 1.4;
}

.best-badge {
  white-space: nowrap;
  align-self: start;
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid rgba(69,211,138,.3);
  border-radius: 999px;
  padding: 6px 8px;
  font-size: 10px;
  font-weight: 800;
}

.offer-footer {
  border-top: 1px solid var(--line);
  margin-top: 13px;
  padding-top: 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
}
.status-pill.active {
  color: var(--green);
  background: var(--green-bg);
}
.status-pill.needs {
  color: var(--amber);
  background: var(--amber-bg);
}

.expiry {
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.chevron {
  color: #78818c;
  margin-left: 3px;
}

.empty-state {
  text-align: center;
  padding: 48px 18px;
  color: var(--muted);
}
.empty-state h3 {
  color: var(--text);
  margin: 10px 0 0;
}
.empty-state p {
  margin: 7px auto 0;
  max-width: 340px;
  line-height: 1.45;
}
.empty-icon {
  font-size: 31px;
}

.view-head {
  margin: 0 2px 16px;
}
.view-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.small-btn, .primary-btn, .secondary-btn, .issuer-btn {
  min-height: 42px;
  border-radius: 13px;
  padding: 0 13px;
  font-weight: 700;
}

.small-btn, .secondary-btn {
  border: 1px solid var(--line2);
  background: var(--panel2);
  color: var(--text);
}
.primary-btn {
  border: 1px solid rgba(69,211,138,.32);
  background: #123725;
  color: #85e5b1;
}
.primary-btn.full { width: 100%; }

.segmented {
  display: flex;
  overflow-x: auto;
  gap: 7px;
  scrollbar-width: none;
  padding-bottom: 3px;
  margin-bottom: 13px;
}
.segmented::-webkit-scrollbar { display: none; }

.segment {
  white-space: nowrap;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--muted2);
  border-radius: 999px;
  padding: 8px 11px;
  font-size: 12px;
}
.segment.active {
  color: var(--text);
  border-color: #4a535f;
  background: #252b32;
}

.activation-summary {
  margin-bottom: 11px;
}
.activation-card {
  border: 1px solid rgba(239,184,104,.24);
  background: var(--amber-bg);
  border-radius: var(--radius);
  padding: 13px 14px;
}
.activation-card strong {
  font-size: 14px;
}
.activation-card p {
  color: #c6b89e;
  font-size: 12px;
  margin: 4px 0 10px;
  line-height: 1.4;
}
.activation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.issuer-btn {
  border: 1px solid var(--line2);
  color: white;
}
.issuer-btn.chase {
  background: linear-gradient(180deg, #0e4779, #10365a);
}
.issuer-btn.amex {
  background: linear-gradient(180deg, #427f98, #2c5d71);
}

.settings-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 15px;
  margin-bottom: 12px;
}
.settings-row, .settings-kv {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.settings-title {
  font-size: 15px;
  font-weight: 780;
}
.settings-sub, .settings-note {
  color: var(--muted);
  font-size: 12px;
}
.settings-sub { margin-top: 3px; }
.settings-note {
  margin: 10px 0 0;
  line-height: 1.45;
}
.settings-kv {
  border-top: 1px solid var(--line);
  padding: 11px 0;
  color: var(--muted2);
  font-size: 12px;
}
.settings-kv strong {
  color: var(--text);
  font-weight: 700;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.button-row > * { flex: 1 1 150px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.stat {
  border: 1px solid var(--line);
  background: var(--panel2);
  border-radius: 13px;
  padding: 10px;
}
.stat strong {
  display: block;
  font-size: 18px;
}
.stat span {
  color: var(--muted);
  font-size: 10px;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  height: calc(72px + env(safe-area-inset-bottom));
  padding: 6px max(18px, calc((100vw - 720px)/2 + 18px)) env(safe-area-inset-bottom);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: rgba(9,10,12,.93);
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
}

.nav-btn {
  border: 0;
  background: transparent;
  color: #7e8792;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10px;
}
.nav-icon {
  font-size: 23px;
  line-height: 1;
}
.nav-btn.active {
  color: #9ce9bd;
}

.sheet-backdrop {
  position: fixed;
  z-index: 60;
  inset: 0;
  background: rgba(0,0,0,.58);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-top: 54px;
}

.sheet {
  width: min(720px, 100%);
  max-height: 90svh;
  overflow: auto;
  background: #101317;
  border: 1px solid #2a3037;
  border-bottom: 0;
  border-radius: 25px 25px 0 0;
  padding: 9px 18px calc(24px + env(safe-area-inset-bottom));
  box-shadow: 0 -20px 60px rgba(0,0,0,.45);
}

.sheet-handle {
  width: 42px;
  height: 5px;
  border-radius: 999px;
  background: #363d45;
  margin: 0 auto 14px;
}
.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.sheet-merchant {
  color: var(--muted);
  font-size: 12px;
}
.sheet h2 {
  margin: 2px 0 0;
  font-size: 22px;
}
.sheet-offer {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 15px;
}
.sheet-offer .headline {
  font-size: 20px;
  font-weight: 800;
}
.sheet-offer .desc {
  margin-top: 6px;
  color: var(--muted2);
  font-size: 13px;
  line-height: 1.45;
}
.sheet-meta {
  margin-top: 13px;
  display: grid;
  gap: 8px;
}
.sheet-meta-row {
  border-top: 1px solid var(--line);
  padding-top: 9px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--muted2);
}
.sheet-actions {
  margin-top: 13px;
  display: grid;
  gap: 8px;
}
.sheet-actions button {
  min-height: 48px;
}

.lock-screen {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(8,9,11,.98);
}

.lock-card {
  width: min(390px, 100%);
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 24px;
  padding: 24px;
  text-align: center;
  box-shadow: var(--shadow);
}

.lock-mark {
  width: 62px;
  height: 62px;
  margin: 0 auto 13px;
  border-radius: 17px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #20252b, #111419);
  border: 1px solid var(--line2);
  font-family: ui-serif, Georgia, serif;
  font-size: 22px;
}

.lock-card h1 {
  margin: 0;
  font-family: ui-serif, Georgia, serif;
}
.lock-card p {
  color: var(--muted);
  line-height: 1.45;
  margin: 7px 0 18px;
}
.form-error {
  margin-top: 10px;
  color: #ff9c9c;
  font-size: 12px;
}

.hidden { display: none !important; }

@media (max-width: 420px) {
  .offer-main {
    grid-template-columns: 78px 1fr;
  }
  .card-thumb {
    width: 78px;
    height: 50px;
  }
  .best-badge {
    grid-column: 2;
    justify-self: start;
  }
  .brand { font-size: 31px; }
}

@media (min-width: 700px) {
  .app-shell { padding-top: 28px; }
}


.refresh-sheet {
  padding-bottom: calc(30px + env(safe-area-inset-bottom));
}
.refresh-intro {
  margin-top: 10px;
  color: var(--muted2);
  font-size: 13px;
  line-height: 1.45;
}
.issuer-sync-list {
  display: grid;
  gap: 11px;
  margin-top: 15px;
}
.issuer-sync-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 15px;
}
.issuer-sync-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.issuer-name {
  font-size: 16px;
  font-weight: 800;
}
.issuer-sync-time {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11.5px;
}
.issuer-sync-card p {
  color: var(--muted2);
  font-size: 12px;
  line-height: 1.45;
  margin: 10px 0 12px;
}
.issuer-sync-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.sync-badge {
  border-radius: 999px;
  padding: 6px 8px;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}
.sync-badge.fresh {
  color: var(--green);
  background: var(--green-bg);
}
.sync-badge.stale {
  color: var(--amber);
  background: var(--amber-bg);
}
.refresh-import {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 15px;
}
.paste-box {
  width: 100%;
  min-height: 150px;
  margin-top: 11px;
  padding: 12px;
  resize: vertical;
  border: 1px solid var(--line2);
  border-radius: 13px;
  outline: none;
  background: #0d1013;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  line-height: 1.5;
}
.paste-box:focus {
  border-color: #56606d;
}
.refresh-warning {
  margin-top: 12px;
  border: 1px solid rgba(239,184,104,.22);
  background: var(--amber-bg);
  border-radius: 14px;
  padding: 12px;
  color: #cdbd9f;
  font-size: 11.5px;
  line-height: 1.45;
}
@media (max-width: 430px) {
  .issuer-sync-actions {
    grid-template-columns: 1fr;
  }
}
