:root {
  --ui-space-1: 4px;
  --ui-space-2: 8px;
  --ui-space-3: 12px;
  --ui-space-4: 16px;
  --ui-space-5: 24px;
  --ui-space-6: 32px;
  --ui-space-7: 48px;
}

.app-shell [hidden] {
  display: none !important;
}

.app-shell {
  position: relative;
  width: min(100%, 1440px);
  min-height: 100svh;
  min-height: 100dvh;
  margin: 0 auto;
  display: grid;
  align-content: start;
  justify-items: center;
  padding: calc(24px + env(safe-area-inset-top, 0px)) clamp(18px, 4vw, 64px) calc(28px + var(--safe-bottom));
  background:
    radial-gradient(circle at 50% 0%, var(--glow), transparent 30rem),
    linear-gradient(180deg, rgba(0, 29, 20, 0.18), transparent 40%),
    var(--bg);
  overflow: visible;
}

.app-shell > .theme-toggle {
  top: calc(18px + env(safe-area-inset-top, 0px));
  right: max(18px, env(safe-area-inset-right, 0px));
}

.version-badge {
  position: absolute;
  top: calc(7px + env(safe-area-inset-top, 0px));
  right: calc(env(safe-area-inset-right, 0px) + clamp(18px, 4vw, 64px));
  padding: 0;
  border: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.08em;
}

.version-badge--inline {
  position: static;
  flex: 0 0 auto;
  padding: 0;
  font-size: 12px;
  line-height: 1;
}


.version-update {
  position: absolute;
  top: calc(7px + env(safe-area-inset-top, 0px));
  right: max(70px, calc(42px + env(safe-area-inset-right, 0px)));
  z-index: 3;
  width: auto;
  min-height: 32px;
  max-width: calc(100vw - 100px);
  padding: 6px 11px;
  border: 1px solid var(--toggle-border);
  border-radius: 10px;
  background: var(--button-bg);
  color: var(--button-fg);
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.app-loading {
  max-width: min(34rem, 100%);
  margin: 0;
  color: var(--muted);
  font-size: 0;
  line-height: 1.5;
  text-align: center;
}

.app-loading::after {
  content: "Запускаем приложение…";
  display: block;
  font-size: 15px;
}

.app-loading--recovery {
  font-size: 15px;
}

.app-loading--recovery::after {
  display: none;
}

.app-loading--recovery button {
  display: block;
  margin: 16px auto 0;
  padding: 12px 20px;
  font: inherit;
  cursor: pointer;
}

.app-shell:not(.session-ready) > :not(.app-loading) {
  visibility: hidden;
}

.version-update:disabled {
  opacity: .7;
  cursor: wait;
}

.version-update:hover,
.version-update:focus-visible {
  filter: brightness(1.06);
}

.version-update:focus-visible {
  outline: 2px solid var(--button-fg);
  outline-offset: 3px;
}

.menu-button {
  z-index: 5;
  width: 42px;
  height: 42px;
  padding: 0;
}

.menu-button__icon {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.app-menu {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: max(18px, env(safe-area-inset-right, 0px));
  z-index: 6;
  display: grid;
  gap: 0;
  width: min(320px, calc(100vw - 24px));
  padding: 8px;
  border: 1px solid var(--toggle-border);
  border-radius: 24px;
  background: var(--sheet-bg);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .22);
}

.app-menu button {
  min-height: 46px;
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  background: transparent;
  color: var(--sheet-fg);
  font: inherit;
  font-weight: 750;
  text-align: left;
  cursor: pointer;
}

.app-menu button + button {
}

.app-menu button:hover,
.app-menu button:focus-visible { background: var(--toggle-bg); }

.app-menu button[aria-current="page"] {
  background: var(--toggle-bg);
  box-shadow: inset 3px 0 0 var(--menu-active-accent);
}

.more-menu-list {
  display: grid;
  gap: 10px;
  margin-top: 22px;
  width: 100%;
  min-width: 0;
}

.more-menu-list button {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 12px 14px;
  box-sizing: border-box;
  border: 1px solid var(--toggle-border);
  border-radius: 14px;
  background: var(--toggle-bg);
  color: var(--sheet-fg);
  font: inherit;
  font-weight: 700;
  text-align: left;
}

.more-menu-list button svg {
  display: block;
  width: 22px;
  height: 22px;
  justify-self: center;
  fill: none;
  stroke: var(--menu-active-accent);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.more-menu-list button small { color: var(--muted); font-size: 70%; font-weight: 600; }
.more-menu-list button:disabled { cursor: not-allowed; opacity: .68; }
.more-menu-list button.is-muted-teaser { cursor: pointer; opacity: .68; }
.more-menu-list button.is-muted-teaser:focus-visible { opacity: 1; outline: 2px solid var(--menu-active-accent); outline-offset: 2px; }
.more-menu-list__settings { cursor: pointer; }

.app-card.app-view--menu { gap: 16px; }
.app-card.app-view--menu > h1 { margin-bottom: 0; }
.menu-gallery { display: grid; gap: 16px; width: 100%; margin: 0; padding: 0 0 calc(96px + var(--safe-bottom)); list-style: none; }
.menu-gallery__page,
.menu-gallery__page picture { display: block; min-width: 0; margin: 0; }
.menu-gallery__page { position: relative; }
.menu-gallery__page picture { width: min(100%, 640px); margin-inline: auto; border-radius: 12px; background: var(--sheet-bg); overflow: hidden; }
.menu-gallery__status { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: calc(100% - 32px); text-align: center; color: var(--muted); }
.menu-gallery__status[hidden] { display: none; }
.menu-gallery__status button { display: block; margin: 12px auto 0; min-height: 44px; padding: 10px 16px; border: 1px solid var(--toggle-border); border-radius: 12px; background: var(--toggle-bg); color: var(--sheet-fg); font: inherit; cursor: pointer; }
.menu-gallery__image { display: block; width: min(100%, 640px); height: auto; margin-inline: auto; border-radius: 12px; background: var(--sheet-bg); }
.app-card.chat-view { width: 100%; max-width: none; grid-template-rows: auto minmax(0, 1fr); row-gap: var(--ui-space-4); min-height: 0; height: 100%; min-width: 0; overflow: hidden; align-content: stretch; }
.chat-frame-wrap { position: relative; width: 100%; min-width: 0; min-height: 0; height: 100%; overflow: hidden; border-radius: 0; }
.chat-view iframe { display: block; box-sizing: border-box; min-width: 0; width: 100%; min-height: 0; height: 100%; border: 0; border-radius: 0; background: #fff; }
.chat-frame-wrap [data-chatwoot-status] { position: absolute; z-index: 1; top: 50%; left: 50%; width: max-content; max-width: calc(100% - 32px); margin: 0; padding: 10px 14px; transform: translate(-50%, -50%); border-radius: 12px; background: rgb(0 0 0 / 76%); color: #fff; text-align: center; pointer-events: none; box-shadow: 0 2px 10px rgb(0 0 0 / 24%); }
.chat-frame-wrap [data-chatwoot-status][hidden] { display: none !important; }
.chat-view > h1 { box-sizing: border-box; padding-inline: clamp(18px, 4vw, 64px); margin-bottom: 0; font-size: clamp(27px, 5vw, 36px); }
.terms-view { align-content: start; }
.terms-view > h1 { margin: 0 0 22px; line-height: 1.15; }
.terms-back-button { justify-self: start; min-height: 44px; margin-bottom: 18px; padding: 8px 12px; border: 1px solid var(--toggle-border); border-radius: 12px; background: var(--toggle-bg); color: var(--sheet-fg); font: inherit; font-weight: 700; cursor: pointer; }
.terms-sections { display: grid; gap: 16px; width: 100%; }
.terms-sections section { padding-top: 16px; border-top: 1px solid var(--toggle-border); }
.terms-sections section:first-child { padding-top: 0; border-top: 0; }
.terms-sections h2 { margin: 0 0 8px; font-size: 1.05rem; line-height: 1.3; }
.terms-sections p { margin: 0; color: var(--muted); line-height: 1.6; }

.owner-view { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: stretch; align-content: start; gap: var(--ui-space-4); padding: 0 0 calc(120px + var(--safe-bottom)); box-sizing: border-box; min-width: 0; }
.app-card.owner-view { gap: var(--ui-space-4); }
.app-card.owner-view > h1 { margin: 0 0 var(--ui-space-2); line-height: 1.15; font-size: clamp(32px, 6vw, 46px); }
.owner-tabs { width: 100%; min-width: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--ui-space-2); }
.owner-tabs button { min-width: 0; min-height: 44px; padding: 8px 5px; border: 1px solid var(--toggle-border); border-radius: 12px; background: var(--toggle-bg); color: var(--sheet-fg); font: inherit; font-weight: 700; }
.owner-tabs button[aria-selected="true"] { background: var(--button-bg); color: var(--button-fg); }
.owner-management-menu { width: 100%; min-width: 0; display: grid; gap: 10px; }
.owner-management-menu button, .owner-back-button { min-height: 44px; padding: 10px 14px; border: 1px solid var(--toggle-border); border-radius: 12px; background: var(--toggle-bg); color: var(--sheet-fg); font: inherit; font-weight: 700; text-align: left; }
.owner-back-button { justify-self: start; min-height: 44px; padding: 8px 12px; }
.users-groups-view { overflow-x: hidden; }
.users-groups-list { width: 100%; min-width: 0; display: grid; gap: 12px; }
.users-groups-index { width: 100%; min-width: 0; display: grid; gap: 8px; }
.users-group-summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; width: 100%; min-height: 56px; padding: 10px 12px; border: 1px solid var(--toggle-border); border-radius: 14px; background: var(--toggle-bg); color: var(--sheet-fg); font: inherit; text-align: left; }
.users-group-summary span { color: var(--muted); font-size: .88rem; }
.users-group-card { min-width: 0; padding: 10px; border: 1px solid var(--toggle-border); border-radius: 14px; background: var(--toggle-bg); }
.users-group-card h2 { margin: 0 0 7px; font-size: 1rem; }
.users-group-user { display: grid; gap: 2px; min-width: 0; padding: 7px 0; border-top: 1px solid color-mix(in srgb, var(--toggle-border) 70%, transparent); }
.users-group-user:first-of-type { border-top: 0; padding-top: 0; }
.users-group-ordinal { justify-self: end; color: var(--muted); font-size: .8rem; font-weight: 700; }
.users-group-user span { color: var(--muted); font-size: .88rem; overflow-wrap: anywhere; }
.users-group-card-row, .users-group-details { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; min-width: 0; }
.users-group-details span { font-size: .75rem; white-space: nowrap; overflow-wrap: normal; }
.users-group-controls { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; align-items: center; margin-top: 6px; }
.users-group-controls select { width: 100%; min-width: 0; min-height: 44px; box-sizing: border-box; padding: 8px 10px; border: 1px solid var(--toggle-border); border-radius: 10px; font: inherit; }
.users-group-controls select { background: var(--sheet-bg); color: var(--sheet-fg); }
.users-group-status { grid-column: 1 / -1; min-height: 1.1em; }
.owner-search-label { display: grid; gap: 7px; width: 100%; min-width: 0; color: var(--muted); font-size: 14px; }
.owner-search-label input { width: 100%; min-height: 44px; box-sizing: border-box; padding: 10px 12px; border: 1px solid var(--toggle-border); border-radius: 12px; background: var(--toggle-bg); color: var(--sheet-fg); font: inherit; }
.owner-event-filter { width: 100%; min-width: 0; border: 1px solid var(--toggle-border); border-radius: 12px; background: var(--toggle-bg); }
.owner-event-filter summary { padding: 12px; font-weight: 700; cursor: pointer; }
.owner-event-options { display: grid; gap: 8px; padding: 0 12px 12px; }
.owner-event-options label { display: flex; align-items: center; gap: 9px; min-height: 44px; overflow-wrap: anywhere; }
.owner-journal { width: 100%; min-width: 0; display: grid; gap: 10px; }
.owner-journal article { padding: 14px; border: 1px solid var(--toggle-border); border-radius: 14px; background: var(--toggle-bg); overflow-wrap: anywhere; }
.owner-journal article strong { display: block; margin-bottom: 6px; }
.release-versions, .release-groups, .release-history { width: 100%; display: grid; gap: 10px; }
.release-versions p, .release-history p { margin: 0; padding: 12px 14px; border: 1px solid var(--toggle-border); border-radius: 12px; background: var(--toggle-bg); overflow-wrap: anywhere; }
.release-groups label { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 12px; border: 1px solid var(--toggle-border); border-radius: 12px; background: var(--toggle-bg); box-sizing: border-box; cursor: pointer; }
.release-groups input { width: 20px; height: 20px; flex: 0 0 20px; margin: 0; accent-color: var(--button-bg); }
.release-groups label:has(input:disabled) { opacity: .6; cursor: default; }
.release-emergency { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 10px 12px; border: 1px solid var(--toggle-border); border-radius: 12px; background: var(--toggle-bg); box-sizing: border-box; }
.release-emergency input { width: 20px; height: 20px; accent-color: var(--button-bg); }
.owner-view > h2 { width: 100%; margin: 8px 0 0; font-size: 1.05rem; }

@media (max-width: 639px) {
  .owner-view { --owner-bottom-nav-clearance: calc(92px + env(safe-area-inset-bottom, 0px)); min-height: calc(100svh - 24px); padding-bottom: 0; }
  .owner-view::after { content: ""; display: block; width: 100%; height: var(--owner-bottom-nav-clearance); }
  .owner-view > *, .owner-tabs, .owner-journal { max-width: 100%; }
}

.app-menu button:active,
.redemption-submit:active,
.card-refresh-button:active {
  transform: scale(0.98);
}

.menu-scrim[hidden] {
  display: none !important;
}

.menu-scrim {
  position: fixed;
  inset: 0;
  z-index: 5;
  background: rgba(0, 0, 0, .16);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.app-card {
  width: min(100%, var(--app-content-width));
  min-height: 0;
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 0;
  padding: 0;
  color: var(--fg);
}

.app-card--auth {
  width: min(100%, var(--app-auth-width));
  min-height: calc(100svh - 120px);
  align-content: center;
}

.app-card--bonus {
  width: min(100%, var(--app-content-width));
  padding-top: 0;
}

.app-card--bonus,
.app-view {
  padding-top: 0;
}

.app-card h1 {
  width: 100%;
  margin: 0;
  font-size: clamp(31px, 6vw, 46px);
  line-height: 1;
  letter-spacing: -0.035em;
  text-align: left;
  font-weight: 750;
}

.app-card--auth h1 {
  max-width: 360px;
  text-align: center;
}

.app-logo {
  margin: 0 0 26px;
}

.app-card--auth > .app-muted {
  margin-top: 18px;
}

.app-muted,
.app-status {
  width: 100%;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
  text-align: center;
}

.phone-form {
  width: min(100%, 360px);
  display: grid;
  gap: 9px;
  margin-top: 30px;
}

.phone-form label,
.redemption-controls label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.phone-form input {
  width: 100%;
  min-height: 54px;
  border: 1px solid var(--toggle-border);
  border-radius: 15px;
  padding: 0 17px;
  background: var(--toggle-bg);
  color: var(--fg);
  font-size: 18px;
  font-weight: 750;
}

.phone-form input::placeholder {
  color: var(--muted);
}

.phone-form .install-button {
  width: 100%;
  margin-top: 8px;
}

.auth-methods {
  width: 100%;
  display: grid;
  justify-items: center;
  text-align: center;
}

.auth-methods h2 {
  width: 100%;
  margin: 0;
  text-align: center;
}

.auth-methods__actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.auth-methods__actions .install-button {
  width: auto;
  min-width: 150px;
  margin-top: 0;
}

.phone-form--call .install-button,
.auth-methods [data-sms-send] {
  display: flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  min-width: 180px;
  margin: 16px auto 0;
  text-align: center;
}

.auth-methods [data-call-instructions],
.auth-methods [data-sms-instructions] {
  margin-top: 16px;
  text-align: center;
}

.app-card--auth .app-status {
  max-width: 360px;
  min-height: 21px;
  margin-top: 14px;
}

.install-actions {
  width: min(100%, 360px);
  display: grid;
  gap: 10px;
  justify-items: center;
  margin-top: 26px;
}

.install-button--secondary {
  background: transparent;
  border: 1px solid var(--toggle-border);
  color: var(--fg);
}

.install-status {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.account-summary {
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.account-identity {
  min-width: 0;
  display: grid;
  gap: 0;
}

.account-kicker {
  display: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.account-name {
  max-width: 290px;
  overflow-wrap: anywhere;
}

.account-name,
[data-shift-staff] p {
  font-size: clamp(20px, 4vw, 26px);
  line-height: 1.08;
  font-weight: 700;
}

.account-balance {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  gap: 4px;
  color: #f2c51d;
  white-space: nowrap;
}

.account-balance__value {
  font-size: clamp(44px, 10vw, 68px);
  line-height: .86;
  letter-spacing: -0.06em;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 26px color-mix(in srgb, var(--accent) 36%, transparent);
}

:root[data-theme="light"] .account-balance {
  color: #6e4b2e;
}

:root[data-theme-family="neon-forest"] .account-balance {
  color: var(--accent);
}

:root[data-theme-family="neon-forest"][data-theme="dark"] .account-balance {
  color: var(--button-bg);
}

.account-balance__currency {
  font-size: 20px;
  font-weight: 800;
}

.app-card-meta {
  width: 100%;
  display: flex;
  align-items: baseline;
  gap: 8px 12px;
  flex-wrap: nowrap;
  margin-top: 4px;
}

.app-card-number {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 16.25px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-card-benefit {
  flex: 0 1 auto;
  min-width: 0;
  margin: 0 0 0 auto;
  font-size: 16.25px;
  justify-self: end;
  text-align: right;
  white-space: nowrap;
}

.app-card-benefit span {
  color: var(--fg);
  font-weight: 750;
}

:root[data-theme-family="neon-forest"][data-theme="dark"] .app-card-benefit span {
  color: var(--fg);
}

.app-card-number span {
  color: var(--fg);
  font-weight: 750;
}

.bonus-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 8px !important;
}

.bonus-qr {
  width: 100%;
  display: grid;
  justify-items: center;
  gap: 13px;
  margin-top: var(--app-section-gap);
  padding-bottom: var(--app-section-gap);
  border-bottom: 1px solid var(--line);
}

.bonus-qr .app-muted {
  font-size: 14px;
}

.qr-card {
  width: min(68vw, 236px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 21px;
  background: #ffffff;
  box-shadow: 0 0 32px color-mix(in srgb, var(--accent) 22%, transparent);
}

.qr-card img {
  width: 83%;
  height: 83%;
  display: block;
}

.app-card--bonus {
  font-size: 16px;
  line-height: 24px;
}

.bonus-bill {
  width: 100%;
  margin-top: var(--ui-space-2);
}

.bonus-bill h2 {
  margin: 0;
  font-size: 24px;
  line-height: 28px;
  letter-spacing: -0.02em;
}

.bonus-bill-status {
  position: static;
  min-height: 22px;
  margin-top: 10px;
  text-align: right;
}

.bill-list {
  width: 100%;
  display: grid;
  gap: 0;
  margin-top: 8px;
}

.bill-item {
  min-height: 36px;
  display: grid;
  gap: 0;
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.bill-heading-row,
.bill-payment-row {
  min-width: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.bill-heading-row {
  padding-bottom: var(--ui-space-3);
  border-bottom: 1px solid var(--line);
}

.bill-items {
  display: grid;
  gap: var(--ui-space-2);
  margin-top: var(--ui-space-3);
  padding: var(--ui-space-3) 0;
  border-bottom: 1px solid var(--line);
}

.bill-items p {
  margin: 0;
}

.bill-item strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 16px;
  line-height: 24px;
}

.bill-item span,
.bill-item p {
  min-width: 0;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 20px;
  overflow-wrap: anywhere;
}

.bill-item b {
  color: var(--button-bg);
  font-size: 17px;
  white-space: nowrap;
}

.bill-payment-label {
  flex: 0 0 auto;
  color: var(--muted) !important;
  font-size: 13px !important;
}

.bill-payment-row {
  justify-content: flex-end;
  gap: 12px;
}

.bill-payment-amount {
  flex: 0 0 auto;
  font-size: 21px !important;
}

.bill-discount {
  min-width: 0;
  flex: 1 1 auto;
  overflow-wrap: anywhere;
  color: var(--history-discount) !important;
  font-size: 13px !important;
  text-align: left;
}

.bill-discount__name {
  color: var(--fg) !important;
}

.bill-discount__amount {
  color: var(--history-discount) !important;
  font-weight: 750;
}

.bill-meta {
  display: block;
}

.bill-heading-row .bill-meta {
  display: inline;
}

.bill-summary {
  display: grid;
  gap: var(--ui-space-2);
  margin-top: var(--ui-space-4);
  padding-top: var(--ui-space-3);
  border-top: 1px solid var(--line);
}

.bill-summary__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--ui-space-3);
  min-width: 0;
}

.bill-summary__row span {
  color: var(--muted) !important;
}

.bill-summary__row b {
  flex: 0 0 auto;
  color: var(--fg);
  font-size: 14px;
  line-height: 20px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bill-summary__row--accent span,
.bill-summary__row--accent b {
  color: var(--history-discount) !important;
}

.bill-summary__row--accent b {
  font-weight: 750;
}

.bill-summary__row--total {
  margin-top: 3px;
}

.bill-summary__row--total b {
  color: var(--button-bg);
  font-size: 21px;
}

.bill-item p {
  padding-top: 5px;
}

.bill-total {
  display: block;
  width: 100%;
  margin-top: var(--ui-space-4);
  color: var(--button-bg);
  font-size: 24px;
  line-height: 28px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.history-list {
  width: 100%;
  display: grid;
  gap: 0;
  margin-top: 16px;
}

.history-item {
  min-height: 56px;
  display: grid;
  grid-template-columns: 180px 88px 110px;
  justify-content: start;
  gap: 5px 14px;
  padding: var(--app-row-padding) 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.history-item span {
  color: var(--muted);
  font-size: 13px;
}

.history-item > strong,
.history-item > b {
  text-align: left;
}

.history-item__cashback,
.history-item__amount {
  text-align: left;
}

@media (max-width: 520px) {
  .history-item {
    grid-template-columns: minmax(0, 1fr) 78px 96px;
    gap-inline: 8px;
  }
}

@media (max-width: 380px) {
  .history-item {
    grid-template-columns: minmax(0, 1fr) 70px 90px;
  }
}

.history-item b {
  grid-column: 3;
  grid-row: 1 / span 2;
  align-self: center;
  color: var(--button-bg);
  white-space: nowrap;
}

.history-item__cashback {
  color: var(--history-cashback) !important;
  font-weight: 750;
  white-space: nowrap;
}

.history-item__amount {
  grid-column: 2;
  grid-row: 2;
  color: var(--history-discount) !important;
  font-weight: 700;
  white-space: nowrap;
}

.redemption-panel {
  grid-column: 1 / -1;
  width: 100%;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.redemption-controls {
  width: 100%;
  display: grid;
  gap: 6px;
}

.redemption-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.redemption-heading output {
  color: var(--button-bg);
  font-size: 22px;
  font-weight: 750;
}

.redemption-controls input[type="range"] {
  width: 100%;
  height: 30px;
  margin: 2px 0 0;
  accent-color: var(--button-bg);
  cursor: pointer;
}

.redemption-scale {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.redemption-limit-label {
  text-align: right;
}

.redemption-manual {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 2px;
}

.redemption-manual label {
  font-size: 13px;
}

.redemption-input-wrap {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 7px;
}

.redemption-input-wrap input {
  width: 112px;
  min-height: 48px;
  border: 1px solid var(--toggle-border);
  border-radius: 14px;
  padding: 0 12px;
  background: var(--toggle-bg);
  color: var(--fg);
  font-size: 17px;
  font-weight: 750;
  text-align: right;
}

.redemption-input-wrap span {
  color: var(--muted);
  font-size: 14px;
}

.redemption-controls > .app-muted {
  width: 100%;
  margin-top: -1px;
  font-size: 12px;
  text-align: left;
}

.redemption-submit {
  width: 100%;
  min-height: 52px;
  margin-top: 2px;
  border: 0;
  border-radius: 15px;
  background: var(--button-bg);
  color: var(--button-fg);
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
}

.redemption-submit:hover,
.redemption-submit:focus-visible {
  filter: brightness(1.05);
}

.profile-list {
  width: 100%;
  margin: 12px 0 0;
  display: grid;
  gap: 0;
}

.profile-list div {
  min-height: 56px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: var(--app-row-padding) 0;
  border-bottom: 1px solid var(--line);
}

.profile-list dt {
  color: var(--muted);
}

.profile-list dd {
  margin: 0;
  font-weight: 750;
  text-align: right;
  overflow-wrap: anywhere;
}

.profile-qr {
  width: 100%;
  display: grid;
  justify-items: center;
  gap: 6px;
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid var(--line);
}

.profile-heading {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.profile-heading h1 {
  width: auto;
  min-width: 0;
  flex: 1 1 auto;
}

.profile-heading .card-refresh-button {
  flex: 0 0 auto;
  margin-top: 0;
  padding-inline: 12px;
  font-size: 12px;
}

.profile-qr .qr-card,
.invite-qr {
  padding: 8px;
  border: 1px solid color-mix(in srgb, var(--fg) 24%, transparent);
  box-shadow: 0 8px 24px color-mix(in srgb, #000 16%, transparent);
}

.profile-qr .qr-card {
  margin-top: 0;
}

.invite-setting {
  width: 100%;
  margin-top: 14px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.invite-setting h2 { margin: 0 0 8px; font-size: 20px; }
.invite-link { width: 100%; margin: 12px 0; padding: 12px; border: 1px solid var(--toggle-border); border-radius: 12px; background: var(--toggle-bg); color: var(--fg); font: inherit; font-size: 13px; }
.invite-qr { display: block; width: min(220px, 62vw); height: auto; margin: 16px auto; border-radius: 12px; background: #fff; }

.profile-qr .app-muted {
  margin: 0;
  text-align: center;
}

.operation-status {
  width: 100%;
  margin: 24px 0 0;
  padding: 14px 16px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--sheet-bg) 88%, transparent);
  color: var(--fg);
  font-size: 15px;
  font-weight: 700;
  text-align: center;
}

.operation-status[data-state="success"] { color: var(--accent); }
.operation-status[data-state="error"] { color: #ff756f; }

.session-logout {
  width: 100%;
  min-height: 50px;
  margin-top: 28px;
  border: 1px solid var(--toggle-border);
  border-radius: 16px;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.app-view {
  width: min(100%, var(--app-content-width));
  padding-top: 0;
}

.app-view > h1 {
  margin-bottom: 2px;
}

.app-view .qr-card {
  margin-top: 24px;
}

.app-view > .app-muted {
  margin-top: 15px;
}

.card-refresh-button {
  min-height: 40px;
  margin-top: 17px;
  padding: 8px 15px;
  border: 1px solid var(--toggle-border);
  border-radius: 12px;
  background: var(--button-bg);
  color: var(--button-fg);
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.card-refresh-button:hover,
.card-refresh-button:focus-visible {
  filter: brightness(1.06);
}

.card-refresh-button:focus-visible {
  outline: 2px solid var(--button-fg);
  outline-offset: 3px;
}

.card-refresh-button:disabled {
  opacity: .6;
  cursor: wait;
}

.app-debug {
  width: min(100%, 680px);
  max-height: 340px;
  overflow: auto;
  border-radius: 14px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.22);
  color: var(--fg);
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.push-setting {
  width: 100%;
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: var(--app-section-gap);
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-weight: 750;
}

.theme-settings {
  width: 100%;
  display: grid;
  gap: 32px;
  margin-top: 30px;
}

.theme-setting {
  min-width: 0;
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  border: 0;
}

.theme-setting > label,
.theme-setting > legend {
  padding: 0 4px;
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.theme-family-options {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--toggle-border);
  border-radius: 18px;
  background: color-mix(in srgb, var(--sheet-bg) 88%, transparent);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .08);
}

.theme-choice {
  min-height: 88px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}

.theme-choice + .theme-choice {
  border-top: 1px solid var(--line);
}

.theme-choice:has(input:checked) {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.theme-choice:active {
  transform: scale(.99);
}

.theme-choice input {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

.theme-choice span {
  display: grid;
  gap: 4px;
}

.theme-choice strong {
  font-size: 17px;
  line-height: 1.1;
}

.theme-choice small {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.25;
}

.theme-mode-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--toggle-border);
  border-radius: 18px;
  background: color-mix(in srgb, var(--sheet-bg) 88%, transparent);
}

.theme-mode-options label {
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: 0;
  border-radius: 14px;
  color: var(--fg);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.theme-mode-options label:has(input:checked) {
  background: var(--button-bg);
  color: var(--button-fg);
}

.theme-mode-options input {
  accent-color: var(--button-bg);
}

/* v3.88: extend the owner rhythm to secondary screens. */
.app-view[data-view="profile"],
.app-view[data-view="history"],
.app-view[data-view="settings"],
.terms-view,
.app-view[data-view="more"] {
  gap: var(--ui-space-4);
}

.app-view[data-view="profile"] > h1,
.app-view[data-view="history"] > h1,
.app-view[data-view="settings"] > h1,
.terms-view > h1,
.app-view[data-view="more"] > h1 {
  margin-bottom: var(--ui-space-2);
  line-height: 1.15;
  font-size: clamp(32px, 6vw, 44px);
}

.more-menu-list,
.terms-sections,
.theme-settings,
.owner-management-menu,
.users-groups-list,
.owner-journal,
.release-versions,
.release-groups,
.release-history {
  gap: var(--ui-space-3);
}

.more-menu-list button,
.terms-back-button,
.owner-management-menu button,
.owner-back-button,
.owner-event-filter summary,
.owner-event-options label,
.owner-search-label input,
.users-group-controls select,
.release-groups label,
.release-emergency {
  min-height: 48px;
}

.terms-sections section,
.invite-setting,
.profile-qr,
.redemption-panel,
.push-setting {
  padding-top: var(--ui-space-4);
}

.terms-sections h2,
.invite-setting h2,
.users-group-card h2,
.owner-view > h2 {
  margin-bottom: var(--ui-space-2);
  font-size: 20px;
  line-height: 1.3;
}

.terms-sections p,
.owner-search-label,
.users-group-summary span,
.users-group-user span,
.theme-choice small,
.redemption-scale,
.redemption-input-wrap span {
  font-size: 14px;
  line-height: 20px;
}

.profile-list,
.profile-list div,
.theme-setting,
.theme-choice,
.owner-journal article,
.release-versions p,
.release-history p,
.users-group-card {
  padding-block: var(--ui-space-3);
}

.profile-list dd,
.account-balance-value,
.history-item__cashback,
.history-item__amount,
.redemption-heading output,
.redemption-input-wrap input {
  font-variant-numeric: tabular-nums;
}

.profile-list dd,
.history-item__cashback,
.history-item__amount,
.owner-journal article strong {
  line-height: 20px;
}

.app-menu,
.more-menu-list button,
.terms-back-button,
.owner-tabs button,
.owner-management-menu button,
.owner-back-button,
.users-group-summary,
.users-group-card,
.owner-event-filter,
.owner-journal article,
.release-versions p,
.release-history p,
.release-groups label,
.release-emergency,
.theme-family-options,
.theme-mode-options {
  border-radius: 14px;
}

@media (min-width: 640px) {
  .app-view[data-view="profile"] > h1,
  .app-view[data-view="history"] > h1,
  .app-view[data-view="settings"] > h1,
  .terms-view > h1,
  .app-view[data-view="more"] > h1 {
    font-size: 44px;
    line-height: 48px;
  }
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--button-bg);
  outline-offset: 3px;
}

@media (max-width: 639px) {
  .app-shell { padding-bottom: calc(10px + var(--safe-bottom)); }
  .app-view[data-view="profile"] {
    padding-bottom: calc(138px + env(safe-area-inset-bottom, 0px));
  }
  .app-view[data-view="profile"] .profile-qr .qr-card {
    width: min(68vw, clamp(112px, 22dvh, 190px));
  }
  .app-view[data-view="profile"] .profile-list div {
    min-height: clamp(40px, 7dvh, 56px);
    padding-block: clamp(6px, 1.2dvh, 12px);
  }
  .app-view[data-view="profile"] .session-logout {
    position: fixed;
    z-index: 21;
    left: 50%;
    bottom: calc(86px + env(safe-area-inset-bottom, 0px));
    width: min(calc(100vw - 36px), var(--app-content-width));
    min-height: 50px;
    margin: 0;
    transform: translateX(-50%);
    background: var(--bg);
  }
  .app-view[data-view="settings"] {
    padding-bottom: calc(112px + env(safe-area-inset-bottom, 0px));
  }
  .app-view[data-view="terms"] {
    padding-bottom: calc(112px + env(safe-area-inset-bottom, 0px));
  }
  .terms-sections { gap: 12px; }
  .terms-sections section { padding-top: 14px; }
  .terms-sections section:first-child { padding-top: 0; }
  .app-view:not([hidden]) { animation: app-view-enter .22s cubic-bezier(.2,.8,.2,1); }
  .app-view[data-view="settings"] { scroll-margin-top: 0; }
  .app-view[data-view="settings"]:not([hidden]) { animation: app-view-fade .18s ease-out; }
  main { padding-bottom: 78px; }
}

@media (min-width: 640px) {
  .app-card.owner-view > h1 {
    font-size: 44px;
    line-height: 48px;
  }
}

@media (max-width: 639px) and (max-height: 640px) {
  .app-view[data-view="profile"] .profile-qr .qr-card {
    width: min(68vw, clamp(88px, 20dvh, 132px));
  }
  .app-view[data-view="profile"] .profile-list {
    margin-top: 8px;
  }
  .app-view[data-view="profile"] .profile-list div {
    min-height: clamp(36px, 6.25dvh, 42px);
    padding-block: clamp(4px, 1dvh, 6px);
  }
  .app-view[data-view="profile"] .session-logout {
    min-height: 44px;
  }
}

@keyframes app-view-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes app-view-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (min-width: 640px) {
  .app-shell {
    padding-top: calc(100px + env(safe-area-inset-top, 0px));
  }

  .app-card--bonus,
  .app-view {
    padding-top: 0;
  }

  .app-card--auth {
    min-height: calc(100svh - 136px);
  }
}

@media (max-width: 374px) {
  .app-shell {
    padding-inline: 16px;
  }

  .account-summary {
    gap: 10px;
  }

  .account-name,
  [data-shift-staff] p {
    font-size: 18px;
  }

  .account-balance__value {
    font-size: 40px;
  }

  .account-balance__currency {
    font-size: 17px;
  }

  .redemption-heading output {
    font-size: 20px;
  }
}

/* Keep the installed iPhone app in a readable portrait layout if iOS ignores
   the manifest or Screen Orientation API request while the device is sideways. */
@media (orientation: landscape) and (pointer: coarse) and (max-height: 600px) {
  html,
  body {
    width: 100%;
    height: 100%;
    overflow: hidden;
  }

  body {
    position: fixed;
    inset: 0;
  }

  .app-shell {
    position: fixed;
    top: 0;
    left: 0;
    width: 100dvh;
    height: 100dvw;
    min-height: 0;
    max-width: none;
    margin: 0;
    overflow-x: hidden;
    overflow-y: auto;
    transform-origin: top left;
  }

  html[data-portrait-lock-angle="270"] .app-shell {
    transform: rotate(90deg) translateY(-100%);
    padding: calc(24px + env(safe-area-inset-right, 0px))
      calc(18px + env(safe-area-inset-bottom, 0px))
      calc(28px + env(safe-area-inset-left, 0px))
      calc(18px + env(safe-area-inset-top, 0px));
  }

  html:not([data-portrait-lock-angle="270"]) .app-shell {
    transform: rotate(-90deg) translateX(-100%);
    padding: calc(24px + env(safe-area-inset-left, 0px))
      calc(18px + env(safe-area-inset-top, 0px))
      calc(28px + env(safe-area-inset-right, 0px))
      calc(18px + env(safe-area-inset-bottom, 0px));
  }
}

/* Persistent bottom navigation at every viewport width. */
.menu-button { display: none; }
.menu-scrim { display: none !important; }
.app-menu {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: stretch;
  gap: 0;
  z-index: 20;
  top: auto;
  left: 0;
  right: 0;
  position: fixed !important;
  top: auto !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  transform: translateZ(0);
  will-change: transform;
  width: 100%;
  min-height: 76px;
  max-height: none;
  padding: 8px max(12px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
  border-right: 0;
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  background: var(--sheet-bg);
  box-shadow: 0 -12px 30px color-mix(in srgb, #000 16%, transparent);
  backdrop-filter: none;
}

.app-menu button,
.app-menu button + button {
  display: grid;
  place-items: center;
  text-align: center;
  min-height: 58px;
  padding: 6px 3px;
  border-radius: 14px;
  border-top: 0;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
  transition: color .18s ease, background-color .18s ease, transform .18s ease;
}
.app-menu button[aria-current="page"] {
  color: var(--menu-active-accent);
  background: transparent;
  box-shadow: none;
}
.app-menu button::before {
  display: block;
  margin-bottom: 2px;
  font-size: 20px;
  line-height: 1;
  color: currentColor;
}
.app-menu button[data-menu-view="bonus"]::before { content: "⌂"; }
.app-menu button[data-menu-view="menu"]::before { content: "♙"; }
.app-menu button[data-menu-view="history"]::before,
.app-menu button[data-menu-view="bill"]::before { content: "↺"; }
.app-menu button[data-menu-view="chat"]::before {
  content: "";
  width: 20px;
  height: 20px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 11.5a7.5 7.5 0 0 1-7.5 7.5H6l-3 2v-5.2A7.4 7.4 0 0 1 2 12.5 7.5 7.5 0 0 1 9.5 5h3a7.5 7.5 0 0 1 7.5 6.5Z' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3Ccircle cx='8.5' cy='12.5' r='0.8' fill='black'/%3E%3Ccircle cx='12' cy='12.5' r='0.8' fill='black'/%3E%3Ccircle cx='15.5' cy='12.5' r='0.8' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 11.5a7.5 7.5 0 0 1-7.5 7.5H6l-3 2v-5.2A7.4 7.4 0 0 1 2 12.5 7.5 7.5 0 0 1 9.5 5h3a7.5 7.5 0 0 1 7.5 6.5Z' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3Ccircle cx='8.5' cy='12.5' r='0.8' fill='black'/%3E%3Ccircle cx='12' cy='12.5' r='0.8' fill='black'/%3E%3Ccircle cx='15.5' cy='12.5' r='0.8' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
}
.app-menu button[data-menu-view="settings"]::before { content: "⚙"; }
.app-menu button[data-menu-view="more"]::before { content: "•••"; letter-spacing: 1px; }
.app-menu button:active { transform: scale(.96); }
.app-menu[hidden] { display: none !important; }
main { padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px)); }
.owner-view::after { content: ""; display: block; height: calc(92px + env(safe-area-inset-bottom, 0px)); }

.app-menu-frame { display: contents; }
@media (orientation: landscape) and (pointer: coarse) and (max-height: 600px) {
  .app-menu-frame {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100dvh;
    height: 100dvw;
    transform-origin: top left;
    pointer-events: none;
    z-index: 20;
  }
  html[data-portrait-lock-angle="270"] .app-menu-frame {
    transform: rotate(90deg) translateY(-100%);
  }
  html:not([data-portrait-lock-angle="270"]) .app-menu-frame {
    transform: rotate(-90deg) translateX(-100%);
  }
  .app-menu-frame .app-menu { pointer-events: auto; }
}


/* Keep the version badge outside the chat screen, where the iframe uses the full area. */
.app-shell > .version-badge { display: block !important; }
.app-shell:has(.chat-view:not([hidden])) > .version-badge { display: none !important; }


/* Keep the outer chat page stationary; conversation scrolling belongs to Chatwoot. */
html:has(.chat-view:not([hidden])) { overflow: hidden; overscroll-behavior: none; }
body:has(.chat-view:not([hidden])) { position: fixed; inset: 0; overflow: hidden; overscroll-behavior: none; }
.app-shell:has(.chat-view:not([hidden])) {
  width: 100%;
  max-width: none;
  height: var(--chat-viewport-height, 100dvh);
  min-height: 0;
  box-sizing: border-box;
  overflow: hidden;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  justify-items: stretch;
  padding-inline: 0;
  padding-bottom: var(--chat-bottom-clearance, calc(108px + env(safe-area-inset-bottom, 0px)));
  transition: none;
}
@media (orientation: portrait), (pointer: fine), (min-height: 601px) {
  .app-shell:has(.chat-view:not([hidden])) { position: fixed; top: var(--chat-viewport-top, 0px); left: 0; right: 0; }
}
html[data-chat-keyboard="true"]:has(.chat-view:not([hidden])) .app-menu { display: none !important; }
@media (prefers-reduced-motion: reduce) {
  .app-shell:has(.chat-view:not([hidden])) { transition: none; }
}
.chat-view > .terms-back-button { margin-bottom: 0; }

/* Reconciliation label stays compact alongside the guest name on narrow screens. */
.account-balance__value[data-balance-state="reconciling"] {
  font-size: clamp(20px, 5vw, 32px);
  line-height: 1;
  letter-spacing: -0.02em;
}

/* Keep the last More action above the fixed bottom navigation. */
.more-view { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
.app-card.chat-view { padding-inline: 0; padding-bottom: 0; grid-template-columns: minmax(0, 1fr); }

/* The fixed navigation must not cover the last bill total at the scroll limit. */
.app-shell:has(.app-card--bonus:not([hidden])) {
  padding-bottom: calc(112px + var(--safe-bottom, 0px));
}

.promotion-symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
.promotions-view, .promotion-detail-view { gap: var(--ui-space-3, 16px); padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); color: var(--sheet-fg); }
.promotion-list { display: grid; gap: 10px; width: 100%; }
.promotion-card { display: grid; grid-template-columns: 54px minmax(0, 1fr) minmax(84px, auto); gap: 12px; align-items: center; width: 100%; min-height: 78px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--sheet-bg); color: var(--sheet-fg); font: inherit; text-align: left; cursor: pointer; }
.promotion-card:focus-visible { outline: 2px solid var(--button-bg); outline-offset: 2px; }
.promotion-card__icon { display: grid; place-items: center; width: 48px; height: 48px; color: var(--menu-active-accent); }
.promotion-card__icon svg { display: block; width: 44px; height: 44px; fill: none; stroke: currentColor; }
.promotion-card__icon--hookahs svg { width: 50px; height: 48px; }
.promotion-card__icon--glasses svg { width: 48px; height: 48px; }
.promotion-card__copy { display: grid; gap: 4px; min-width: 0; }
.promotion-card__copy strong { color: var(--sheet-fg); font-size: .98rem; line-height: 1.2; }
.promotion-card__copy small { color: var(--muted); font-size: .82rem; line-height: 1.25; }
.promotion-card__price { display: grid; place-items: center; box-sizing: border-box; min-width: 84px; min-height: 40px; padding: 6px 8px; border: 1px solid var(--menu-active-accent); border-radius: 12px; color: var(--menu-active-accent); font-size: .9rem; font-weight: 750; line-height: 1.1; text-align: center; }
.promotion-detail-view { align-content: start; }
.promotion-detail__icon { display: grid; place-items: center; width: min(100%, 240px); height: 220px; margin: 0 auto; color: var(--menu-active-accent); }
.promotion-detail__icon svg { width: 160px; height: 200px; fill: none; stroke: currentColor; }
.promotion-detail__price { justify-self: center; min-width: 120px; margin: 0; padding: 10px 16px; border: 1px solid var(--menu-active-accent); border-radius: 14px; color: var(--menu-active-accent); font-size: 1.1rem; font-weight: 750; text-align: center; }
.promotion-detail-view > h1 { margin: 0; text-align: center; }
.promotion-detail__description { max-width: 34rem; margin: 0 auto; font-size: 1rem; line-height: 1.55; text-align: center; }
@media (max-width: 380px) {
  .promotion-card { grid-template-columns: 44px minmax(0, 1fr) minmax(74px, auto); gap: 8px; padding: 9px; }
  .promotion-card__icon { width: 42px; height: 42px; }
  .promotion-card__icon svg { width: 40px; height: 40px; }
  .promotion-card__price { min-width: 74px; padding-inline: 5px; font-size: .8rem; }
  .promotion-card__copy strong { font-size: .9rem; }
}

/* Telegram content controls and device cutouts are reported by its SDK. */
html[data-telegram-mini-app="true"] {
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--telegram-bottom, 0px));
}
html[data-telegram-mini-app="true"] .app-shell {
  padding-top: calc(24px + max(env(safe-area-inset-top, 0px), var(--telegram-top, 0px)));
  padding-left: max(clamp(18px, 4vw, 64px), var(--telegram-left, 0px));
  padding-right: max(clamp(18px, 4vw, 64px), var(--telegram-right, 0px));
}
html[data-telegram-mini-app="true"] .version-badge {
  top: calc(7px + max(env(safe-area-inset-top, 0px), var(--telegram-top, 0px)));
}
html[data-telegram-mini-app="true"] .app-menu {
  padding-bottom: calc(8px + var(--safe-bottom));
  padding-left: max(12px, var(--telegram-left, 0px));
  padding-right: max(12px, var(--telegram-right, 0px));
}
html[data-telegram-mini-app="true"] .more-view {
  padding-bottom: calc(96px + var(--safe-bottom));
}

/* Telegram keyboard frees the navigation space only on the chat screen. */
html[data-telegram-mini-app="true"][data-chat-keyboard="true"]:has(.chat-view:not([hidden])) .app-menu { display: none !important; }
html[data-telegram-mini-app="true"] [data-auth-card] [data-phone-form],
html[data-telegram-mini-app="true"] [data-auth-card] [data-auth-methods],
html[data-telegram-mini-app="true"] [data-auth-card] [data-phone-intro] { display: none !important; }
html[data-telegram-mini-app="true"] [data-telegram-auth] {
  display: grid !important;
  width: min(100%, 360px);
  justify-items: center;
  gap: 30px;
  margin-top: 18px;
}
html[data-telegram-mini-app="true"] [data-telegram-login] { width: 100%; }

/* A portrait keyboard can trigger the landscape media query without a device rotation. */
html[data-chat-keyboard="true"] .app-shell:has(.chat-view:not([hidden])) {
  position: fixed;
  top: var(--chat-viewport-top, 0px);
  left: 0;
  right: 0;
  width: 100%;
  height: var(--chat-viewport-height, 100dvh);
  transform: none;
  overflow: hidden;
  padding-inline: 0;
  padding-bottom: var(--chat-bottom-clearance, 16px);
}
html[data-telegram-mini-app="true"] .app-shell:has(.chat-view:not([hidden])) {
  padding-inline: 0;
}

/* Inert saved rendering covers only the frame while the live history loads. */
.chat-display-cache { position:absolute; inset:0; width:100%; height:100%; border:0; pointer-events:none; z-index:2; }

/* News keeps its loaded iframe while switching views, like the chat. */
html:has(.news-view:not([hidden])),body:has(.news-view:not([hidden])){overflow:hidden;overscroll-behavior:none}
body:has(.news-view:not([hidden])){position:fixed;inset:0}
.app-shell:has(.news-view:not([hidden])){position:fixed;inset:0;width:100%;max-width:none;height:100dvh;min-height:0;box-sizing:border-box;overflow:hidden;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr);padding-inline:0!important;padding-bottom:var(--news-bottom-clearance,108px)}
.app-shell:has(.news-view:not([hidden]))>.version-badge{display:none!important}
.app-card.news-view{width:100%;max-width:none;min-height:0;height:100%;padding-inline:0;padding-bottom:0;grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr);align-content:stretch;gap:16px;overflow:hidden}
.news-view>h1{padding-inline:clamp(18px,4vw,64px);margin:0;font-size:clamp(27px,5vw,36px)}
.news-view iframe{display:block;width:100%;height:100%;min-height:0;border:0;border-radius:0}

[data-shift-title] {
  color: var(--fg);
}

/* Keep the staff section on the standard 16px spacing rhythm. */
.bonus-qr:has(> [data-shift-staff]:not([hidden])) {
  margin-top: 16px;
  gap: 16px;
}
[data-shift-staff] {
  display: grid;
  gap: 8px;
}
[data-shift-staff][hidden] { display: none; }
[data-shift-staff] p { margin: 0; }

/* More: halve the heading-to-list spacing. */
.app-view[data-view="more"] { gap: 8px; }
.app-view[data-view="more"] > h1 { margin-bottom: 4px; }
.app-view[data-view="more"] > .more-menu-list { margin-top: 11px; }
.app-shell:not(:has(> [data-bonus-card]:not([hidden]))) > .version-badge { display: none !important; }

/* Accent only the staff names; role labels and heading keep their colors. */
[data-shift-name] { color: var(--menu-active-accent); }
