/* Avatar color: HSL background + foreground.
   Pattern: style="background:hsl(N, 60%, 50%); color: var(--on-accent, #fff);"
   Where N is a hash of the user's name for visual differentiation. */

/* === Cookie banner === */
.bp-cookie {
  position: fixed; left: 16px; right: 16px; bottom: 16px;
  background: var(--bg-elev, #fff); border: 1px solid var(--border);
  border-radius: var(--radius-xl, 14px); box-shadow: 0 12px 36px -8px rgba(0,0,0,.18);
  z-index: 100;
  transform: translateY(120%); opacity: 0;
  transition: transform .35s ease, opacity .35s ease;
  max-width: 720px; margin: 0 auto;
}
.bp-cookie[data-state="shown"] { transform: translateY(0); opacity: 1; }
.bp-cookie__inner { display: flex; align-items: center; gap: 16px; padding: 16px 20px; flex-wrap: wrap; }
.bp-cookie__icon { width: 48px; height: 48px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; background: color-mix(in oklab, var(--accent) 10%, var(--bg-elev)); color: var(--accent); border-radius: 50%; }
.bp-cookie__body { flex: 1; min-width: 220px; }
.bp-cookie__title { margin: 0 0 4px; font-size: 15px; font-weight: 700; color: var(--fg); }
.bp-cookie__text { margin: 0; font-size: 13px; line-height: 1.5; color: var(--fg-subtle); }
.bp-cookie__actions { display: flex; gap: 8px; flex-shrink: 0; }
@media (max-width: 540px) {
  .bp-cookie__inner { padding: 14px; }
  .bp-cookie__icon { display: none; }
  .bp-cookie__actions { width: 100%; justify-content: flex-end; }
}
/* Клиренс над мобильным таб-баром — только когда присутствует app-shell
   (body.bp-has-shell). На публичном лендинге таб-бара нет, поэтому базовый
   bottom:16px там сохраняется без лишнего зазора. */
@media (max-width: 780px) {
  .bp-has-shell .bp-cookie { bottom: var(--bottom-fixed-clearance); }
}

/* === Feedback button === */
.bp-feedback {
  position: fixed; right: 20px; bottom: 20px; z-index: 80;
}
.bp-feedback__trigger {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--accent); color: var(--accent-fg, #fff);
  border: none; cursor: pointer;
  box-shadow: 0 10px 24px -6px color-mix(in oklab, var(--accent) 40%, transparent);
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform .2s ease, box-shadow .2s ease;
}
.bp-feedback__trigger:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 14px 30px -6px color-mix(in oklab, var(--accent) 55%, transparent); }
.bp-feedback__panel {
  position: absolute; right: 0; bottom: 56px;
  width: 340px; max-width: calc(100vw - 32px);
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-xl, 14px);
  box-shadow: 0 18px 48px -8px rgba(0,0,0,.22);
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 12px;
}
.bp-feedback__head { display: flex; align-items: center; justify-content: space-between; }
.bp-feedback__title { margin: 0; font-size: 15px; font-weight: 700; color: var(--fg); }
.bp-feedback__close { background: transparent; border: none; cursor: pointer; color: var(--fg-subtle); font-size: 16px; width: 28px; height: 28px; border-radius: 8px; }
.bp-feedback__close:hover { background: var(--bg-subtle); color: var(--fg); }
.bp-feedback__form { display: flex; flex-direction: column; gap: 12px; }
.bp-feedback__form .bp-field { gap: 6px; display: flex; flex-direction: column; }
.bp-feedback__form .bp-field__label { font-size: 12.5px; font-weight: 500; color: var(--fg); }
.bp-feedback__form .bp-input {
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--fg);
  font-family: inherit;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.bp-feedback__form .bp-input:focus,
.bp-feedback__form .bp-input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.bp-feedback__form textarea.bp-input,
.bp-feedback__form .bp-input--textarea {
  min-height: 96px;
  padding: 10px 12px;
  line-height: 1.5;
  resize: vertical;
}
.bp-feedback__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.bp-feedback__hint { font-size: 11px; color: var(--fg-subtle); flex: 1; min-width: 0; }
.bp-feedback__success { color: var(--ok); font-size: 13px; font-weight: 600; padding: 8px; background: color-mix(in oklab, var(--ok) 10%, var(--bg-elev)); border-radius: 8px; text-align: center; }

@media (max-width: 540px) {
  /* AUDIT B-8: mobile tab-bar занимает y=754..812 (высота ~58px). Поднимаем
     float-кнопку фидбэка над ним, иначе она перекрывает 5-ю вкладку «Ещё». */
  .bp-feedback { right: 16px; bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
  .bp-feedback__panel { right: -8px; }
}
/* Если у юзера нет shell-обвязки (public layout) — оставляем стандартный отступ. */
body.bp-public .bp-feedback { bottom: 16px; }

/* Hide feedback button when printing or on public-event */
@media print { .bp-feedback, .bp-cookie { display: none !important; } }
body.is-public-event .bp-feedback { display: none; }

/* QA-63: feedback button hides when sticky pay CTA visible */
body:has(.bp-pe-sticky:not(.is-hidden)) .bp-feedback { display: none; }
@media (max-width: 880px) {
  /* On mobile, raise feedback above potential other fixed elements */
  .bp-feedback { z-index: 70; }
}

/* === Error pages === */
.bp-errpage {
  min-height: 70vh; display: flex; align-items: center; justify-content: center; padding: 32px 20px;
}
.bp-errpage__card {
  max-width: 480px; text-align: center; padding: 40px 32px;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-xl, 14px);
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.bp-errpage__visual { line-height: 0; }
.bp-errpage__title { margin: 0; font-size: 22px; font-weight: 700; color: var(--fg); }
.bp-errpage__text { margin: 0; font-size: 14px; line-height: 1.55; color: var(--fg-subtle); max-width: 380px; }
.bp-errpage__actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }

/* === Print styles === */
@media print {
  body { background: white !important; color: black !important; font-family: Inter, system-ui, sans-serif; }
  .bp-sidebar, .bp-header, .bp-topbar, .bp-tabs, .bp-feedback, .bp-cookie, button, .bp-btn--ghost { display: none !important; }
  .bp-card { box-shadow: none !important; border: 1px solid #ccc !important; break-inside: avoid; }
  a { color: black !important; text-decoration: none !important; }
  table { border-collapse: collapse !important; }
  th, td { border: 1px solid #999 !important; padding: 4px 8px !important; }
  .bp-page-break { break-before: page; }
  @page { margin: 2cm; }
}

/* === Public event: mobile sticky pay CTA === */
.bp-pe-sticky {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: none; /* Show on mobile only */
  align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--bg-elev, #fff);
  border-top: 1px solid var(--border);
  box-shadow: 0 -12px 32px -8px rgba(0,0,0,.12);
  transform: translateY(0);
  transition: transform .3s cubic-bezier(.4,0,.2,1), opacity .25s ease;
}
.bp-pe-sticky.is-hidden {
  transform: translateY(120%);
  opacity: 0;
  pointer-events: none;
}
.bp-pe-sticky__info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bp-pe-sticky__label { font-size: 11px; color: var(--fg-subtle); text-transform: uppercase; letter-spacing: .03em; font-weight: 600; }
.bp-pe-sticky__amount { font-size: 17px; font-weight: 700; color: var(--fg); font-feature-settings: "tnum"; white-space: nowrap; }
.bp-pe-sticky__cta { white-space: nowrap; flex-shrink: 0; }

@media (max-width: 880px) {
  .bp-pe-sticky { display: flex; }
  /* Add bottom padding to body so sticky doesn't cover content */
  body.bp-public { padding-bottom: 88px; }
  body.bp-public.bp-public--has-sticky-pay { padding-bottom: 88px; }
}

/* Hide on very tall mobile when keyboard is open (best-effort) */
@media (max-width: 880px) and (max-height: 480px) {
  .bp-pe-sticky { display: none; }
}

/* === Public event: improved mobile bottom-sheet for sidebar === */
@media (max-width: 880px) {
  /* If the existing sidebar is treated as bottom-sheet, ensure proper bottom-sheet styling */
  .bp-pe-aside.is-sheet, .bp-pub-event__aside.is-sheet {
    position: fixed; left: 0; right: 0; bottom: 0;
    max-height: 80vh; overflow-y: auto;
    background: var(--bg-elev);
    border-top-left-radius: 24px; border-top-right-radius: 24px;
    box-shadow: 0 -20px 50px -10px rgba(0,0,0,.25);
    padding: 12px 16px calc(20px + env(safe-area-inset-bottom, 0px));
    transform: translateY(100%);
    transition: transform .35s cubic-bezier(.4,0,.2,1);
    z-index: 70;
  }
  .bp-pe-aside.is-sheet.is-open, .bp-pub-event__aside.is-sheet.is-open {
    transform: translateY(0);
  }
  .bp-pe-aside.is-sheet::before, .bp-pub-event__aside.is-sheet::before {
    content: ''; display: block;
    width: 44px; height: 4px; border-radius: 2px;
    background: var(--border);
    margin: 0 auto 12px;
  }
}

/* === Public event: print-friendly === */
@media print {
  .bp-pe-sticky, .bp-pub-event__hero-actions, [data-bp-pe-modal], .bp-modal { display: none !important; }
}

/* === Public event: mobile hero polish === */
@media (max-width: 540px) {
  .bp-pub-event__title { font-size: 28px !important; line-height: 1.15 !important; }
  .bp-pub-event__meta { font-size: 13px !important; gap: 12px !important; }
  .bp-pub-event__hero { padding: 28px 20px 36px !important; }
}

/* === Empty states (shared partial: _partials/empty_state.html) === */
.bp-empty {
  text-align: center;
  padding: 48px 24px;
  max-width: 440px;
  margin: 0 auto;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.bp-empty--compact { padding: 24px 16px; gap: 8px; }
.bp-empty--small { padding: 32px 16px; gap: 10px; }
.bp-empty__icon {
  width: 64px; height: 64px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: color-mix(in oklab, var(--accent) 8%, var(--bg-elev));
  color: var(--accent);
}
.bp-empty--small .bp-empty__icon { width: 48px; height: 48px; }
.bp-empty--compact .bp-empty__icon { width: 40px; height: 40px; }
.bp-empty__title { margin: 0; font-size: 16px; font-weight: 700; color: var(--fg); }
.bp-empty--small .bp-empty__title,
.bp-empty--compact .bp-empty__title { font-size: 14px; }
.bp-empty__desc { margin: 0; font-size: 13px; color: var(--fg-subtle); line-height: 1.55; max-width: 360px; }
.bp-empty--compact .bp-empty__desc { font-size: 12px; }
.bp-empty__actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }

/* === Skeleton loaders (shared partial: _partials/skeleton.html) === */
@keyframes bp-skel-shimmer {
  0% { background-position: -300px 0; }
  100% { background-position: 300px 0; }
}
.bp-skel { display: flex; flex-direction: column; gap: 12px; padding: 16px 0; }
.bp-skel__line,
.bp-skel__block,
.bp-skel__cell,
.bp-skel__avatar,
.bp-skel__kpi,
.bp-skel__chart {
  background: linear-gradient(90deg,
    color-mix(in oklab, var(--border) 50%, transparent) 0%,
    color-mix(in oklab, var(--border) 90%, transparent) 50%,
    color-mix(in oklab, var(--border) 50%, transparent) 100%);
  background-size: 600px 100%;
  border-radius: 6px;
  animation: bp-skel-shimmer 1.4s infinite linear;
  display: block;
}
.bp-skel__line { height: 12px; }
.bp-skel__block { height: 64px; }
.bp-skel__cell { height: 14px; flex: 1; }
.bp-skel__cell--w-15 { max-width: 15%; }
.bp-skel__cell--w-20 { max-width: 20%; }
.bp-skel__cell--w-30 { max-width: 30%; }
.bp-skel__line--w-40 { width: 40%; }
.bp-skel__line--w-50 { width: 50%; }
.bp-skel__line--w-70 { width: 70%; }
.bp-skel__line--w-90 { width: 90%; }
.bp-skel__row { display: flex; gap: 12px; align-items: center; padding: 6px 0; }
.bp-skel__list-item { display: flex; gap: 12px; align-items: center; padding: 8px 0; }
.bp-skel__avatar { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; }
.bp-skel__lines { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.bp-skel__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.bp-skel__kpi { height: 80px; border-radius: 12px; }
.bp-skel__chart { height: 240px; border-radius: 12px; }

@media (prefers-reduced-motion: reduce) {
  .bp-skel__line,
  .bp-skel__block,
  .bp-skel__cell,
  .bp-skel__avatar,
  .bp-skel__kpi,
  .bp-skel__chart {
    animation: none;
    background: var(--border);
  }
}

/* === Event documents (public + manager) === */
.bp-event-docs .bp-card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.bp-inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.bp-doc-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid color-mix(in oklab, var(--border) 50%, transparent);
}
.bp-doc-row:last-child { border-bottom: none; }
.bp-doc-row__icon { color: var(--fg-subtle); display: inline-flex; }
.bp-doc-row__title { color: var(--fg); text-decoration: none; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bp-doc-row__title:hover { color: var(--accent); }
.bp-doc-row__kind { font-size: 11px; color: var(--fg-subtle); }

/* Public event doc rows */
.bp-pe-doc {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px;
  flex-wrap: wrap;
}
.bp-pe-doc__view { color: var(--fg); text-decoration: none; flex: 1; min-width: 0; display: inline-flex; align-items: center; gap: 10px; font-weight: 600; }
.bp-pe-doc__view:hover { color: var(--accent); }
.bp-pe-doc__view span:first-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.bp-pe-doc__kind { font-size: 11px; font-weight: 500; color: var(--fg-subtle); margin-left: 6px; padding: 2px 6px; background: var(--bg-subtle); border-radius: 6px; flex-shrink: 0; }

/* Acceptance modal */
.bp-pe-doc-modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.bp-pe-doc-modal[hidden] { display: none !important; }
.bp-pe-doc-modal__inner { background: var(--bg-elev); border-radius: var(--radius-xl, 14px); max-width: 420px; width: 100%; padding: 20px; box-shadow: 0 16px 48px rgba(0,0,0,.18); }
.bp-pe-doc-modal__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.bp-pe-doc-modal__title { margin: 0; font-size: 16px; font-weight: 700; color: var(--fg); }
.bp-pe-doc-modal__close { background: transparent; border: none; cursor: pointer; color: var(--fg-subtle); font-size: 18px; width: 28px; height: 28px; line-height: 1; }
.bp-pe-doc-modal__body { display: flex; flex-direction: column; gap: 12px; }
.bp-pe-doc-modal__hint { margin: 0; font-size: 13px; color: var(--fg-subtle); }
.bp-pe-doc-modal__phone-mask { margin: 0; font-size: 13px; color: var(--fg); font-weight: 500; }
.bp-pe-doc-modal__code { display: flex; flex-direction: column; gap: 10px; }
.bp-pe-doc-modal__input { font-size: 18px; letter-spacing: 8px; text-align: center; font-family: var(--font-mono, monospace); }
.bp-pe-doc-modal__error { color: var(--danger); font-size: 13px; padding: 8px 12px; background: color-mix(in oklab, var(--danger) 8%, var(--bg-elev)); border-radius: 8px; }
.bp-pe-doc-modal__success { color: var(--ok); font-size: 14px; font-weight: 600; padding: 12px; background: color-mix(in oklab, var(--ok) 10%, var(--bg-elev)); border-radius: 8px; text-align: center; display: inline-flex; align-items: center; gap: 6px; justify-content: center; }
.bp-text-danger { color: var(--danger); }
.bp-text-ok { color: var(--ok); }

/* QA-14: .bp-close button — visible × glyph + hover */
.bp-close {
  background: none; border: none; cursor: pointer;
  width: 28px; height: 28px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--fg-subtle); border-radius: 6px;
  font-family: inherit;
}
.bp-close:empty::before { content: "×"; font-size: 20px; line-height: 1; }
.bp-close:hover { background: var(--bg-subtle); color: var(--fg); }
.bp-close--sm { width: 22px; height: 22px; }
.bp-close--sm:empty::before { font-size: 16px; }

/* === Packages screen === */
.bp-pkg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 20px;
}
.bp-pkg-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl, 16px);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.bp-pkg-card:hover {
  border-color: color-mix(in oklab, var(--accent) 35%, var(--border));
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, .08);
}
.bp-pkg-card__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.bp-pkg-card__format {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.bp-pkg-card__title {
  font-size: 17px;
  font-weight: 700;
  color: var(--fg);
}
.bp-pkg-card__price {
  text-align: right;
  flex-shrink: 0;
}
.bp-pkg-card__amount {
  font-size: 22px;
  font-weight: 800;
  color: var(--fg);
  font-feature-settings: "tnum";
}
.bp-pkg-card__perguest {
  font-size: 11px;
  color: var(--fg-subtle);
}
.bp-pkg-card__meta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--fg-subtle);
}
.bp-pkg-card__meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.bp-pkg-card__includes {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bp-pkg-card__includes li {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  font-size: 13px;
  color: var(--fg);
}
.bp-pkg-card__includes li svg {
  color: var(--ok);
  margin-top: 3px;
  flex-shrink: 0;
}
.bp-pkg-card__calc {
  background: var(--bg-subtle);
  border-radius: 10px;
  padding: 10px 12px;
}
.bp-pkg-card__calc-label {
  font-size: 11px;
  color: var(--fg-subtle);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 6px;
}
.bp-pkg-card__calc-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bp-pkg-card__calc-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.bp-pkg-card__actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}

/* === Auth: OAuth row (visual stub) === */
.bp-auth__divider {
  display: flex; align-items: center; gap: 10px;
  color: var(--fg-subtle); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em;
  margin: 18px 0;
}
.bp-auth__divider::before, .bp-auth__divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.bp-auth__oauth { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.bp-auth__oauth-btn {
  width: 100%;
  background: var(--bg-elev); color: var(--fg);
  border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  opacity: .65; cursor: not-allowed;
}
.bp-auth__oauth-btn--yandex { background: #FC3F1D; color: #fff; border-color: #FC3F1D; }
.bp-auth__oauth-btn:not(:disabled):hover { background: var(--bg-subtle); }

/* === Public event: Next step CTA card === */
.bp-pe-next {
  display: flex; gap: 14px; align-items: center;
  background: linear-gradient(135deg, color-mix(in oklab, var(--accent) 8%, var(--bg-elev)), color-mix(in oklab, var(--accent) 4%, var(--bg-elev)));
  border: 1px solid color-mix(in oklab, var(--accent) 25%, var(--border));
  border-radius: var(--radius-xl, 14px);
  padding: 14px 18px;
  max-width: 1080px; margin: 16px auto 0;
}
.bp-pe-next__icon {
  width: 40px; height: 40px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: color-mix(in oklab, var(--accent) 15%, var(--bg-elev));
  color: var(--accent);
  border-radius: 50%;
}
.bp-pe-next__body { flex: 1; min-width: 0; }
.bp-pe-next__title { font-size: 11px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.04em; }
.bp-pe-next__text { font-size: 14px; color: var(--fg); margin-top: 2px; }
@media (max-width: 640px) {
  .bp-pe-next { flex-wrap: wrap; padding: 12px 14px; }
  .bp-pe-next__icon { display: none; }
}

/* === Submit-once spinner === */
.bp-spinner {
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: bp-spin .6s linear infinite;
  vertical-align: -2px;
}
@keyframes bp-spin { to { transform: rotate(360deg); } }
