/* TipCorner - public tipping app. Mobile first, no framework. */

:root {
  --brand:        #14a05c;
  --brand-dark:   #0e7c46;
  --brand-soft:   #e9f6ef;
  --brand-tint:   #f2faf6;

  --ink:          #16293b;
  --ink-soft:     #475769;
  --ink-muted:    #7c8ba0;

  --line:         #e4e9ef;
  --line-strong:  #d3dbe4;
  --bg:           #ffffff;
  --surface:      #f7f9fb;

  --radius-sm:  10px;
  --radius:     14px;
  --radius-lg:  18px;

  --shadow-sm: 0 1px 2px rgba(19, 41, 60, .06);
  --shadow-md: 0 8px 24px rgba(19, 41, 60, .08);

  --pad: 22px;
  --tap: 52px;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body { overscroll-behavior-y: none; }

.sprite { display: none; }

.icon {
  width: 24px;
  height: 24px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon--sm { width: 16px; height: 16px; }

/* ---------- Shell ---------- */

.app {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 460px;
  margin: 0 auto;
  background: var(--bg);
  padding-bottom: env(safe-area-inset-bottom);
}

@media (min-width: 500px) {
  .app {
    min-height: min(880px, 100dvh);
    margin-block: 24px;
    border: 1px solid var(--line);
    border-radius: 28px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
  }
}

.appbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px var(--pad);
  border-bottom: 1px solid var(--line);
  padding-top: calc(14px + env(safe-area-inset-top));
}

.appbar__title {
  flex: 1;
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  color: var(--ink);
}
.appbar__title:empty { flex: 1; }

.brand { display: flex; align-items: center; }
.brand .logo { height: 22px; width: auto; display: block; }
.brand--lg .logo { height: 34px; }

.appbar__back,
.appbar__menu {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin: -6px 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--ink);
  cursor: pointer;
}
.appbar__back:active,
.appbar__menu:active { background: var(--surface); }
.appbar__back[hidden] { display: none; }
.appbar__menu { margin-left: auto; color: var(--ink-soft); }

/* ---------- Screens ---------- */

.screen {
  display: none;
  flex: 1;
  flex-direction: column;
  padding: 26px var(--pad) calc(22px + env(safe-area-inset-bottom));
  animation: screen-in .22s ease both;
}
.screen.is-active { display: flex; }
.screen--center { align-items: center; text-align: center; justify-content: center; }

@keyframes screen-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .screen { animation: none; }
}

.screen__title {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -.02em;
  text-align: center;
}
.screen__subtitle {
  margin: 0 0 20px;
  font-size: 14px;
  color: var(--ink-muted);
  text-align: center;
}
.screen__title--left,
.screen__subtitle--left { text-align: left; }

/* ---------- Barre de contexte ---------- */

.ctxbar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px var(--pad);
  background: var(--brand-tint);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.ctxbar[hidden] { display: none; }
.ctxbar__dot {
  width: 5px;
  height: 5px;
  flex: none;
  border-radius: 50%;
  background: var(--brand);
}
.ctxbar__merchant { font-weight: 650; }
.ctxbar__staff { color: var(--ink-muted); }
.ctxbar__staff:empty { display: none; }
.ctxbar__amount {
  margin-left: auto;
  font-weight: 700;
  color: var(--brand-dark);
}
.screen__footer { margin-top: auto; padding-top: 24px; }

.section-label {
  margin: 22px 0 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-muted);
}

/* ---------- 1. Accueil ---------- */

.merchant { text-align: center; }

/* The single call to action of the whole app: one big coin button. */
.hero {
  position: relative;
  display: grid;
  place-items: center;
  width: 172px;
  height: 172px;
  margin-top: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(20, 160, 92, .3);
  transition: transform .15s, background .15s;
}
.hero:hover { background: var(--brand-dark); }
.hero:active { transform: scale(.97); }

.hero__icon { width: 72px; height: 72px; stroke-width: 1.4; }

.hero__halo {
  position: absolute;
  inset: -16px;
  border: 2px solid var(--brand);
  border-radius: 50%;
  animation: halo 2.8s ease-out infinite;
}
@keyframes halo {
  0%   { transform: scale(.9);  opacity: .5; }
  70%  { transform: scale(1.12); opacity: 0; }
  100% { transform: scale(1.12); opacity: 0; }
}

.hero__caption {
  margin: 20px 0 0;
  font-size: 17px;
  font-weight: 650;
}
.hero__hint {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--ink-muted);
}

@media (prefers-reduced-motion: reduce) {
  .hero__halo { animation: none; opacity: .3; }
}

.merchant__icon {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-dark);
}
.merchant__icon .icon { width: 34px; height: 34px; stroke-width: 1.7; }

.merchant__name {
  margin: 0;
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -.03em;
}
.merchant__tagline {
  margin: 6px 0 12px;
  font-size: 15px;
  color: var(--ink-soft);
}
.icon--heart {
  width: 20px;
  height: 20px;
  color: var(--brand);
  fill: currentColor;
  stroke: none;
}

/* ---------- 3. Montants : lignes pleine largeur ---------- */

.amount-list { display: flex; flex-direction: column; gap: 10px; }

.amt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 58px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
  font-family: inherit;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.amt:active { transform: scale(.99); }
.amt.is-selected {
  border-color: var(--brand);
  background: var(--brand-tint);
  color: var(--brand-dark);
}
.amt__value { font-size: 18px; font-weight: 650; }
.amt__hint { font-size: 12px; color: var(--ink-muted); }
.amt.is-selected .amt__hint { color: var(--brand-dark); }

.note-toggle {
  align-self: flex-start;
  margin-top: 16px;
  padding: 6px 0;
  border: 0;
  background: none;
  color: var(--brand-dark);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.note-toggle[hidden] { display: none; }

/* ---------- 2. Staff : lignes à filets ---------- */

.staff-list { display: flex; flex-direction: column; }

.staff {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  min-height: 62px;
  padding: 11px 2px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.staff:first-child { border-top: 1px solid var(--line); }

.staff__avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 16px;
  font-weight: 650;
}
.staff__avatar .icon { width: 20px; height: 20px; }

.staff__name { display: block; font-size: 16px; font-weight: 600; color: var(--ink); }
.staff__role { display: block; font-size: 13px; color: var(--ink-muted); }

.staff__radio {
  margin-left: auto;
  width: 21px;
  height: 21px;
  flex: none;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  transition: border-width .12s, border-color .12s;
}
.staff.is-selected .staff__radio {
  border: 6.5px solid var(--brand);
}
.staff.is-selected .staff__name { color: var(--brand-dark); }

/* ---------- 3. Amount ---------- */

.amount {
  display: block;
  margin: 14px 0 22px;
  font-size: 46px;
  font-weight: 700;
  letter-spacing: -.035em;
  color: var(--brand-dark);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.slider__input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  margin: 0;
  border-radius: 999px;
  background: linear-gradient(var(--brand), var(--brand)) 0 / var(--fill, 50%) 100% no-repeat, var(--line);
  cursor: pointer;
}
.slider__input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 26px;
  height: 26px;
  border: 3px solid var(--brand);
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.slider__input::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border: 3px solid var(--brand);
  border-radius: 50%;
  background: #fff;
}
.slider__bounds {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12px;
  color: var(--ink-muted);
}

.field { display: block; position: relative; margin-top: 22px; }
.field__input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
  font-family: inherit;
  font-size: 15px;
  resize: none;
}
.field__input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.field__counter {
  position: absolute;
  right: 12px;
  bottom: 8px;
  font-size: 11px;
  color: var(--ink-muted);
}

/* ---------- 4. Payment ---------- */

/* The context bar already carries merchant, beneficiary and amount, so the
   payment screen has room for larger targets. */
.pay-methods { display: flex; flex-direction: column; gap: 10px; }

.pay {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 60px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .12s, opacity .15s;
}
.pay:active { transform: scale(.99); }
.pay[disabled] { opacity: .55; cursor: progress; }
.pay--apple { border-color: #000; background: #000; color: #fff; }

/* Official-looking marks: one SVG per method, drawn at a fixed height so the
   three buttons keep the same optical weight. */
.pay__mark { height: 24px; width: auto; flex: none; }
.pay--card .pay__mark { width: 22px; height: 22px; }
.pay__label:empty { display: none; }
.pay.is-busy .pay__mark,
.pay.is-busy .pay__text { display: none; }

.secure {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 16px 0 0;
  font-size: 13px;
  color: var(--ink-muted);
}
.demo-badge {
  margin: 10px 0 0;
  font-size: 12px;
  text-align: center;
  color: var(--ink-muted);
}

/* ---------- 5. Success ---------- */

.success__mark {
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  animation: pop .4s cubic-bezier(.2, .9, .3, 1.4) both;
}
.success__mark .icon { width: 46px; height: 46px; stroke-width: 2.4; }

@keyframes pop {
  from { transform: scale(.5); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .success__mark { animation: none; }
}

.success__title {
  margin: 22px 0 4px;
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -.02em;
}
.success__text { margin: 0; font-size: 15px; color: var(--ink-soft); }
.success__amount {
  margin: 14px 0 4px;
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -.03em;
  color: var(--brand-dark);
}

.powered { margin: 22px 0 0; font-size: 13px; color: var(--ink-muted); }
.powered strong { color: var(--ink); }

/* ---------- Buttons ---------- */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--tap);
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 16px;
  font-weight: 650;
  cursor: pointer;
  transition: background .15s, transform .12s;
}
.btn:active { transform: scale(.99); }
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-dark); }
.btn--primary[disabled] { background: var(--line-strong); color: #fff; cursor: not-allowed; }
.btn--ghost {
  margin-top: 26px;
  border-color: var(--line-strong);
  background: var(--bg);
  color: var(--ink);
}

/* ---------- Menu sheet ---------- */

.sheet { position: fixed; inset: 0; z-index: 20; }
.sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(19, 41, 60, .45);
  animation: fade .2s ease both;
}
.sheet__panel {
  position: absolute;
  inset: auto 0 0;
  max-width: 460px;
  margin: 0 auto;
  padding: 24px var(--pad) calc(28px + env(safe-area-inset-bottom));
  border-radius: 22px 22px 0 0;
  background: var(--bg);
  animation: slide-up .24s cubic-bezier(.2, .8, .3, 1) both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-up { from { transform: translateY(100%); } to { transform: none; } }

.sheet__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
}
.sheet__title { margin: 0 0 16px; font-size: 17px; font-weight: 700; }
.sheet__list { margin: 0; padding: 0; list-style: none; }
.sheet__list li {
  padding: 12px 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.sheet__list strong { display: block; margin-bottom: 2px; font-size: 15px; }
.sheet__list span { color: var(--ink-muted); }
.sheet__link {
  display: block;
  margin-top: 18px;
  padding: 13px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(26px + env(safe-area-inset-bottom));
  z-index: 30;
  transform: translateX(-50%);
  max-width: 88vw;
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  box-shadow: var(--shadow-md);
  animation: fade .2s ease both;
}

/* ---------- Not found ---------- */

.app--message {
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px var(--pad);
  gap: 10px;
}
.message__title { margin: 24px 0 0; font-size: 22px; font-weight: 700; }
.message__text { margin: 0; max-width: 30ch; color: var(--ink-muted); font-size: 15px; }
