/* Стили страниц входа и личного кабинета. Дополняют style.css. */

.auth-page,
.cabinet-page {
  min-height: 100vh;
  background: #0a0a0c;
  color: #f4f4f6;
  margin: 0;
}

/* Override the generic legacy page colors on the dark cabinet. */
body.page.cabinet-page { color: #f4f4f6; max-width: none; padding: 0; }
body.page.cabinet-page .muted { color: #a0a0b0; }

.hidden { display: none !important; }
.linklike {
  background: none;
  border: none;
  color: #9b8cff;
  cursor: pointer;
  padding: 0;
  font: inherit;
  text-decoration: underline;
}
.tiny { font-size: 12px; }

/* --- Вход --- */
body.page.auth-page {
  --bg: #ffffff;
  --text: #111111;
  --text-muted: #55585d;
  --border: #b8bbc0;
  max-width: none;
  padding: 0;
  color: var(--text);
  background: #f5f5f5;
}
body.page.auth-page .muted { color: var(--text-muted); }
body.page.auth-page a { color: #513994; text-underline-offset: 3px; }
body.page.auth-page .error { color: #b3261e; }
.auth-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: max(24px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  box-sizing: border-box;
}
body.page.auth-page .auth-card {
  width: 100%;
  min-width: 0;
  max-width: 400px;
  padding: 28px 22px;
  border-radius: 20px;
  margin: 0;
  background: #ffffff;
  border: 1px solid #e4e5e7;
  overflow-wrap: anywhere;
}
.auth-title { font-size: 22px; margin: 6px 0 14px; }
.auth-btn { width: 100%; margin-top: 14px; }
.auth-legal { margin-top: 18px; line-height: 1.6; }
body.page.auth-page .auth-btn {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 12px;
  color: #111;
  background: #ffcc00;
  font-size: 16px;
  font-weight: 700;
}
body.page.auth-page .auth-btn:hover { background: #f2c200; }
body.page.auth-page .auth-btn:disabled { opacity: .6; cursor: wait; }
.auth-legal a { color: #c2b9ff; text-underline-offset: 2px; }
.auth-secondary { margin: 14px 0 0; text-align: center; font-size: 13px; }
.auth-secondary a,
.debug-reset-link { color: #9b8cff; }
.auth-secondary a { min-height: 44px; display: inline-flex; align-items: center; }
.auth-home-link, .cabinet-home-link { display: inline-block; color: #c2b9ff; text-decoration: none; }
.auth-context { line-height: 1.55; }
.auth-context a, .cabinet-balance-note a, .cabinet-help a { color: #c2b9ff; text-underline-offset: 3px; }
.auth-page :focus-visible, .cabinet-page :focus-visible { outline: 3px solid #ffcc00; outline-offset: 3px; }
.auth-card .field-input { width: 100%; box-sizing: border-box; margin-top: 6px; }
.auth-page .field-input { min-width: 0; min-height: 48px; font-family: inherit; font-size: 16px; }
.auth-page .field-input::placeholder { color: #6b6f76; opacity: 1; }
.auth-password-label { display: block; margin-top: 14px; }
.auth-mode {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 18px;
  padding: 4px;
  border-radius: 12px;
  background: #f0f0f2;
}
.auth-mode-btn {
  min-width: 0;
  min-height: 44px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #55585d;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}
.auth-mode-btn.active {
  background: #fff;
  color: #111;
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
}

/* --- Кабинет --- */
body.page.cabinet-page .btn {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 16px;
  text-decoration: none;
}
body.page.cabinet-page .qr-scan-button,
body.page.cabinet-page .top-up-submit { color: #fff; background: #111; border-color: #111; }
body.page.cabinet-page .qr-scan-button:hover,
body.page.cabinet-page .top-up-submit:hover { background: #292929; }
.cabinet-page .field-input { min-height: 48px; font-family: inherit; font-size: 16px; }
.cabinet-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 16px;
  max-width: 720px;
  margin: 0 auto;
}
.cabinet-head-actions { display: flex; align-items: center; gap: 8px; }
.cabinet-topbar > div { min-width: 0; }
.cabinet-topbar p { overflow-wrap: anywhere; }
.cabinet-title { font-size: 22px; margin: 4px 0; }
.cabinet-main { max-width: 720px; margin: 0 auto; padding: 0 16px 40px; }
.cabinet-balance-note { margin: -4px 0 22px; line-height: 1.55; }
.cabinet-help { margin-top: 24px; padding-top: 18px; border-top: 1px solid #30303a; font-size: 13px; line-height: 1.55; }
.cabinet-help h2 { margin: 0; font-size: 18px; }
.cabinet-help p { color: #bcbcc7; }
.cabinet-help a { overflow-wrap: anywhere; }
.cabinet-help nav { display: flex; flex-wrap: wrap; gap: 16px; }
.cabinet-load-more { display: block; margin: 16px auto 0; }

.cabinet-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.stat-card {
  background: #141419;
  border: 1px solid #26262e;
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-label { font-size: 12px; opacity: 0.65; }
.stat-value { font-size: 20px; font-weight: 700; }

.cabinet-nav { margin-bottom: 14px; max-width: 100%; overflow-x: auto; }
.cabinet-nav .viewer-tab { flex-shrink: 0; }

.top-up-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, .85fr);
  gap: 24px;
  align-items: center;
  margin: 0 0 18px;
  padding: 20px;
  border-radius: 18px;
  color: #111;
  background: #ffcc00;
}
.top-up-card .card-eyebrow { color: #6a5500; }
.top-up-card h2 { margin: 4px 0 8px; font-size: 22px; }
.top-up-card p { margin: 0; color: #5b4900; line-height: 1.45; }
.event-code-form { min-width: 0; }
.event-code-form .field-label { color: #3e3200; }
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.qr-scan-button {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: #fff;
  background: #111;
  border-color: #111;
}
.qr-scan-button:hover { background: #292929; }
.qr-scan-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.event-code-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 8px;
  color: #6a5500;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.event-code-divider::before,
.event-code-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: rgba(0,0,0,.22);
}
.event-code-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 6px; }
.event-code-row .field-input { min-width: 0; color: #111; background: #fff; border-color: rgba(0,0,0,.18); }
.event-code-row .top-up-submit { color: #fff; background: #111; border-color: #111; }
.event-code-row .top-up-submit:hover { background: #292929; }
.event-code-form .form-msg { min-height: 18px; margin: 7px 0 0; }
.event-code-form .form-msg.error { color: #8f1717; }

/* --- QR-сканер --- */
.qr-scanner-sheet {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
}
.qr-scanner-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0,0,0,.78);
  cursor: pointer;
}
.qr-scanner-panel {
  position: relative;
  width: min(100%, 460px);
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  overflow: auto;
  padding: 20px;
  border: 1px solid #30303a;
  border-radius: 22px;
  background: #141419;
  box-shadow: 0 24px 80px rgba(0,0,0,.5);
}
.qr-scanner-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.qr-scanner-header h2 { margin: 4px 0 0; font-size: 20px; }
.qr-scanner-close {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border: 1px solid #3a3a44;
  border-radius: 50%;
  color: #fff;
  background: #24242b;
  cursor: pointer;
  font-size: 26px;
  line-height: 1;
}
.qr-video-frame {
  position: relative;
  min-height: 300px;
  overflow: hidden;
  border-radius: 18px;
  background: #050506;
}
.qr-video-frame video {
  width: 100%;
  height: min(56vh, 420px);
  min-height: 300px;
  display: block;
  object-fit: cover;
}
.qr-scan-region {
  position: absolute;
  width: min(64vw, 250px);
  aspect-ratio: 1;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border: 3px solid #ffcc00;
  border-radius: 20px;
  box-shadow: 0 0 0 999px rgba(0,0,0,.28);
  pointer-events: none;
}
.qr-scanner-status { min-height: 20px; margin: 12px 0; color: #c9c9d1; }
.qr-scanner-status.success { color: #8ee6a5; }
.qr-scanner-status.error { color: #ff8d8d; }
.qr-scanner-actions { display: grid; }
.qr-scanner-actions:focus-within .qr-file-button { outline: 3px solid #fff; outline-offset: 3px; }
.qr-file-button {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #111;
  background: #ffcc00;
  border-color: #ffcc00;
  cursor: pointer;
}
.qr-scanner-note { margin: 12px 0 0; line-height: 1.45; }

.cabinet-list { display: flex; flex-direction: column; gap: 10px; }
.cabinet-item {
  background: #141419;
  border: 1px solid #26262e;
  border-radius: 14px;
  padding: 12px 14px;
}
.cabinet-item-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-weight: 600;
}
.cabinet-item-amount { color: #9b8cff; white-space: nowrap; }
.cabinet-item-meta { font-size: 12px; opacity: 0.65; margin-top: 4px; }
.cabinet-item-sub { font-size: 13px; opacity: 0.8; margin-top: 6px; }
.cabinet-item-link { display: inline-block; margin-top: 10px; color: #b9a8ff; font-size: 13px; font-weight: 600; }

@media (min-width: 560px) {
  .cabinet-stats { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 620px) {
  .cabinet-topbar { flex-wrap: wrap; }
  .cabinet-head-actions { width: 100%; align-items: stretch; }
  .cabinet-head-actions .btn { flex: 1; padding: 0.5rem 0.7rem; }
  .top-up-card { grid-template-columns: 1fr; gap: 16px; }
}

@media (max-width: 390px) {
  .event-code-row { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .qr-scanner-sheet { align-items: end; padding: 0; }
  .qr-scanner-panel {
    width: 100%;
    max-height: 94vh;
    max-height: 94dvh;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
    border-radius: 24px 24px 0 0;
  }
  .qr-video-frame,
  .qr-video-frame video { min-height: 260px; }
}
