:root {
  --auth-bg: #111a26;
  --auth-panel: #172231;
  --auth-border: #2a3a4d;
  --auth-text: #edf4ff;
  --auth-muted: #8fa1b7;
  --auth-accent: #ff5957;
  --auth-good: #42d3a0;
}

.auth-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex: 0 0 auto;
}

.auth-actions button {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--auth-border);
  border-radius: 4px;
  background: transparent;
  color: var(--auth-text);
  font: 600 14px/1 system-ui, "Microsoft YaHei", sans-serif;
  cursor: pointer;
}

.auth-actions .auth-register-btn {
  border-color: #9c373b;
  background: #572329;
  color: #fff;
}

.auth-actions .auth-user {
  border-color: rgba(66, 211, 160, .72);
  background: linear-gradient(180deg, rgba(66, 211, 160, .11), rgba(66, 211, 160, .035));
  color: var(--auth-good);
  box-shadow: inset 0 0 0 1px rgba(66, 211, 160, .08);
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease, transform .18s ease;
}

.auth-actions .auth-user:hover,
.auth-actions .auth-user:focus-visible {
  border-color: #62e4b7;
  background: linear-gradient(180deg, rgba(66, 211, 160, .19), rgba(66, 211, 160, .07));
  box-shadow: 0 0 0 3px rgba(66, 211, 160, .11), inset 0 0 0 1px rgba(98, 228, 183, .18);
  outline: none;
  transform: translateY(-1px);
}

.contact-support-entry {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 146px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(74, 194, 255, .5);
  border-radius: 7px;
  background: linear-gradient(145deg, rgba(36, 160, 216, .18), rgba(65, 211, 160, .08));
  color: #dff6ff;
  box-shadow: inset 0 0 0 1px rgba(103, 216, 255, .05), 0 8px 24px rgba(0, 0, 0, .12);
  font: 700 12px/1 system-ui, "Microsoft YaHei", sans-serif;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease, transform .18s ease;
}

.contact-support-entry > span {
  color: #52d8ff;
  font-size: 16px;
  line-height: 1;
}

.contact-support-entry:hover,
.contact-support-entry:focus-visible {
  border-color: #75dcff;
  background: linear-gradient(145deg, rgba(36, 160, 216, .28), rgba(65, 211, 160, .13));
  box-shadow: 0 0 0 3px rgba(73, 196, 245, .1), 0 10px 28px rgba(0, 0, 0, .2);
  outline: none;
  transform: translateY(-1px);
}

html.contact-support-open,
html.contact-support-open body {
  overflow: hidden !important;
}

.contact-support-modal {
  position: fixed;
  inset: 0;
  z-index: 10060;
  display: grid;
  place-items: center;
  padding: 24px;
  box-sizing: border-box;
  background: rgba(2, 8, 15, .78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.contact-support-modal[hidden] { display: none; }

.contact-support-card {
  position: relative;
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  box-sizing: border-box;
  padding: 22px 24px 20px;
  border: 1px solid rgba(84, 196, 255, .42);
  border-radius: 18px;
  background:
    radial-gradient(circle at 12% 0%, rgba(51, 190, 241, .18), transparent 35%),
    radial-gradient(circle at 92% 95%, rgba(68, 215, 166, .12), transparent 34%),
    linear-gradient(160deg, #101d2b 0%, #0b1521 55%, #08111b 100%);
  color: #edf8ff;
  box-shadow: 0 28px 90px rgba(0, 0, 0, .58), inset 0 1px 0 rgba(255, 255, 255, .05);
  animation: contactSupportIn .2s ease-out both;
}

.contact-support-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.contact-support-head > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #82dfff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
}

.contact-support-head > span i,
.contact-support-foot span i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #49d8ad;
  box-shadow: 0 0 12px rgba(73, 216, 173, .85);
}

.contact-support-head button {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(139, 183, 211, .24);
  border-radius: 10px;
  background: rgba(255, 255, 255, .035);
  color: #a9bfd1;
  font-size: 23px;
  line-height: 1;
  cursor: pointer;
}

.contact-support-head button:hover,
.contact-support-head button:focus-visible {
  border-color: rgba(99, 212, 255, .62);
  color: #fff;
  outline: none;
}

.contact-support-copy { text-align: center; }
.contact-support-copy small { color: #4fd4b1; font-size: 10px; font-weight: 900; letter-spacing: .18em; }
.contact-support-copy h2 { margin: 5px 0 7px; font-size: 25px; line-height: 1.25; letter-spacing: .02em; }
.contact-support-copy p { margin: 0 auto; max-width: 330px; color: #9db2c4; font-size: 13px; line-height: 1.65; }

.contact-support-qr-shell {
  width: fit-content;
  margin: 18px auto 12px;
  padding: 10px;
  border: 1px solid rgba(87, 202, 244, .28);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(255, 255, 255, .09), rgba(255, 255, 255, .025));
  box-shadow: 0 14px 42px rgba(0, 0, 0, .3);
}

.contact-support-qr-viewport {
  width: 270px;
  height: 270px;
  overflow: hidden;
  border-radius: 15px;
  background: #fff;
}

.contact-support-qr-viewport img {
  display: block;
  width: 620px;
  max-width: none;
  height: 360px;
  transform: translate(-180px, -50px);
  user-select: none;
  pointer-events: none;
}

.contact-support-scan-tip { text-align: center; }
.contact-support-scan-tip strong { display: block; color: #f4fbff; font-size: 15px; }
.contact-support-scan-tip span { display: block; margin-top: 5px; color: #8fa7b9; font-size: 12px; }

.contact-support-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  margin-top: 17px;
  padding-top: 14px;
  border-top: 1px solid rgba(113, 157, 188, .14);
  color: #87a2b6;
  font-size: 11px;
}

.contact-support-foot span { display: inline-flex; align-items: center; gap: 6px; }
.contact-support-foot b { color: #bcd0df; font-weight: 700; }

@keyframes contactSupportIn {
  from { opacity: 0; transform: translateY(10px) scale(.975); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

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

.auth-dialog {
  width: min(430px, calc(100vw - 32px));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--auth-border);
  border-radius: 6px;
  background: var(--auth-bg);
  color: var(--auth-text);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .5);
}

.auth-dialog::backdrop { background: rgba(2, 7, 12, .74); }
.auth-dialog [hidden] { display: none !important; }
.auth-dialog-card { padding: 22px; }
.auth-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.auth-dialog-head h2 { margin: 0 0 5px; font-size: 22px; letter-spacing: 0; }
.auth-dialog-head p { margin: 0; color: var(--auth-muted); font-size: 13px; }
.auth-dialog-close { width: 34px; height: 34px; border: 1px solid var(--auth-border); border-radius: 4px; background: transparent; color: var(--auth-muted); font-size: 22px; cursor: pointer; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 18px; border: 1px solid var(--auth-border); }
.auth-tabs button { height: 38px; border: 0; border-right: 1px solid var(--auth-border); background: transparent; color: var(--auth-muted); font-weight: 700; cursor: pointer; }
.auth-tabs button:last-child { border-right: 0; }
.auth-tabs button.active { background: #542229; color: #fff; }
.auth-form { display: grid; gap: 13px; }
.auth-field { display: grid; gap: 7px; }
.auth-field > span { color: #b8c6d8; font-size: 13px; }
.auth-field input { width: 100%; height: 42px; box-sizing: border-box; border: 1px solid var(--auth-border); border-radius: 4px; background: #0c141f; color: var(--auth-text); padding: 0 12px; font-size: 15px; outline: none; }
.auth-field input:focus { border-color: var(--auth-accent); box-shadow: 0 0 0 2px rgba(255, 89, 87, .12); }
.auth-password-control { display: flex; gap: 8px; }
.auth-password-control input { min-width: 0; flex: 1; }
.auth-password-control button { flex: 0 0 auto; min-width: 54px; border: 1px solid var(--auth-border); border-radius: 4px; background: #172231; color: var(--auth-text); font-weight: 700; cursor: pointer; }
.auth-captcha-row { display: grid; grid-template-columns: 1fr 140px 36px; gap: 8px; align-items: end; }
.auth-captcha-image { width: 140px; height: 42px; object-fit: cover; border: 1px solid var(--auth-border); border-radius: 4px; background: #0c141f; }
.auth-captcha-refresh { width: 36px; height: 42px; border: 1px solid var(--auth-border); border-radius: 4px; background: #172231; color: var(--auth-text); cursor: pointer; font-size: 18px; }
.auth-channel-note { padding: 9px 10px; border-left: 3px solid #d49e43; background: rgba(212, 158, 67, .09); color: #d6c49e; font-size: 13px; }
.auth-runtime-note { margin: 0; padding: 9px 10px; border-left: 3px solid #42d3a0; background: rgba(66, 211, 160, .09); color: #b9e9d7; font-size: 12px; line-height: 1.55; }
.auth-submit { height: 44px; border: 1px solid #a63c40; border-radius: 4px; background: #762a31; color: #fff; font-size: 15px; font-weight: 800; cursor: pointer; }
.auth-submit:disabled { opacity: .55; cursor: wait; }
.auth-message { min-height: 20px; color: #ff7775; font-size: 13px; }
.auth-message.good { color: var(--auth-good); }
.auth-privacy { margin: 0; color: var(--auth-muted); font-size: 12px; line-height: 1.6; }
.auth-privacy a { color: var(--auth-accent); text-underline-offset: 2px; }

html[data-theme="light"] .auth-dialog,
body.theme-light .auth-dialog {
  --auth-bg: #fff;
  --auth-panel: #f5f7fa;
  --auth-border: #cfd8e3;
  --auth-text: #152233;
  --auth-muted: #65748a;
}

html[data-theme="light"] .auth-field input,
body.theme-light .auth-field input { background: #f7f9fc; }

html[data-theme="light"] .auth-password-control button,
body.theme-light .auth-password-control button { background: #f7f9fc; }

@media (max-width: 1100px) {
  .auth-actions { gap: 5px; }
  .auth-actions button { padding: 0 9px; font-size: 13px; }
}

@media (max-width: 767px) {
  .auth-dialog {
    width: min(390px, calc(100vw - 24px));
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    border-radius: 16px;
  }
  .auth-dialog-card { padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
  .auth-dialog-head { margin-bottom: 14px; }
  .auth-dialog-head h2 { font-size: 20px; }
  .auth-dialog-close { flex: 0 0 38px; width: 38px; height: 38px; border-radius: 10px; }
  .auth-tabs { border-radius: 10px; overflow: hidden; }
  .auth-tabs button { height: 44px; }
  .auth-field input { height: 48px; font-size: 16px; }
  .auth-captcha-row { grid-template-columns: minmax(0, 1fr) 112px 42px; }
  .auth-captcha-image { width: 112px; height: 48px; }
  .auth-captcha-refresh { width: 42px; height: 48px; }
  .auth-submit { height: 50px; border-radius: 10px; font-size: 17px; }
}

.money-flow-tutorial-entry {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
  border: 1px solid #2da9ff;
  background: linear-gradient(145deg, #075e9c 0%, #118fdc 48%, #25b7ff 100%);
  color: #fff;
  font-family: system-ui, "Microsoft YaHei", sans-serif;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 0 0 3px rgba(32, 174, 255, .12), 0 0 22px rgba(28, 170, 255, .34), inset 0 0 18px rgba(255, 255, 255, .13);
}

.money-flow-tutorial-entry:hover,
.money-flow-tutorial-entry:focus-visible {
  border-color: #78d8ff;
  filter: brightness(1.08);
  outline: none;
}

.money-flow-tutorial-entry-pc {
  flex: 0 0 122px;
  min-width: 122px;
  height: 46px;
  margin-left: 12px;
  border-radius: 7px;
}

.money-flow-tutorial-entry-mobile { display: none; }

.money-flow-tutorial-play {
  width: 25px;
  height: 25px;
  flex: 0 0 25px;
  border: 1px solid rgba(255, 255, 255, .82);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .11);
}

.money-flow-tutorial-play::after {
  content: "";
  display: block;
  width: 0;
  height: 0;
  margin: 7px 0 0 9px;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 8px solid #fff;
}

.money-flow-tutorial-copy { display: grid; gap: 2px; text-align: left; line-height: 1; }
.money-flow-tutorial-copy small { color: #d8f3ff; font-size: 10px; font-weight: 700; }
.money-flow-tutorial-copy strong { color: #fff; font-size: 14px; white-space: nowrap; }
.money-flow-tutorial-entry > i {
  position: absolute;
  top: -7px;
  right: -7px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 2px solid #0b1724;
  border-radius: 50%;
  background: #ff4f73;
  color: #fff;
  font-size: 10px;
  font-style: normal;
  line-height: 1;
}

.profile-head .money-flow-tutorial-entry-pc { margin-left: auto; }
.profile-guest > .money-flow-tutorial-entry-pc { align-self: center; justify-self: center; margin-left: 0; }

@media (min-width: 1101px) {
  .app-header:has(> .money-flow-tutorial-entry-pc) {
    grid-template-columns: auto minmax(360px, 1fr) auto 122px auto;
  }
  .app-header > .money-flow-tutorial-entry-pc { margin-left: 0; }

  .stock-evidence-topbar:has(> .money-flow-tutorial-entry-pc) {
    grid-template-columns: auto minmax(360px, 1fr) auto 122px auto;
  }
  .stock-evidence-topbar > .money-flow-tutorial-entry-pc { margin-left: 0; }
}

@media (min-width: 768px) and (max-width: 1100px) {
  .app-header:has(> .money-flow-tutorial-entry-pc) {
    grid-template-columns: auto minmax(0, 1fr) auto minmax(136px, auto);
    column-gap: 8px;
    row-gap: 8px;
  }

  .app-header > .brand {
    grid-column: 1;
    grid-row: 1;
  }

  .app-header > .header-status {
    grid-column: 4;
    grid-row: 1;
    justify-self: end;
    text-align: right;
    white-space: nowrap;
  }

  .app-header > .header-nav {
    grid-column: 1 / 3;
    grid-row: 2;
    min-width: 0;
    gap: 4px;
  }

  .app-header > .auth-actions {
    grid-column: 3;
    grid-row: 2;
  }

  .app-header > .money-flow-tutorial-entry-pc {
    grid-column: 4;
    grid-row: 2;
    justify-self: end;
    min-width: 104px;
    flex-basis: 104px;
    margin-left: 0;
  }

  .app-header > .header-nav a {
    padding-inline: 8px;
    white-space: nowrap;
  }
}

@media (min-width: 1280px) {
  .contact-support-entry { display: inline-flex; }
  .app-header:has(> .contact-support-entry):has(> .money-flow-tutorial-entry-pc) {
    grid-template-columns: auto minmax(360px, 1fr) auto auto 122px auto;
  }
}

.global-tutorial-onboarding {
  position: fixed;
  inset: 0;
  z-index: 10040;
  pointer-events: auto;
  touch-action: none;
  overscroll-behavior: contain;
}

html.global-tutorial-onboarding-open,
html.global-tutorial-onboarding-open body {
  overflow: hidden !important;
  overscroll-behavior: none;
}

.global-tutorial-spotlight {
  position: fixed;
  z-index: 10041;
  border: 2px solid #4dc9ff;
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(2, 9, 17, .78), 0 0 32px rgba(47, 189, 255, .9);
  pointer-events: none;
}

.global-tutorial-callout {
  position: fixed;
  z-index: 10043;
  width: min(360px, calc(100vw - 24px));
  box-sizing: border-box;
  padding: 18px;
  border: 1px solid #2d7fae;
  border-radius: 12px;
  background: #0a1a29;
  color: #eef8ff;
  box-shadow: 0 22px 70px rgba(0, 0, 0, .58);
  pointer-events: auto;
}

.global-tutorial-callout > small { color: #49d8c3; font-weight: 800; }
.global-tutorial-callout h2 { margin: 6px 28px 6px 0; font-size: 21px; }
.global-tutorial-callout p { margin: 0 0 14px; color: #a9bfd2; font-size: 13px; line-height: 1.6; }
.global-tutorial-callout > div { display: flex; justify-content: flex-end; gap: 9px; }
.global-tutorial-callout > div button { min-height: 38px; padding: 0 14px; border: 1px solid #31516f; border-radius: 8px; background: #102438; color: #d8e8f7; font-weight: 800; cursor: pointer; }
.global-tutorial-callout > div button:last-child { border-color: #27bce9; background: #0879ad; color: #fff; }
.global-tutorial-onboarding-close { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border: 0; background: transparent; color: #90a9bd; font-size: 22px; cursor: pointer; }
.global-tutorial-target { position: relative !important; z-index: 10042 !important; pointer-events: auto !important; }
.global-tutorial-onboarding-retargeting .global-tutorial-spotlight,
.global-tutorial-onboarding-retargeting .global-tutorial-callout { visibility: hidden; }

@media (max-width: 1100px) and (min-width: 768px) {
  .money-flow-tutorial-entry-pc { flex-basis: 104px; min-width: 104px; margin-left: 6px; }
  .money-flow-tutorial-copy small { display: none; }
  .money-flow-tutorial-copy strong { font-size: 12px; }
}

@media (max-width: 767px) {
  .money-flow-tutorial-entry-pc { display: none !important; }
  .money-flow-tutorial-entry-mobile {
    display: inline-flex;
    width: 124px;
    min-width: 124px;
    height: 52px;
    margin: 0;
    border-radius: 12px;
  }
  .money-flow-tutorial-entry-mobile .money-flow-tutorial-play { width: 28px; height: 28px; flex-basis: 28px; }
  .money-flow-tutorial-entry-mobile .money-flow-tutorial-play::after { margin: 8px 0 0 10px; }
  .money-flow-tutorial-entry-mobile .money-flow-tutorial-copy small { font-size: 10px; }
  .money-flow-tutorial-entry-mobile .money-flow-tutorial-copy strong { font-size: 14px; }

  .mf-mobile-header.has-tutorial-entry {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    align-items: center !important;
    gap: 8px 10px !important;
    height: auto !important;
    min-height: 108px;
  }
  .mf-mobile-header.has-tutorial-entry > div:first-child { grid-column: 1; grid-row: 1; min-width: 0; }
  .mf-mobile-header.has-tutorial-entry > .money-flow-tutorial-entry-mobile { grid-column: 2; grid-row: 1; }
  .mf-mobile-header.has-tutorial-entry > .mf-mobile-header-actions {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    min-width: 0;
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
  }

  .global-tutorial-callout { padding: 16px; }
  .global-tutorial-callout h2 { font-size: 19px; }
}
