/* ---------------------------------------------------------------- fonts (Sofia Sans, OFL) */
@font-face {
  font-family: 'Sofia Sans';
  src: url('/fonts/sofia-sans-cyrillic.woff2') format('woff2');
  font-weight: 1 1000;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Sofia Sans';
  src: url('/fonts/sofia-sans-latin.woff2') format('woff2');
  font-weight: 1 1000;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Sofia Sans XC';
  src: url('/fonts/sofia-sans-xc-cyrillic.woff2') format('woff2');
  font-weight: 1 1000;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Sofia Sans XC';
  src: url('/fonts/sofia-sans-xc-latin.woff2') format('woff2');
  font-weight: 1 1000;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------------------------------------------------------------- tokens (overridden per level by JS) */
:root {
  --bg: #191716;
  --bg2: #221f1d;
  --surface: #2a2624;
  --surface2: #332e2b;
  --ink: #f2ece6;
  --muted: #a39a92;
  --line: rgba(242, 236, 230, 0.12);
  --accent: #e8d9c5;
  --accent-ink: #191716;
  --ember-core: #ffe1a6;
  --ember: #ff8a3d;
  --ember-deep: #a8360a;
  --glow: 255, 138, 61;
  --coal: #2c2724;
  --coal-edge: #3b3531;
  --danger: #ff6b5e;
  --ok: #7bd88f;

  --font: 'Sofia Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Sofia Sans XC', 'Sofia Sans', system-ui, sans-serif;
  --gutter: 20px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 66px;
  --grain-o: 0.7;
  --grain-dark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72'%3E%3Cfilter id='f' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.95' numOctaves='2' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 10 -6.25'/%3E%3C/filter%3E%3Crect width='72' height='72' filter='url(%23f)'/%3E%3C/svg%3E");
  --grain-light: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96'%3E%3Cfilter id='f' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' seed='19' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 5 -3.35'/%3E%3C/filter%3E%3Crect width='96' height='96' filter='url(%23f)'/%3E%3C/svg%3E");
  --grain-ash: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='f' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.045 0.06' numOctaves='3' seed='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 0.97  0 0 0 0 0.93  0 0 0 3.4 -1.95'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23f)'/%3E%3C/svg%3E");
  color-scheme: dark;
}
:root[data-theme='fog'] {
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font: 400 16px/1.45 var(--font);
  color: var(--ink);
  background: radial-gradient(130% 55% at 100% 0%, var(--bg2) 0%, transparent 62%) no-repeat, var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}
[tabindex='-1']:focus {
  outline: none;
}

.boot {
  min-height: 100vh;
}

/* ---------------------------------------------------------------- layout */
.screen {
  max-width: 520px;
  margin: 0 auto;
  padding: 18px var(--gutter) calc(36px + var(--safe-b));
}
.has-tabs .screen {
  padding-bottom: calc(var(--tabbar-h) + 36px + var(--safe-b));
}

/* ---------------------------------------------------------------- type */
.brand {
  margin: 0;
  font: 600 14px/1.2 var(--font);
  color: var(--muted);
  letter-spacing: 0.01em;
}
.display {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.005em;
}
.display--xl {
  margin-top: 14px;
  font-size: clamp(46px, 13.5vw, 62px);
}
.display--l {
  margin-top: 6px;
  font-size: clamp(36px, 10.5vw, 46px);
  overflow-wrap: anywhere;
}
.lead {
  margin: 14px 0 0;
  font-size: 18px;
  line-height: 1.4;
  max-width: 38ch;
}
.lead--muted {
  color: var(--muted);
  font-size: 16px;
}
.muted {
  margin: 4px 0 0;
  color: var(--muted);
}
.fineprint {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 13.5px;
  max-width: 42ch;
}
.section-title {
  margin: 0 0 8px;
  font: 700 22px/1.1 var(--font-display);
}
.link {
  color: var(--accent);
  font-weight: 600;
  text-underline-offset: 3px;
}

/* ---------------------------------------------------------------- guest card */
.screen--card,
.screen--onboard,
.screen--promo {
  position: relative;
  isolation: isolate;
}
.name {
  margin: 20px 0 0;
  display: flex;
  flex-direction: column;
}
/* JS (fitName) sizes these: the surname takes ~75% of the screen width, the first name 80% of its size. */
.name__last {
  align-self: flex-start;
  font: 800 64px / 0.88 var(--font-display);
  letter-spacing: -0.012em;
  white-space: nowrap;
}
.name__first {
  align-self: flex-start;
  margin-top: 0.06em;
  font: 500 50px / 0.95 var(--font-display);
  opacity: 0.82;
  white-space: nowrap;
}
.sheet__last {
  white-space: nowrap;
}
.name__last.is-wrapped,
.name__first.is-wrapped,
.sheet__last.is-wrapped,
.sheet__first.is-wrapped {
  white-space: normal;
  overflow-wrap: anywhere;
}

/* seasonal decoration in the top corner */
.motif {
  position: absolute;
  top: 0;
  right: 0;
  z-index: -1;
  width: min(100%, 390px);
  height: auto;
  color: var(--accent);
  opacity: 0.2;
  pointer-events: none;
}
.preview .motif {
  opacity: 0.18;
}

.level {
  margin-top: 22px;
  min-height: 60px;
}
.level__title {
  margin: 0;
  font: 700 27px/1.05 var(--font-display);
  color: var(--accent);
}
.level__text {
  margin: 6px 0 0;
  color: var(--muted);
  max-width: 36ch;
}
.gifts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.gift {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 4px 14px;
  border-radius: 999px;
  font-weight: 650;
  font-size: 15px;
  color: var(--ink);
  text-decoration: none;
  background: rgba(var(--glow), 0.16);
  box-shadow: inset 0 0 0 1px rgba(var(--glow), 0.45);
}

.card-links {
  margin-top: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
}
.link--quiet {
  color: var(--muted);
}

/* ---------------------------------------------------------------- coals (the stamps) */
.coals-wrap {
  margin-top: 26px;
}
.screen--onboard .coals {
  margin-top: 28px;
}
.coals {
  display: grid;
  grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr));
  gap: 18px 14px;
}
.coals--compact {
  gap: 10px 8px;
  margin-top: 4px;
}
.coal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.coal__cube {
  position: relative;
  width: 100%;
  max-width: 96px;
  aspect-ratio: 1;
  border-radius: 24%;
  background:
    radial-gradient(70% 60% at 28% 22%, rgba(255, 255, 255, 0.07), transparent 70%),
    linear-gradient(155deg, var(--coal-edge), var(--coal) 72%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 -10px 18px rgba(0, 0, 0, 0.28),
    0 10px 18px -10px rgba(0, 0, 0, 0.7);
}
/* porous coconut-coal texture: irregular grain, not a grid */
.coal__cube::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image: var(--grain-dark), var(--grain-light);
  background-size: 72px 72px, 96px 96px;
  background-position: 0 0, 13px 29px;
  opacity: var(--grain-o);
}
.coal.has-marker .coal__cube {
  box-shadow:
    inset 0 0 0 1.5px rgba(var(--glow), 0.35),
    inset 0 -10px 18px rgba(0, 0, 0, 0.28),
    0 10px 18px -10px rgba(0, 0, 0, 0.7);
}

/* a lit coal; --heat (0..1) cools down as the expiry date approaches */
.coal.is-lit .coal__cube {
  background:
    radial-gradient(120% 90% at 30% 18%, rgba(255, 248, 235, 0.32), transparent 42%),
    radial-gradient(62% 58% at 50% 54%, var(--ember-core) 0%, var(--ember) 46%, var(--ember-deep) 82%, #2a0d04 118%);
  box-shadow:
    0 0 calc(8px + 24px * var(--heat)) calc(-3px + 4px * var(--heat)) rgba(var(--glow), calc(0.22 + 0.5 * var(--heat))),
    inset 0 0 0 1px rgba(255, 255, 255, 0.1),
    inset 0 -9px 16px rgba(60, 12, 0, 0.35);
  filter: saturate(calc(0.5 + 0.5 * var(--heat))) brightness(calc(0.68 + 0.32 * var(--heat)));
}
.coal.is-lit .coal__cube::before {
  background-image: var(--grain-dark), var(--grain-ash), var(--grain-light);
  background-size: 72px 72px, 120px 120px, 96px 96px;
  background-position: calc(var(--i) * 17px) calc(var(--i) * 11px), calc(var(--i) * -23px) calc(var(--i) * 31px), 5px 9px;
  opacity: calc(var(--grain-o) - 0.08);
}

.coal__label {
  max-width: 100%;
  min-height: 1.15em;
  font: 650 13.5px/1.15 var(--font);
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.coal__label--gift {
  color: var(--muted);
  font-weight: 600;
}
.coals--compact .coal__cube {
  max-width: 54px;
  border-radius: 22%;
}
.coals--compact .coal__label {
  font-size: 11.5px;
}

.coals.is-igniting .coal.is-lit .coal__cube {
  animation: ignite 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  animation-delay: calc(var(--i) * 110ms + 150ms);
}
@keyframes ignite {
  from {
    filter: brightness(0.25) saturate(0.2);
    transform: scale(0.94);
  }
  60% {
    filter: brightness(1.3) saturate(1.1);
    transform: scale(1.03);
  }
}
.coal.is-new .coal__cube {
  animation: flare 1.2s cubic-bezier(0.16, 0.84, 0.3, 1) both;
}
.coal.is-new .coal__cube::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 30%;
  border: 2px solid rgba(var(--glow), 0.85);
  animation: ring-out 1.2s ease-out forwards;
}
@keyframes flare {
  0% {
    transform: scale(0.55);
    filter: brightness(2.2) saturate(1.2);
  }
  45% {
    transform: scale(1.12);
  }
  100% {
    transform: scale(1);
  }
}
@keyframes ring-out {
  from {
    opacity: 1;
    transform: scale(0.8);
  }
  to {
    opacity: 0;
    transform: scale(1.5);
  }
}

/* ---------------------------------------------------------------- seals (second stamp look) */
.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
.seal-box {
  position: relative;
  width: 100%;
  max-width: 96px;
  aspect-ratio: 1;
}
.coals--compact .seal-box {
  max-width: 56px;
}
.seal,
.seal-empty {
  display: block;
  width: 100%;
  height: 100%;
}
.seal {
  color: var(--ember);
  opacity: calc(0.38 + 0.62 * var(--heat));
  transform: rotate(var(--rot, 0deg));
}
.seal__text {
  font-family: var(--font-display);
  letter-spacing: 0.4px;
}
.seal-empty {
  color: var(--muted);
  opacity: 0.42;
}
.seal-empty--gift {
  color: rgb(var(--glow));
  opacity: 0.6;
}
.coals--seal.is-igniting .coal.is-lit .seal {
  animation: press-in 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: calc(var(--i) * 110ms + 150ms);
}
.coals--seal .coal.is-new .seal {
  animation: press-in 0.9s cubic-bezier(0.16, 0.84, 0.3, 1) both;
}
@keyframes press-in {
  0% {
    opacity: 0;
    transform: rotate(calc(var(--rot, 0deg) - 14deg)) scale(1.45);
  }
  55% {
    opacity: 1;
    transform: rotate(var(--rot, 0deg)) scale(0.93);
  }
  100% {
    transform: rotate(var(--rot, 0deg)) scale(1);
  }
}

/* ---------------------------------------------------------------- personal QR */
.pass {
  margin-top: 30px;
  display: grid;
  grid-template-columns: minmax(132px, 44%) 1fr;
  gap: 16px;
  align-items: center;
  padding: 14px;
  border-radius: 24px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}
.pass__qr {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  padding: 8px;
  border: 0;
  border-radius: 16px;
  background: #fff;
  cursor: zoom-in;
}
.pass__qr .spinner {
  margin: 34% auto;
  border-color: #ddd;
  border-top-color: #222;
}
.qr-svg {
  display: block;
  width: 100%;
  height: 100%;
}
.pass__side {
  min-width: 0;
}
.pass__label {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}
.pass__code {
  margin: 4px 0 0;
  font: 700 clamp(28px, 8.6vw, 36px) / 1 var(--font-display);
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pass__hint {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
}
.ring {
  flex: none;
  width: 18px;
  height: 18px;
  transform: rotate(-90deg);
}
.ring__track {
  fill: none;
  stroke: var(--line);
  stroke-width: 2.5;
}
.ring__arc {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s linear;
}

.qr-full {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  background: #fff;
  color: #000;
  animation: fade-in 0.18s ease-out;
}
.qr-full__plate {
  width: min(86vw, 420px);
  aspect-ratio: 1;
}
.qr-full__code {
  margin: 0;
  font: 700 46px/1 var(--font-display);
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}
.qr-full__hint {
  margin: 0;
  color: #4a4a4a;
  font-size: 15px;
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
}

/* ---------------------------------------------------------------- controls */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 20px;
  border: 0;
  border-radius: 16px;
  font: 650 17px/1.15 var(--font);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease;
}
.btn:active {
  transform: scale(0.98);
}
.btn:disabled {
  opacity: 0.55;
  cursor: default;
}
.btn[aria-busy='true'] {
  opacity: 0.7;
}
.btn--block {
  display: flex;
  width: 100%;
}
.btn--xl {
  min-height: 62px;
  font-size: 19px;
  border-radius: 18px;
}
.btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
}
.btn--secondary {
  background: var(--surface2);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}
.btn--ghost {
  min-height: 40px;
  padding: 8px 10px;
  background: transparent;
  color: var(--accent);
  font-size: 15.5px;
}
.btn--ember {
  background: linear-gradient(180deg, var(--ember) 0%, var(--ember-deep) 150%);
  color: #1b0d05;
  box-shadow:
    0 12px 28px -14px rgba(var(--glow), 0.95),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.btn--gift {
  min-height: 54px;
  background: rgba(var(--glow), 0.14);
  color: var(--ink);
  box-shadow: inset 0 0 0 1.5px rgba(var(--glow), 0.6);
}
.btn--danger {
  background: var(--danger);
  color: #1a0806;
}
.btn--danger-text {
  color: var(--danger);
}

.form {
  display: grid;
  gap: 14px;
  margin-top: 26px;
}
.form .btn {
  margin-top: 6px;
}
.field {
  display: grid;
  gap: 6px;
  margin-top: 14px;
}
.form .field {
  margin-top: 0;
}
.field__label {
  margin: 0;
  font-weight: 600;
  font-size: 15px;
}
.field__hint {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.35;
}
.field__error {
  margin: 0;
  color: var(--danger);
  font-size: 14px;
}
.field__error:empty {
  display: none;
}
.input {
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  border: 0;
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  font: 500 18px/1.2 var(--font);
  box-shadow: inset 0 0 0 1px var(--line);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.input::placeholder {
  color: var(--muted);
  opacity: 0.7;
}
.input:focus {
  box-shadow: inset 0 0 0 2px var(--accent);
}
.input[aria-invalid='true'] {
  box-shadow: inset 0 0 0 2px var(--danger);
}
.input--area {
  min-height: 92px;
  resize: vertical;
  font-size: 16px;
  line-height: 1.4;
}
.input--select {
  padding-right: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a39a92' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 18px;
  font-size: 16px;
}
.input--code {
  font: 700 26px/1 var(--font-display);
  letter-spacing: 0.12em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.input--search {
  padding-left: 46px;
}
input[type='date'].input {
  font-size: 17px;
}

.switch__row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 16px 0 4px;
  cursor: pointer;
}
.switch__text {
  display: grid;
  gap: 4px;
}
.switch__label {
  font-weight: 600;
}
.switch__input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.switch__track {
  position: relative;
  width: 52px;
  height: 32px;
  border-radius: 999px;
  background: var(--surface2);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: background-color 0.2s ease;
}
.switch__track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--ink);
  transition: transform 0.2s ease;
}
.switch__input:checked + .switch__track {
  background: var(--accent);
}
.switch__input:checked + .switch__track::after {
  transform: translateX(20px);
  background: var(--accent-ink);
}
.switch__input:focus-visible + .switch__track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.actions {
  margin-top: 30px;
  display: grid;
  gap: 10px;
}
.status {
  margin: 0;
  min-height: 1.4em;
  color: var(--muted);
}
.notice {
  margin: 18px 0 0;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--surface);
}
.notice p {
  margin: 0;
}
.notice--error {
  display: grid;
  gap: 12px;
}
.inline-form {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}
.inline-form .field {
  margin-top: 0;
}
.inline-form > .btn {
  justify-self: start;
}
.inline-form > .btn--block {
  justify-self: stretch;
}
.btn-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.spinner {
  width: 28px;
  height: 28px;
  margin: 26px auto;
  border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.icon {
  width: 22px;
  height: 22px;
  flex: none;
}
.icon--lg {
  width: 26px;
  height: 26px;
}

/* ---------------------------------------------------------------- lists */
.list {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}
.list > li + li,
.list > .row + .row {
  border-top: 1px solid var(--line);
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 12px 2px;
  color: inherit;
  text-decoration: none;
}
.row--static {
  min-height: 48px;
}
.row__main {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}
.row__title {
  font-size: 17px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row__sub {
  color: var(--muted);
  font-size: 14px;
}
.row__meta {
  flex: none;
  color: var(--muted);
  font-size: 14px;
}
.row__time {
  flex: none;
  width: 46px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.row__chev {
  width: 18px;
  height: 18px;
  color: var(--muted);
}
.row__actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 6px;
  margin-left: -10px;
}
.row__actions .inline-form {
  width: 100%;
  margin-left: 10px;
}
.empty {
  padding: 18px 0;
  color: var(--muted);
}
.more {
  margin-top: 14px;
}

.dots {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 3px;
}
.dots i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--coal-edge);
}
.dots i.on {
  background: var(--ember);
  box-shadow: 0 0 6px rgba(var(--glow), 0.6);
}

.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface2);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 650;
  white-space: nowrap;
}
.chip--active {
  background: rgba(var(--glow), 0.16);
  color: var(--ink);
}
.chip--used {
  background: rgba(123, 216, 143, 0.14);
  color: #bfefc9;
}
.chip--revoked {
  background: rgba(255, 107, 94, 0.13);
  color: #ffb3ab;
}
.chip--role-owner {
  background: var(--accent);
  color: var(--accent-ink);
}
.chip--role-admin {
  background: rgba(var(--glow), 0.2);
  color: var(--ink);
}
.chip--role-hookah {
  background: var(--surface2);
  color: var(--ink);
}

.stamp-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 4px 12px;
  padding: 14px 0;
}
.stamp-row__main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.stamp-row__title {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.stamp-row__sub {
  color: var(--muted);
  font-size: 14px;
}
.stamp-row__note {
  font-size: 14px;
  opacity: 0.85;
}
.stamp-row--revoked .stamp-row__title,
.stamp-row--expired .stamp-row__title {
  opacity: 0.6;
}

.search {
  position: relative;
  margin-top: 18px;
}
.search__icon {
  position: absolute;
  top: 50%;
  left: 14px;
  width: 20px;
  height: 20px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.kv {
  display: grid;
  gap: 4px;
}
.kv__k {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}
.kv__v {
  margin: 0;
  font-weight: 650;
}
.block {
  margin-top: 28px;
}

.log-row {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 10px;
  padding: 12px 0;
}
.log-row__time {
  color: var(--muted);
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}
.log-row__main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.log-row__title {
  font-weight: 600;
}
.log-row__sub {
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
}
a.log-row__sub {
  color: var(--accent);
}

/* ---------------------------------------------------------------- staff */
.scan-cta {
  margin-top: 22px;
}
.code-row {
  display: grid;
  gap: 8px;
  margin-top: 20px;
}
.code-row__controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}
.scan-result {
  margin-top: 24px;
}
.scan-result:empty {
  display: none;
}
.sheet {
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: 24px;
  background: radial-gradient(120% 80% at 100% 0%, var(--bg2), transparent 62%), var(--bg);
  color: var(--ink);
  box-shadow:
    inset 0 0 0 1px var(--line),
    0 20px 40px -24px rgba(0, 0, 0, 0.8);
  animation: fade-in 0.2s ease-out;
}
.sheet__name {
  display: flex;
  flex-direction: column;
  margin: 0;
}
.sheet__last {
  font: 800 38px/0.92 var(--font-display);
  overflow-wrap: anywhere;
}
.sheet__first {
  margin-top: 2px;
  font: 500 24px/1.05 var(--font-display);
  opacity: 0.8;
}
.sheet__phone {
  margin: -4px 0 0;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.sheet__level {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
}
.sheet__count {
  font: 800 30px/1 var(--font-display);
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.sheet__of {
  margin-left: 6px;
  font: 600 16px/1 var(--font);
  color: var(--muted);
}
.sheet__title {
  font-weight: 650;
}
.sheet__gifts {
  display: grid;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.sheet__gifts-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-weight: 650;
}
.gift-actions {
  display: grid;
  gap: 14px;
}
.state {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  color: var(--muted);
}
.state--done {
  color: var(--ink);
}
.state .icon {
  width: 20px;
  height: 20px;
  margin-top: 1px;
  color: var(--ok);
}
.today {
  margin-top: 32px;
}
.today .list {
  margin-top: 8px;
}

/* ---------------------------------------------------------------- admin */
.stats {
  margin-top: 18px;
}
.stats__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--surface);
}
.stat__n {
  font: 800 34px/1 var(--font-display);
  font-variant-numeric: tabular-nums;
}
.stat__label {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.25;
}
.dist {
  display: grid;
  gap: 6px;
  margin-top: 24px;
}
.dist__row {
  display: grid;
  grid-template-columns: 22px 1fr 40px;
  align-items: center;
  gap: 10px;
  font-variant-numeric: tabular-nums;
}
.dist__k {
  color: var(--muted);
  font-weight: 650;
}
.dist__bar {
  height: 10px;
  overflow: hidden;
  border-radius: 6px;
  background: var(--surface);
}
.dist__bar i {
  display: block;
  height: 100%;
  min-width: 2px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--ember-deep), var(--ember));
}
.dist__n {
  text-align: right;
}
.table__head,
.table__row {
  display: grid;
  grid-template-columns: 1fr 72px 56px;
  gap: 8px;
  padding: 10px 0;
  font-variant-numeric: tabular-nums;
}
.table__head {
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
}
.table__row {
  border-top: 1px solid var(--line);
}
.table__head span:not(:first-child),
.table__row span:not(:first-child) {
  text-align: right;
}

.level-picker {
  display: flex;
  gap: 8px;
  margin: 18px -2px 0;
  padding: 4px 2px 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.level-chip {
  flex: 1 0 40px;
  max-width: 56px;
  height: 48px;
  border: 0;
  border-radius: 14px;
  background: var(--chip-bg, var(--surface));
  color: #fff;
  font: 800 20px/1 var(--font-display);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.12),
    inset 0 -4px 0 var(--chip-accent, var(--ember));
  cursor: pointer;
}
.level-chip.is-on {
  box-shadow:
    inset 0 0 0 2px var(--chip-accent, var(--ember)),
    0 0 0 3px rgba(255, 255, 255, 0.14);
}
.level-caption {
  margin: 2px 0 10px;
}
.preview {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 18px;
  border-radius: 24px;
  background: radial-gradient(120% 80% at 100% 0%, var(--bg2), transparent 62%), var(--bg);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}
.preview .level {
  margin-top: 14px;
  min-height: 0;
}
.preview .coals {
  margin-top: 16px;
}
.name--preview {
  margin-top: 12px;
}

.swatches {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 11px 4px 10px;
  border: 0;
  border-radius: 14px;
  background: var(--sw-bg);
  color: var(--sw-ink);
  font: 600 13px/1 var(--font);
  box-shadow: inset 0 0 0 1px rgba(127, 127, 127, 0.28);
  cursor: pointer;
}
.swatch.is-on {
  box-shadow: inset 0 0 0 2.5px var(--sw-ember);
}
.swatch__dot {
  width: 22px;
  height: 22px;
  border-radius: 28%;
  background: radial-gradient(circle at 50% 55%, rgba(255, 255, 255, 0.55) 0, var(--sw-ember) 50%);
  box-shadow: 0 0 12px var(--sw-ember);
}
.sticky-save {
  position: sticky;
  bottom: calc(var(--tabbar-h) + 14px + var(--safe-b));
  z-index: 5;
  margin-top: 22px;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.8);
}

/* ---------------------------------------------------------------- «Деталі акції» */
.promo {
  margin-top: 18px;
}
.promo__text {
  margin: 0 0 14px;
  font-size: 17px;
  line-height: 1.5;
  max-width: 40ch;
}
.promo__block {
  margin-top: 30px;
}
.prizes {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 14px;
}
.prize {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 14px;
  align-items: start;
  padding: 16px;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}
.prize__count {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  font: 800 30px/1 var(--font-display);
  color: var(--accent-ink);
  background: radial-gradient(circle at 50% 45%, var(--ember-core), var(--ember) 60%, var(--ember-deep));
  box-shadow: 0 0 22px -6px rgba(var(--glow), 0.8);
}
.prize__body {
  min-width: 0;
}
.prize__name {
  margin: 2px 0 0;
  font: 700 24px/1.05 var(--font-display);
  color: var(--accent);
}
.prize__need {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}
.prize__desc {
  margin: 8px 0 0;
}
.rules {
  margin: 10px 0 0;
  padding-left: 20px;
  display: grid;
  gap: 10px;
  max-width: 42ch;
}
.rules li::marker {
  color: var(--accent);
}

.gift-option {
  display: grid;
  gap: 6px;
}
.gift-option__desc {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.prize-edit .field:first-of-type {
  margin-top: 6px;
}
.swatches-caption {
  margin-top: 12px;
}
.apply-all {
  justify-self: start;
  margin-top: 4px;
  padding-left: 0;
}
.style-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.style-option {
  display: grid;
  gap: 6px;
  justify-items: start;
  padding: 12px;
  border: 0;
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  box-shadow: inset 0 0 0 1px var(--line);
  cursor: pointer;
  font: inherit;
}
.style-option.is-on {
  box-shadow: inset 0 0 0 2px var(--accent);
}
.style-option .coals {
  width: 100%;
  --cols: 2 !important;
}
.style-option .coal__label {
  display: none;
}
.style-option__title {
  font-weight: 700;
}
.style-option__sub {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
}

/* ---------------------------------------------------------------- tab bar + toast */
.tabbar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 8px 12px calc(8px + var(--safe-b));
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tab {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  max-width: 160px;
  padding: 6px 4px;
  border-radius: 12px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
}
.tab.is-active {
  color: var(--ink);
  background: var(--surface);
}
.tab__icon {
  width: 24px;
  height: 24px;
}

.toast {
  position: fixed;
  bottom: calc(24px + var(--safe-b));
  left: 50%;
  z-index: 60;
  max-width: min(92vw, 440px);
  padding: 12px 18px;
  border-radius: 14px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  font-size: 15px;
  text-align: center;
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transform: translate(-50%, 16px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}
.toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}
.toast[data-kind='error'] {
  background: var(--danger);
  color: #1a0806;
}
.has-tabs ~ .toast {
  bottom: calc(var(--tabbar-h) + 18px + var(--safe-b));
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }
}
