:root {
  --bg: #fff8fc;
  --surface: #ffffff;
  --surface-soft: #fff0f7;
  --primary: #d91b72;
  --primary-dark: #a51355;
  --ink: #241624;
  --muted: #716271;
  --line: #ead9e4;
  --green: #168466;
  --green-soft: #e0f6ef;
  --amber: #b77900;
  --amber-soft: #fff2cf;
  --blue: #275fd8;
  --blue-soft: #e6eeff;
  --teal: #087f89;
  --teal-soft: #ddf7f8;
  --violet: #5c48d8;
  --violet-soft: #eee9ff;
  --shadow: 0 14px 35px rgba(70, 20, 46, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: #f6edf3;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  position: relative;
  width: min(100vw, 440px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 72px;
  padding: 10px 16px;
  background: rgba(255, 248, 252, 0.96);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 8px;
  color: #fff;
  background: var(--primary);
  font-weight: 950;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 16px;
  font-weight: 950;
}

.brand span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.back-button,
.icon-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  font-size: 22px;
  font-weight: 900;
}

.back-button {
  display: none;
}

.has-history .back-button {
  display: grid;
}

.screen {
  display: none;
  min-height: calc(100vh - 72px);
  padding: 16px 16px 106px;
  overflow-y: auto;
}

.screen.is-active {
  display: block;
}

.hero-panel,
.pass-hero {
  padding: 18px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
}

.hero-panel h1,
.pass-hero h1,
.screen-heading h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.08;
  font-weight: 950;
}

.hero-panel p,
.pass-hero p,
.screen-heading p {
  margin: 9px 0 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: 14px;
  line-height: 1.45;
  font-weight: 650;
}

.screen-heading {
  margin-bottom: 16px;
}

.screen-heading p {
  color: var(--muted);
}

.eyebrow {
  display: inline-block;
  margin-bottom: 8px;
  color: #fff4c7;
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.primary-button,
.button-row button,
.section-title button,
.quick-actions button,
.category-pill,
.filter-strip button,
.segmented button,
.amount-grid button,
.settings-row {
  min-height: 42px;
  border-radius: 8px;
  font-weight: 900;
}

.primary-button {
  margin-top: 16px;
  padding: 0 16px;
  color: #fff;
  background: var(--ink);
}

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 50px;
  margin: 14px 0;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.search-field span {
  color: var(--primary);
  font-size: 19px;
  font-weight: 950;
}

.search-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 15px;
  font-weight: 750;
}

.category-strip,
.filter-strip {
  display: flex;
  gap: 8px;
  margin: 0 -16px;
  padding: 0 16px 4px;
  overflow-x: auto;
}

.category-pill,
.filter-strip button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  padding: 0 14px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--surface);
  white-space: nowrap;
}

.category-pill.is-active,
.filter-strip button.is-selected,
.segmented button.is-selected,
.amount-grid button.is-selected {
  color: #fff;
  border-color: var(--primary);
  background: var(--primary);
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.quick-actions button {
  padding: 0 10px;
  color: var(--primary);
  background: var(--surface-soft);
  border: 1px solid #f3c7da;
  font-size: 12px;
}

.content-block {
  margin-top: 22px;
}

.section-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-title h2 {
  margin: 0;
  font-size: 19px;
  line-height: 1.15;
  font-weight: 950;
}

.section-title p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  font-weight: 700;
}

.section-title button {
  padding: 0 10px;
  color: var(--primary);
  background: transparent;
}

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

.business-card,
.offer-card,
.event-card,
.list-card,
.plan-card,
.qr-card,
.gift-form,
.points-card,
.profile-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.business-card {
  overflow: hidden;
  text-align: left;
}

.business-visual,
.detail-visual {
  position: relative;
  min-height: 104px;
  padding: 14px;
  display: flex;
  align-items: flex-end;
  background: var(--surface-soft);
}

.business-visual strong,
.detail-visual strong {
  color: var(--ink);
  font-size: 16px;
  font-weight: 950;
  text-transform: lowercase;
}

.favorite-button {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface);
  font-size: 18px;
}

.favorite-button.is-on {
  color: var(--primary);
}

.business-body,
.offer-card,
.event-card,
.list-card {
  padding: 13px;
}

.business-meta,
.offer-meta,
.row-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.business-card h3,
.offer-card h3,
.event-card h3,
.list-card h3 {
  margin: 7px 0 5px;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.2;
  font-weight: 950;
}

.business-card p,
.offer-card p,
.event-card p,
.list-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  font-weight: 650;
}

.strong,
.business-category,
.audience-free,
.audience-premium {
  color: var(--primary);
  font-weight: 950;
}

.audience-free {
  color: var(--green);
}

.audience-premium {
  color: var(--violet);
}

.button-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.button-row button {
  flex: 1;
  color: var(--primary);
  background: var(--surface);
  border: 1px solid var(--line);
}

.map-preview {
  position: relative;
  height: 206px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(102deg, transparent 0 43%, rgba(255,255,255,0.78) 43% 50%, transparent 50%),
    linear-gradient(174deg, transparent 0 51%, rgba(255,255,255,0.68) 51% 58%, transparent 58%),
    var(--teal-soft);
}

.map-preview::before {
  content: "Carte Ambérieu centre";
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 5px 10px;
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font-size: 12px;
  font-weight: 950;
}

.map-pin {
  position: absolute;
  width: 34px;
  height: 34px;
  transform: translate(-50%, -50%);
  border: 3px solid #fff;
  border-radius: 50%;
  color: #fff;
  background: var(--primary);
  font-weight: 950;
}

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.segmented button {
  flex: 1;
  color: var(--muted);
  background: transparent;
}

.pass-hero {
  background: var(--ink);
}

.pass-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 12px;
  border-radius: 8px;
  color: #fff;
  background: var(--primary);
  font-size: 26px;
  font-weight: 950;
}

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

.plan-card {
  padding: 13px;
}

.plan-card.is-featured {
  border-color: var(--primary);
  background: var(--surface-soft);
}

.plan-card small {
  display: block;
  color: var(--primary);
  font-size: 11px;
  font-weight: 950;
}

.plan-card h2 {
  margin: 6px 0 6px;
  font-size: 16px;
  font-weight: 950;
}

.plan-card strong {
  color: var(--primary);
  font-size: 24px;
  font-weight: 950;
}

.plan-card p {
  min-height: 36px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 700;
}

.qr-card {
  margin-top: 14px;
  padding: 16px;
  text-align: center;
}

.qr-card h2 {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 950;
}

.qr-card p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.qr-grid {
  --cell: 9px;
  display: grid;
  grid-template-columns: repeat(17, var(--cell));
  grid-template-rows: repeat(17, var(--cell));
  gap: 2px;
  width: max-content;
  margin: 0 auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
}

.qr-grid span {
  width: var(--cell);
  height: var(--cell);
  border-radius: 2px;
  background: #f1e2ea;
}

.qr-grid span.is-dark {
  background: var(--ink);
}

.points-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  margin-bottom: 14px;
}

.points-card span {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  color: var(--primary);
  background: var(--surface-soft);
  font-size: 24px;
  font-weight: 950;
}

.points-card strong {
  display: block;
  font-size: 27px;
  font-weight: 950;
}

.points-card p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.gift-form {
  padding: 14px;
}

.gift-form h2 {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 950;
}

.amount-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.amount-grid button {
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
}

.hidden-input {
  display: none;
  width: 100%;
  min-height: 46px;
  margin: 10px 0;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  color: var(--ink);
  background: var(--bg);
  font-weight: 800;
}

.hidden-input.is-visible {
  display: block;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  color: #fff;
  background: var(--ink);
}

.avatar {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: 8px;
  background: var(--primary);
  font-weight: 950;
}

.profile-card h1 {
  margin: 0;
  font-size: 21px;
  font-weight: 950;
}

.profile-card p {
  margin: 3px 0 5px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  font-weight: 700;
}

.profile-card span {
  color: #ffe08c;
  font-size: 12px;
  font-weight: 950;
}

.settings-row,
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 58px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  text-align: left;
  font-weight: 950;
}

.settings-row span,
.toggle-row span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.toggle-row input {
  accent-color: var(--primary);
  width: 42px;
  height: 24px;
}

.detail-visual {
  min-height: 210px;
  margin-bottom: 12px;
  border-radius: 8px;
}

.detail-visual h1 {
  margin: 6px 0 4px;
  font-size: 30px;
  line-height: 1.07;
  font-weight: 950;
}

.detail-visual p {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
  font-weight: 750;
}

.photo-strip {
  display: flex;
  gap: 8px;
  margin: 0 -16px 18px;
  padding: 0 16px;
  overflow-x: auto;
}

.photo-strip span {
  display: grid;
  place-items: center;
  width: 132px;
  min-height: 64px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  font-weight: 850;
  text-align: center;
}

.info-grid {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.info-row {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.info-row small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.info-row strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
  font-weight: 900;
}

.badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--primary);
  background: #fff;
  font-size: 12px;
  font-weight: 950;
}

.status-active {
  color: var(--green);
}

.status-used {
  color: var(--muted);
}

.empty-state {
  padding: 22px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: center;
}

.empty-state h2 {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 950;
}

.empty-state p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  font-weight: 650;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 25;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  width: min(100vw, 440px);
  transform: translateX(-50%);
  padding: 8px 8px max(8px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 248, 252, 0.96);
}

.bottom-nav button {
  display: grid;
  place-items: center;
  gap: 2px;
  min-height: 60px;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 10px;
  font-weight: 900;
}

.bottom-nav button span {
  font-size: 18px;
  line-height: 1;
}

.bottom-nav button.is-active {
  color: var(--primary);
  background: var(--surface-soft);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 92px;
  z-index: 40;
  width: min(calc(100vw - 32px), 408px);
  transform: translate(-50%, 18px);
  opacity: 0;
  pointer-events: none;
  padding: 12px 14px;
  border-radius: 8px;
  color: #fff;
  background: var(--ink);
  font-size: 13px;
  font-weight: 800;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.tone-rose,
.visual-rose {
  background: var(--surface-soft);
}

.tone-amber,
.visual-amber {
  background: var(--amber-soft);
}

.tone-teal,
.visual-teal {
  background: var(--teal-soft);
}

.tone-blue,
.visual-blue {
  background: var(--blue-soft);
}

.tone-green,
.visual-green {
  background: var(--green-soft);
}

.tone-violet,
.visual-violet {
  background: var(--violet-soft);
}

@media (max-width: 360px) {
  .hero-panel h1,
  .pass-hero h1,
  .screen-heading h1 {
    font-size: 24px;
  }

  .quick-actions {
    grid-template-columns: 1fr;
  }

  .plan-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 760px) {
  body {
    padding: 20px 0;
  }

  .app-shell {
    min-height: calc(100vh - 40px);
    border: 1px solid var(--line);
    border-radius: 18px;
  }

  .bottom-nav {
    bottom: 20px;
    border: 1px solid var(--line);
    border-radius: 0 0 18px 18px;
  }
}
