/* Canonical CSS owner: auth. Historical layers consolidated 2026-08-02. */
.auth-gate {
  position: fixed;

  inset: 0px;

  z-index: 1000;

  display: grid;

  place-items: center;

  padding: 20px;

  background: var(--canvas);
}

.auth-gate[hidden] {
  display: none;
}

.auth-shell {
  width: calc(-40px + 100vw);

  max-width: 420px;

  padding: 26px;

  border: 1px solid var(--border-strong);

  border-radius: 12px;

  background: var(--surface);

  box-shadow: var(--shadow-raised);
}

.auth-brand {
  display: flex;

  align-items: center;

  gap: 12px;
}

.auth-brand h1 {
  margin: 0px;

  font-size: var(--font-size-page-title);

  font-weight: var(--font-weight-semibold);
}

.auth-brand span {
  display: block;

  margin-top: 5px;

  color: var(--text-3);

  font-size: var(--font-size-caption);
}

.auth-tabs {
  display: grid;

  grid-template-columns: 1fr 1fr;

  margin-top: 24px;

  border-bottom: 1px solid var(--line);
}

.auth-tab {
  min-height: 40px;

  border-width: 0px 0px 2px;

  border-style: none none solid;

  border-color: currentcolor currentcolor transparent;

  border-image: none;

  background: transparent;

  color: var(--text-muted);

  cursor: pointer;
}

.auth-tab.active {
  border-bottom-color: var(--action);

  color: var(--text-1);

  font-weight: var(--font-weight-semibold);
}

.auth-form {
  display: grid;

  gap: 14px;

  margin-top: 20px;
}

.auth-form .button {
  width: 100%;

  min-height: 32px;
}

.auth-error {
  margin: 0px;

  color: var(--market-up);

  font-size: var(--font-size-caption);

  line-height: 1.5;
}

.admin-dialog {
  width: min(1060px, -24px + 100vw);
}

.admin-section-picker {
  display: grid;

  grid-template-columns: 96px minmax(220px, 360px);

  align-items: center;

  gap: 12px;

  padding: 16px 18px;
}

.admin-section-picker label {
  color: var(--text-secondary);

  font-size: 13px;

  font-weight: 700;
}

.admin-section-picker select {
  width: 100%;

  min-height: 32px;

  padding: 0px 11px;

  border: 1px solid var(--border-strong);

  border-radius: 8px;

  background: var(--surface);

  color: var(--text-primary);

  font-size: var(--font-size-label);
}

.admin-section-picker select:focus-visible {
  outline: 2px solid var(--action);

  outline-offset: 2px;
}

.admin-panel[hidden] {
  display: none;
}

.admin-inline-actions {
  display: flex;

  justify-content: space-between;

  gap: 10px;
}

.admin-dialog > form,
.settings-section > form {
  padding: 0px;
}

.settings-lead {
  margin: 0px;

  color: var(--text-secondary);

  font-size: 13px;

  line-height: 1.65;
}

.membership-usage {
  margin-top: 12px;

  color: var(--text-muted);

  font-size: 12px;
}

.switch-control {
  display: flex;

  align-items: center;

  gap: 9px;

  margin-top: 13px;

  color: var(--text-secondary);

  font-size: 13px;

  font-weight: 650;
}

.compact-number-field {
  width: min(260px, 100%);

  margin-top: 14px;
}

.admin-users-list {
  display: grid;

  border-top: 1px solid var(--line);
}

.admin-user-row {
  min-width: 0px;

  display: grid;

  grid-template-columns: 160px 100px minmax(0px, 1fr);

  align-items: center;

  gap: 14px;

  padding: 13px 0px;

  border-bottom: 1px solid var(--line);
}

.admin-user-identity strong {
  display: block;

  color: var(--text-primary);

  font-size: 13px;
}

.admin-user-identity small,
.admin-user-identity span {
  display: block;

  margin-top: 4px;

  color: var(--text-muted);

  font-size: 11px;
}

.admin-user-usage {
  margin-top: 4px;

  color: var(--text-muted);

  font-size: 11px;
}

.membership-form {
  padding: 0px;

  min-width: 0px;

  display: grid;

  grid-template-columns: 100px minmax(170px, 0.8fr) minmax(160px, 1fr) auto;

  align-items: end;

  gap: 8px;
}

.membership-form label {
  min-width: 0px;

  display: grid;

  gap: 5px;
}

.membership-form label span {
  color: var(--text-muted);

  font-size: 10px;
}

.membership-form input,
.membership-form select {
  width: 100%;

  min-width: 0px;

  height: 32px;

  padding: 0px 8px;

  border: 1px solid var(--border-strong);

  border-radius: 8px;

  background: var(--surface);
}

.membership-expiry {
  min-width: 0px;

  display: grid;

  gap: 5px;

  align-self: end;
}

.membership-expiry span {
  color: var(--text-muted);

  font-size: 10px;
}

.membership-expiry strong {
  min-height: 34px;

  display: flex;

  align-items: center;

  color: var(--text-secondary);

  font-size: 12px;

  font-weight: 650;
}

@media (max-width: 820px) {
  .admin-user-row {
    grid-template-columns: 1fr auto;
  }

  .admin-user-row .membership-form {
    grid-column: 1 / -1;
  }

  .membership-form {
    grid-template-columns: repeat(2, minmax(0px, 1fr));
  }

  .membership-form .button {
    align-self: end;
  }
}

@media (max-width: 600px) {

  .membership-form {
    grid-template-columns: minmax(0px, 1fr);
  }
}

.connection-status {
  margin: 18px 18px 0px;

  padding: 10px 12px;

  border: 1px solid var(--line);

  border-radius: 4px;

  background: var(--surface-muted);
}

.connection-status.connected {
  border-color: var(--market-down);

  background: var(--green-soft);

  color: var(--market-down);
}

.settings-dialog form {
  padding: 18px;
}

.settings-dialog .membership-form,
.settings-dialog .settings-section > form,
.settings-dialog.admin-dialog > form {
  padding: 0px;
}

.settings-section {
  padding: 18px;

  border-top: 1px solid var(--line);
}

.settings-section h3 {
  margin: 0px 0px 12px;

  font-size: 15px;
}

.settings-section-heading {
  display: flex;

  align-items: baseline;

  justify-content: space-between;

  gap: 12px;
}

.settings-section-heading span {
  color: var(--text-muted);

  font-size: 12px;
}

.account-birth-form {
  display: grid;

  grid-template-columns: 1fr 0.8fr 0.7fr;

  gap: 10px;
}

.account-birth-form .dialog-actions {
  grid-column: 1 / -1;
}

.backfill-controls {
  display: grid;

  grid-template-columns: 1fr 1fr;

  gap: 10px;
}

@media (max-width: 600px) {
  .admin-inline-actions {
    align-items: stretch;

    flex-direction: column;
  }
}

.form-hint {
  margin: 10px 0px 0px;

  color: var(--text-muted);

  font-size: 12px;

  line-height: 1.6;
}

.admin-refresh-status {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.55;
}

.admin-refresh-status svg {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  margin-top: 2px;
}

.admin-refresh-status[data-tone="running"] { color: var(--primary); }
.admin-refresh-status[data-tone="success"] { color: var(--down); }
.admin-refresh-status[data-tone="warning"] { color: var(--warning); }
.admin-refresh-status[data-tone="failure"] { color: var(--up); }

.account-button > span {
  flex: 0 0 auto;

  min-width: max-content;

  overflow: visible;

  white-space: nowrap;
}

@media (min-width: 768px) and (max-width: 1279px) {
  .account-button {
    width: 32px;
  }
}

@media (max-width: 767px) {
  .header-command-group .account-button {
    width: 100%;

    min-height: 38px;

    justify-content: flex-start;

    padding: 0px 10px;

    border-color: transparent;

    background: transparent;
  }
}

@media (max-width: 860px) {
  .account-birth-form {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 520px) {
  .settings-dialog {
    right: 8px;

    left: 8px;

    width: calc(-16px + 100vw);

    max-width: calc(-16px + 100vw);

    margin: 8px 0px;

    max-height: calc(-16px + 100vh);
  }

  .settings-dialog form,
  .settings-section {
    min-width: 0px;

    padding-right: 12px;

    padding-left: 12px;
  }

  .settings-dialog .membership-form,
  .settings-dialog .settings-section > form,
  .settings-dialog.admin-dialog > form {
    padding: 0px;
  }

  .settings-dialog .connection-status,
  .settings-dialog .form-hint {
    overflow-wrap: anywhere;
  }

  .backfill-controls {
    grid-template-columns: 1fr;
  }
}

.account-menu-chevron {
  margin-left: 1px;

  transition: transform 180ms var(--ease-out);

  width: 13px !important;

  height: 13px !important;
}

.account-menu-shell.is-open .account-menu-chevron {
  transform: rotate(180deg);
}

.account-dropdown[hidden] {
  display: none;
}

.account-dropdown-head {
  display: grid;

  gap: 2px;

  padding: 9px 10px 10px;

  border-bottom: 1px solid var(--border);

  margin-bottom: 3px;
}

.account-dropdown-head strong {
  color: var(--text-primary);

  font-size: 13px;

  overflow-wrap: anywhere;
}

.account-dropdown-head span {
  color: var(--text-muted);

  font-size: 11px;
}

.account-dropdown button {
  width: 100%;

  min-height: 36px;

  display: grid;

  grid-template-columns: 18px minmax(0px, 1fr) 16px;

  align-items: center;

  gap: 9px;

  padding: 0px 10px;

  border: 0px;

  border-radius: 7px;

  color: var(--text-secondary);

  background: transparent;

  text-align: left;

  cursor: pointer;

  transition: color 160ms, background 160ms;
}

.account-dropdown button:hover {
  color: var(--text-primary);

  background: var(--surface-muted);

  outline: none;
}

.account-dropdown button:focus-visible {
  color: var(--text-primary);

  background: var(--surface-muted);

  outline: none;

  box-shadow: inset 0 0 0 2px var(--focus-ring);
}

.account-dropdown button svg {
  width: 16px;

  height: 16px;
}

.account-dropdown button svg:last-child {
  width: 13px;

  height: 13px;

  color: var(--text-muted);
}

.account-dropdown-separator {
  height: 1px;

  margin: 4px 5px;

  background: var(--border);
}

.account-dropdown .account-menu-danger {
  color: var(--market-up);

  grid-template-columns: 18px minmax(0px, 1fr);
}

.account-dropdown .account-menu-danger:focus-visible,
.account-dropdown .account-menu-danger:hover {
  color: var(--market-up);

  background: var(--market-up-soft);
}

button.account-role-badge {
  font-family: inherit;

  cursor: pointer;

  transition: filter 160ms, box-shadow 160ms;
}

button.account-role-badge:hover {
  filter: brightness(0.98);

  box-shadow: var(--shadow-card);
}

button.account-role-badge:focus-visible {
  outline: 2px solid var(--action);

  outline-offset: 2px;
}

.account-role-badge svg {
  width: 13px;

  height: 13px;
}

.admin-role-badge {
  color: var(--text-secondary);

  background: var(--surface-muted);
}

.vip-role-badge {
  color: rgb(154, 104, 20);

  background: linear-gradient(135deg, rgb(255, 248, 230), rgb(245, 226, 173));

  border-color: rgb(200, 155, 69);

  box-shadow: rgba(180, 132, 41, 0.18) 0px 2px 8px;
}

.vip-role-badge.is-nonmember {
  color: rgb(105, 117, 128);

  background: var(--surface-muted);

  border-color: rgb(203, 211, 218);

  box-shadow: none;
}

.vip-role-badge.is-nonmember b {
  background: rgb(135, 147, 158);

  color: var(--text-inverse);
}

.vip-role-badge b {
  display: grid;

  place-items: center;

  width: 16px;

  height: 16px;

  border-radius: 50%;

  background: rgb(184, 131, 37);

  color: rgb(255, 250, 240);

  font: 700 10px / 1 Georgia, serif;

  box-shadow: rgba(255, 255, 255, 0.58) 0px 0px 0px 1px inset;
}

.member-feature-view.member-locked {
  position: relative;
}

.member-feature-view.member-locked > :not(.member-gate) {
  opacity: 0.42;

  filter: grayscale(0.38);

  pointer-events: none;

  user-select: none;
}

.member-gate {
  position: relative;

  z-index: 20;

  display: flex;

  align-items: center;

  gap: 14px;

  margin: 0px 0px 22px;

  padding: 16px 18px;

  border: 1px solid rgb(234, 217, 172);

  border-radius: 14px;

  background: linear-gradient(135deg, rgb(255, 253, 247), rgb(255, 248, 233));

  box-shadow: rgba(147, 107, 31, 0.08) 0px 10px 24px;
}

.member-gate-icon {
  display: grid;

  place-items: center;

  flex: 0 0 38px;

  width: 38px;

  height: 38px;

  border-radius: 12px;

  color: rgb(155, 106, 29);

  background: rgb(247, 232, 187);
}

.member-gate-icon svg {
  width: 20px;

  height: 20px;
}

.member-gate > div:nth-child(2) {
  display: grid;

  gap: 3px;

  min-width: 0px;

  flex: 1 1 0%;
}

.member-gate strong {
  color: var(--text-primary);

  font-size: 14px;
}

.member-gate span {
  color: rgb(123, 107, 77);

  font-size: 12px;

  line-height: 1.5;
}

.member-gate .button {
  flex: 0 0 auto;
}

#settingsDialog[open] {
  display: flex;

  flex-direction: column;
}

#settingsDialog > .dialog-header {
  order: 0;
}

#settingsDialog > .connection-status {
  order: 1;
}

#settingsDialog > .account-birth-section {
  order: 2;
}

#settingsDialog > .membership-overview {
  order: 3;
}

#settingsDialog > .password-section {
  order: 5;
}

.privacy-note {
  display: flex;

  align-items: flex-start;

  gap: 8px;

  margin-bottom: 12px;

  color: var(--text-secondary);
}

.privacy-note svg {
  flex: 0 0 15px;

  width: 15px;

  height: 15px;

  margin-top: 3px;

  color: var(--market-down);
}

.membership-status-grid {
  display: grid;

  grid-template-columns: repeat(4, minmax(0px, 1fr));

  gap: 10px;

  margin: 14px 0px 18px;
}

.membership-status-grid > div {
  padding: 12px 13px;

  border: 1px solid var(--border);

  border-radius: 10px;

  background: var(--surface-subtle);
}

.membership-status-grid span {
  display: block;

  color: var(--text-tertiary);

  font-size: 11px;
}

.membership-status-grid strong {
  display: block;

  margin-top: 5px;

  color: var(--text-primary);

  font-size: 15px;

  font-variant-numeric: tabular-nums;
}

.membership-comparison {
  overflow: hidden;

  border: 1px solid var(--border);

  border-radius: 10px;

  font-size: 12px;
}

.membership-comparison > div {
  display: grid;

  grid-template-columns: minmax(0px, 1.6fr) 0.7fr 0.7fr;

  gap: 8px;

  align-items: center;

  padding: 9px 11px;

  border-top: 1px solid var(--border);
}

.membership-comparison > div:first-child {
  border-top: 0px;
}

.membership-comparison-head {
  color: var(--text-secondary);

  background: var(--surface-subtle);

  font-weight: 700;
}

.membership-comparison b {
  color: var(--market-down);

  font-weight: 600;
}

.membership-comparison b.muted {
  color: var(--text-tertiary);
}

.membership-comparison b.available {
  color: rgb(154, 104, 20);
}

.membership-topup-row {
  display: flex;

  align-items: center;

  justify-content: space-between;

  gap: 12px;

  margin-top: 14px;

  color: var(--text-secondary);

  font-size: 12px;
}

.membership-topup-row > span {
  display: inline-flex;

  align-items: center;

  gap: 7px;
}

.membership-topup-row svg {
  width: 15px;

  height: 15px;

  color: rgb(154, 104, 20);
}

.password-form {
  display: grid;

  gap: 10px;
}

@media (max-width: 767px) {
  .account-menu-shell {
    width: 100%;

    display: grid;

    grid-template-columns: minmax(0px, 1fr);
  }

  .account-menu-shell .account-button {
    width: 100%;

    min-width: 0px;

    max-width: none;
  }

  .account-dropdown {
    top: calc(100% + 6px);

    right: 0px;

    width: min(270px, -28px + 100vw);
  }

  .account-role-badges {
    gap: 3px;
  }

  .account-role-badge {
    padding-inline: 5px;
  }

  .account-role-badge > span {
    display: none;
  }

  .membership-status-grid {
    grid-template-columns: repeat(2, minmax(0px, 1fr));
  }

  .member-gate {
    align-items: flex-start;

    flex-wrap: wrap;
  }

  .member-gate .button {
    margin-left: 52px;
  }
}

.assistant-button.member-locked-control {
  color: var(--text-secondary);

  opacity: 0.72;
}

.assistant-dialog.member-locked .assistant-member-content {
  opacity: 0.42;

  filter: grayscale(0.38);

  pointer-events: none;

  user-select: none;
}

.account-settings-dialog {
  border-radius: 12px;
}

.settings-dialog {
  width: min(780px, -24px + 100vw);

  max-height: calc(-32px + 100vh);

  overflow-x: hidden;

  border-radius: 12px;
}

.account-dropdown {
  position: absolute;

  top: calc(100% + 9px);

  right: 0px;

  z-index: 90;

  width: 242px;

  display: grid;

  gap: 2px;

  padding: 7px;

  background: var(--surface);

  transform-origin: right top;

  animation: account-menu-in 180ms var(--ease-out) both;

  border: 1px solid var(--border);

  border-radius: 8px;

  box-shadow: var(--shadow-float);
}

@media (max-width: 767px) {
  .account-settings-dialog,
  .settings-dialog {
    width: calc(-16px + 100vw);

    max-width: none;

    max-height: calc(-20px + 100dvh);

    border-radius: 8px;
  }
}

@media (max-width: 600px) {
  .admin-section-picker {
    grid-template-columns: minmax(0px, 1fr);
  }
}

@media (max-width: 520px) {
  .settings-dialog .form-field {
    width: 100%;

    max-width: 100%;

    min-width: 0px;
  }
}

.auth-form .form-field[hidden] {
  display: none;
}

@media (max-width: 520px) {
  .account-birth-form {
    grid-template-columns: 1fr;
  }
}

.account-role-badges {
  display: inline-flex;

  align-items: center;

  min-height: 32px;

  gap: 3px;
}

@media (min-width: 1280px) and (max-width: 1439px) {
  .app-header .header-command-group .account-role-badge span {
    display: none;
  }

  .app-header .header-command-group .account-role-badge {
    min-width: 28px;

    justify-content: center;

    padding-inline: 6px;
  }
}

@media (min-width: 1280px) {
  .header-command-group .account-button {
    flex: 0 0 auto;

    width: auto;

    max-width: none;

    overflow: visible;

    padding: 0px 8px;
  }

  .header-command-group .account-button > span {
    display: inline;

    overflow: visible;
  }
}

.auth-brand .brand-mark {
  flex: 0 0 42px;

  display: grid;

  place-items: center;

  border: 0px;

  border-radius: 7px;

  background: var(--action);

  color: var(--text-inverse);

  box-shadow: none;

  width: 42px;

  height: 42px;
}

.account-menu-shell {
  position: relative;

  align-items: center;

  gap: 5px;
}

.account-role-badge {
  display: inline-flex;

  align-items: center;

  gap: 4px;

  border-width: 1px;

  border-style: solid;

  font-weight: 700;

  letter-spacing: 0.04em;

  white-space: nowrap;

  padding: 0px 7px;

  min-height: 28px;

  height: 28px;

  border-radius: 6px;

  font-size: 11px;
}

.account-button {
  flex: 0 0 auto;

  overflow: visible;

  max-width: none;

  min-height: 28px;

  height: 28px;

  border-radius: 6px;

  font-size: 11px;

  padding-inline: 8px;
}

.settings-dialog:not(.heaven-reading-dialog) {
  width: min(740px, -28px + 100vw);

  max-height: min(820px, -28px + 100dvh);

  box-sizing: border-box;

  overflow: hidden auto;

  overscroll-behavior: contain;
}

.settings-dialog:not(.heaven-reading-dialog)[open] {
  margin: auto;
}

.settings-dialog:not(.heaven-reading-dialog) .settings-section {
  padding: 18px 20px;

  border-color: var(--dialog-line);
}

.settings-dialog:not(.heaven-reading-dialog) .settings-section-heading {
  margin-bottom: 12px;
}

.settings-dialog:not(.heaven-reading-dialog) .settings-section-heading h3 {
  margin: 0px;

  color: var(--text-primary);

  font-size: var(--font-size-card-title);

  font-weight: var(--font-weight-semibold);
}

.settings-dialog:not(.heaven-reading-dialog) .settings-section-heading > span {
  color: var(--text-tertiary);

  font-size: var(--font-size-aux);
}

.settings-dialog:not(.heaven-reading-dialog) .form-field {
  gap: 6px;
}

.settings-dialog:not(.heaven-reading-dialog) .form-field > label,
.settings-dialog:not(.heaven-reading-dialog) .form-field > span {
  color: var(--text-secondary);

  font-size: 11px;

  font-weight: 650;
}

.settings-dialog:not(.heaven-reading-dialog) :is(input, select, textarea) {
  border-color: var(--border-strong);

  border-radius: 7px;
}

.settings-dialog:not(.heaven-reading-dialog) .dialog-actions {
  gap: 8px;
}

.settings-dialog.alerts-dialog {
  width: min(720px, -28px + 100vw);
}

.settings-dialog.assistant-dialog {
  width: min(760px, -28px + 100vw);

  height: min(760px, -28px + 100dvh);

  max-height: min(760px, -28px + 100dvh);

  overflow: hidden !important;
}

.settings-dialog.account-settings-dialog {
  width: min(720px, -28px + 100vw);
}

.account-settings-dialog .connection-status {
  margin: 12px 20px 0px;

  border-radius: 7px;

  font-size: 11px;
}

.account-settings-dialog .connection-status.connected {
  display: none;
}

.account-settings-dialog .settings-lead {
  color: var(--text-secondary);

  font-size: 12px;

  line-height: 1.6;
}

.account-settings-dialog .membership-usage {
  margin-top: 8px;
}

.account-settings-dialog .membership-status-grid {
  gap: 8px;

  margin: 14px 0px 16px;
}

.account-settings-dialog .membership-status-grid > div {
  min-height: 68px;

  padding: 11px 12px;

  border-color: var(--border-strong);

  border-radius: 7px;

  background: var(--table-header);
}

.account-settings-dialog .membership-status-grid span {
  font-size: 10px;
}

.account-settings-dialog .membership-status-grid strong {
  margin-top: 7px;

  font-size: 14px;
}

.account-settings-dialog .membership-status-grid > div:first-child {
  border-color: rgb(228, 213, 170);

  background: rgb(255, 251, 239);
}

.account-settings-dialog .membership-status-grid > div:first-child strong {
  color: rgb(147, 101, 21);
}

.account-settings-dialog .membership-comparison {
  border-color: var(--border-strong);

  border-radius: 7px;
}

.account-settings-dialog .membership-comparison > div {
  min-height: 36px;

  padding: 8px 11px;

  border-color: var(--border);
}

.account-settings-dialog .membership-comparison-head {
  background: var(--table-header);
}

.account-settings-dialog .membership-topup-row {
  margin-top: 12px;
}

.account-settings-dialog .privacy-note {
  padding: 10px 11px;

  border: 1px solid var(--market-down);

  border-radius: 7px;

  background: var(--market-down-soft);
}

.account-settings-dialog .account-birth-form {
  grid-template-columns: 1.2fr 1fr 0.72fr;
}

.account-settings-dialog .password-form {
  max-width: 460px;
}

.settings-dialog.admin-dialog {
  width: min(900px, -28px + 100vw);
}

.admin-dialog .connection-status {
  margin: 12px 20px 0px;

  padding: 8px 10px;

  border-radius: 7px;

  color: var(--text-secondary);

  font-size: 11px;
}

.admin-dialog .admin-section-picker {
  grid-template-columns: auto minmax(220px, 300px);

  gap: 14px;

  padding: 12px 20px;

  border-bottom: 1px solid var(--dialog-line);

  background: var(--surface-subtle);
}

.admin-dialog .admin-section-picker label {
  font-size: 11px;
}

.admin-dialog .admin-section-picker select {
  min-height: 32px;

  border-color: var(--border-strong);

  border-radius: 8px;

  font-size: var(--font-size-label);
}

.admin-dialog .admin-panel {
  max-width: 860px;

  margin-inline: auto;
}

.admin-dialog .settings-section + .settings-section {
  border-top: 1px solid var(--dialog-line);
}

.admin-dialog .admin-users-list {
  border-color: var(--dialog-line);
}

.admin-dialog .admin-user-row {
  grid-template-columns: 150px 90px minmax(0px, 1fr);

  gap: 12px;

  padding: 12px 0px;

  border-color: var(--dialog-line);
}

.admin-dialog .membership-form {
  grid-template-columns: 92px minmax(135px, 0.8fr) minmax(140px, 1fr) auto;
}

@media (max-width: 760px) {
  .account-settings-dialog .membership-status-grid {
    grid-template-columns: repeat(2, minmax(0px, 1fr));
  }

  .account-settings-dialog .account-birth-form {
    grid-template-columns: 1fr;
  }

  .admin-dialog .admin-section-picker {
    grid-template-columns: 1fr;

    gap: 6px;
  }

  .admin-dialog .admin-user-row {
    grid-template-columns: 1fr auto;
  }

  .admin-dialog .admin-user-row .membership-form {
    grid-column: 1 / -1;

    grid-template-columns: repeat(2, minmax(0px, 1fr));
  }
}

@media (max-width: 460px) {
  .account-settings-dialog .membership-status-grid {
    grid-template-columns: 1fr;
  }

  .account-settings-dialog .membership-comparison {
    overflow-x: auto;
  }

  .account-settings-dialog .membership-comparison > div {
    min-width: 510px;
  }

  .admin-dialog .admin-user-row .membership-form {
    grid-template-columns: 1fr;
  }
}

:root[data-theme="dark"] :is(.header-command-group, .account-dropdown) {
  border-color: var(--border);

  background: var(--surface);

  color: var(--text-primary);

  box-shadow: var(--shadow);
}

:root[data-theme="dark"] :is(.account-dropdown-head, .account-dropdown-separator) {
  border-color: var(--line-soft);
}

:root[data-theme="dark"] .account-role-badge.admin-role-badge {
  border-color: var(--blue-line);

  background: var(--action-soft);

  color: var(--action);
}

:root[data-theme="dark"] .settings-dialog :is(.dialog-header h2, .settings-section-heading h3) {
  color: var(--text-primary);
}

:root[data-theme="dark"] .settings-dialog :is(.form-field > span, .settings-section-heading > span, .form-hint, .dialog-eyebrow) {
  color: var(--text-secondary);
}

:root[data-theme="dark"] .settings-dialog .connection-status.connected {
  border-color: var(--market-down);

  background: var(--market-down-soft);

  color: var(--market-down);
}

:root[data-theme="dark"] .settings-dialog .dialog-header .icon-button {
  color: var(--text-secondary);
}

:root[data-theme="dark"] .account-settings-dialog :is(.membership-comparison, .membership-comparison > div, .membership-comparison-head) {
  border-color: var(--border);

  background: var(--surface);

  color: var(--text-primary);
}

:root[data-theme="dark"] .account-settings-dialog .membership-comparison > .membership-comparison-head {
  background: var(--surface-muted);

  color: var(--text-secondary);
}

:root[data-theme="dark"] :is(.loading-overlay, .auth-gate) {
  background: var(--backdrop);
}

:root[data-theme="dark"] :is(.auth-shell) {
  border-color: var(--border-strong);

  background: var(--surface);

  color: var(--text-primary);

  box-shadow: var(--shadow);
}

@media (min-width: 768px) {
  .account-menu-shell {
    display: inline-flex;
  }
}


body.login-portal {
  padding-bottom: 0;
}

.login-portal {
  min-height: 100vh;

  display: flex;

  background: var(--canvas);

  color: var(--text-primary);
}

.login-stage {
  position: relative;

  flex: 1 1 auto;

  display: grid;

  place-items: center;

  padding: 48px 24px;
}

.login-theme-toggle {
  position: absolute;

  z-index: 2;

  top: 16px;

  right: 20px;

  min-height: 32px;

  padding: 0 12px;

  border: 1px solid var(--border-strong);

  border-radius: var(--size-radius-md);

  background: var(--surface);

  color: var(--text-secondary);

  font-size: var(--font-size-label);

  cursor: pointer;
}

.login-brand {
  position: relative;

  display: flex;

  flex-direction: column;

  width: var(--login-brand-share);

  min-width: var(--login-brand-min);

  max-width: var(--login-brand-cap);

  flex: 0 0 var(--login-brand-share);

  overflow: hidden;

  padding: var(--login-brand-pad);

  background: var(--login-brand-gradient);

  color: #f4f7ff;
}

.login-brand-header {
  display: flex;

  align-items: center;

  gap: 12px;
}

.login-brand-mark {
  display: flex;

  flex: 0 0 var(--login-brand-mark-size);

  align-items: center;

  justify-content: center;

  width: var(--login-brand-mark-size);

  height: var(--login-brand-mark-size);

  border-radius: 12px;

  background: rgba(255, 255, 255, 0.12);
}

.login-brand-glyph {
  font-size: 20px;

  font-weight: var(--font-weight-semibold);
}

.login-brand-identity {
  display: grid;

  gap: 2px;
}

.login-brand-name {
  margin: 0;

  font-size: var(--login-brand-name-size);

  font-weight: var(--font-weight-semibold);
}

.login-brand-subtitle {
  margin: 0;

  font-size: var(--font-size-caption);

  letter-spacing: 0.02em;

  opacity: 0.72;
}

.login-mascots {
  display: flex;

  flex: 1 1 auto;

  align-items: center;

  min-height: 0;

  pointer-events: none;
}

.login-mascots-stage {
  display: flex;

  align-items: flex-end;

  padding-left: calc(var(--login-mascot-height) * 82 / 210);

  gap: calc(var(--login-mascot-height) * 10 / 210);
}

.login-mascot {
  position: relative;

  flex: 0 0 auto;

  overflow: visible;

  --pupil-x: 0px;

  --pupil-y: 0px;

  --lean: 0deg;
}

.login-mascot.is-red {
  width: calc(var(--login-mascot-height) * 96 / 210);

  height: var(--login-mascot-height);
}

.login-mascot.is-green {
  width: calc(var(--login-mascot-height) * 84 / 210);

  height: calc(var(--login-mascot-height) * 175 / 210);

  perspective: 420px;
}

.login-mascot-breathe {
  width: 100%;

  height: 100%;

  transform-origin: 50% 100%;
}

.login-mascots[data-mood="idle"] .login-mascot-breathe {
  animation: login-mascot-breathe 3.6s ease-in-out infinite;
}

.login-mascot-lean {
  width: 100%;

  height: 100%;

  transform: rotate(var(--lean));

  transform-origin: 50% 88%;
}

.login-mascot.is-red .login-mascot-figure {
  display: block;

  width: 100%;

  height: 100%;
}

.login-mascot.is-green .login-mascot-figure {
  position: relative;

  width: 100%;

  height: 100%;

  transform-style: preserve-3d;

  transition: transform 280ms ease-in-out;
}

.login-mascot-front {
  display: block;

  width: 100%;

  height: 100%;

  backface-visibility: hidden;
}

.login-mascot-back {
  position: absolute;

  inset: 0;

  display: block;

  width: 100%;

  height: 100%;

  backface-visibility: hidden;

  transform: rotateY(180deg);
}

.login-mascots[data-mood="password"] .login-mascot.is-green .login-mascot-figure {
  transform: rotateY(180deg);
}

.login-mascot-body {
  fill: var(--login-mascot-red);
}

.login-mascot.is-green .login-mascot-body {
  fill: var(--login-mascot-green);
}

.login-mascot-wick {
  stroke: var(--login-mascot-red);

  stroke-width: 4;

  stroke-linecap: round;
}

.login-mascot.is-green .login-mascot-wick {
  stroke: var(--login-mascot-green);

  stroke-width: 3.5;
}

.login-mascot-eye {
  fill: var(--login-mascot-eye);
}

.login-mascot-pupil {
  fill: var(--login-mascot-pupil);

  transform: translate(var(--pupil-x), var(--pupil-y));

  transform-box: fill-box;

  transform-origin: center;
}

.login-mascot-lid {
  fill: var(--login-mascot-red);

  transform: scaleY(0);

  transform-box: fill-box;

  transform-origin: center;
}

.login-mascot.is-green .login-mascot-lid {
  fill: var(--login-mascot-green);
}

.login-mascots.is-blinking .login-mascot-lid {
  animation: login-mascot-blink 140ms ease-out;
}

.login-mascot-happy {
  fill: none;

  stroke: var(--login-mascot-pupil);

  stroke-width: 2.4;

  stroke-linecap: round;

  opacity: 0;
}

.login-mascot-sad {
  fill: var(--login-mascot-pupil);

  opacity: 0;
}

.login-mascot-arm {
  fill: var(--login-mascot-red);

  transform-box: fill-box;

  transform-origin: center;

  transition: transform 250ms cubic-bezier(0.2, 0.9, 0.25, 1.2);
}

.login-mascot.is-green .login-mascot-arm {
  fill: var(--login-mascot-green);
}

.login-mascot-hand {
  fill: var(--login-mascot-red-shade);

  opacity: 0;

  transform-box: fill-box;

  transform-origin: center;

  transition: transform 250ms cubic-bezier(0.2, 0.9, 0.25, 1.2), opacity 180ms ease-out;
}

.login-mascots[data-mood="password"] .login-mascot.is-red .login-mascot-hand {
  opacity: 1;
}

.login-mascots[data-mood="password"] .login-mascot.is-red .login-mascot-hand.is-left {
  transform: translate(20px, -34px) scale(1.2);
}

.login-mascots[data-mood="password"] .login-mascot.is-red .login-mascot-hand.is-right {
  transform: translate(-20px, -34px) scale(1.2);
}

.login-mascots[data-mood="password"] .login-mascot.is-red .login-mascot-arm.is-left {
  transform: translate(10px, -18px) rotate(-18deg);
}

.login-mascots[data-mood="password"] .login-mascot.is-red .login-mascot-arm.is-right {
  transform: translate(-10px, -18px) rotate(18deg);
}

.login-mascots[data-mood="password"] .login-mascot.is-red .login-mascot-pupil,
.login-mascots[data-mood="password"] .login-mascot.is-red .login-mascot-eye {
  opacity: 0;
}

.login-mascot-slit {
  fill: var(--login-mascot-green-shade);
}

.login-mascot-shadow {
  fill: rgba(6, 10, 24, 0.28);
}

.login-mascots[data-mood="success"] .login-mascot-pupil,
.login-mascots[data-mood="success"] .login-mascot-lid,
.login-mascots[data-mood="fail"] .login-mascot-pupil {
  opacity: 0;
}

.login-mascots[data-mood="success"] .login-mascot-happy,
.login-mascots[data-mood="fail"] .login-mascot-sad {
  opacity: 1;
}

.login-mascots[data-mood="success"] .login-mascot.is-red .login-mascot-arm.is-left {
  transform: translate(-2px, -36px) rotate(-48deg);
}

.login-mascots[data-mood="success"] .login-mascot.is-red .login-mascot-arm.is-right {
  transform: translate(2px, -36px) rotate(48deg);
}

.login-mascots[data-mood="success"] .login-mascot.is-red {
  animation: login-mascot-hop-red 450ms ease-in-out;
}

.login-mascots[data-mood="success"] .login-mascot.is-green {
  animation: login-mascot-hop-green 450ms ease-in-out 80ms;
}

.login-mascots[data-mood="fail"] .login-mascot-arm {
  transform: translateY(6px);
}

@media (prefers-reduced-motion: reduce) {
  .login-mascots[data-mood="idle"] .login-mascot-breathe,
  .login-mascots.is-blinking .login-mascot-lid,
  .login-mascots[data-mood="success"] .login-mascot.is-red,
  .login-mascots[data-mood="success"] .login-mascot.is-green {
    animation: none;
  }

  .login-mascot.is-green .login-mascot-figure,
  .login-mascot-hand,
  .login-mascot-arm {
    transition: none;
  }
}

.login-password-wrap {
  position: relative;

  display: block;
}

.login-portal .login-password-wrap input {
  padding-right: 48px;
}

.login-password-toggle {
  position: absolute;

  top: 50%;

  right: 8px;

  z-index: 1;

  min-height: 24px;

  padding: 0;

  border: 0;

  background: transparent;

  color: var(--text-secondary);

  font-size: var(--font-size-caption);

  transform: translateY(-50%);

  cursor: pointer;
}

.login-brand-copy {
  display: flex;

  flex: 0 0 auto;

  flex-direction: column;

  justify-content: flex-end;

  padding: 0 0 20px;
}

.login-brand-kicker {
  display: inline-flex;

  align-self: flex-start;

  margin: 0 0 14px;

  padding: 4px 10px;

  border: 1px solid rgba(255, 255, 255, 0.18);

  border-radius: 999px;

  font-size: var(--font-size-caption);

  letter-spacing: 0.08em;

  opacity: 0.86;
}

.login-brand-title {
  margin: 0;

  max-width: 12.4em;

  font-size: var(--login-hero-size);

  font-weight: var(--font-weight-semibold);

  line-height: 1.35;
}

.login-brand-lead {
  margin: 12px 0 0;

  max-width: 28em;

  font-size: var(--font-size-label);

  line-height: 1.7;

  opacity: 0.78;
}

.login-brand-market {
  position: relative;

  min-height: 168px;
}

.login-brand-chart {
  display: block;

  width: 100%;

  height: 168px;
}

.login-chart-area {
  fill: url(#loginChartFade);
}

.login-chart-line {
  fill: none;

  stroke: var(--login-trend-line);

  stroke-width: 2;

  stroke-linecap: round;

  stroke-linejoin: round;
}

.login-candles line {
  stroke-width: 1.5;
}

.login-candles .is-up line,
.login-candles .is-up rect {
  fill: var(--login-candle-up);

  stroke: var(--login-candle-up);
}

.login-candles .is-down line,
.login-candles .is-down rect {
  fill: var(--login-candle-down);

  stroke: var(--login-candle-down);
}

.login-brand-stats {
  position: absolute;

  right: 0;

  bottom: 18px;

  left: 0;

  display: flex;

  flex-wrap: wrap;

  gap: 8px;

  margin: 0;
}

.login-stat {
  display: flex;

  align-items: baseline;

  gap: 6px;

  margin: 0;

  padding: 6px 10px;

  border-radius: 999px;

  background: var(--login-stat-chip-bg);
}

.login-stat dt {
  color: rgba(244, 247, 255, 0.64);

  font-size: var(--font-size-caption);
}

.login-stat dd {
  margin: 0;

  font-size: var(--font-size-body);

  font-weight: var(--font-weight-semibold);
}

.login-stat:nth-child(1) dd {
  color: #f0b45a;
}

.login-stat:nth-child(2) dd {
  color: var(--login-candle-up);
}

.login-stat:nth-child(3) dd {
  color: var(--login-candle-down);
}

.login-stat-tag {
  margin-left: 4px;

  font-size: var(--font-size-caption);

  font-weight: var(--font-weight-regular);
}

.login-brand-disclaimer {
  margin: 12px 0 0;

  font-size: var(--font-size-aux);

  letter-spacing: 0.02em;

  opacity: 0.48;
}

.login-card {
  width: var(--login-card-width);

  max-width: calc(100vw - 48px);

  padding: var(--login-card-pad);

  border: 1px solid var(--border-strong);

  border-radius: var(--size-radius-dialog);

  background: var(--surface);

  box-shadow: var(--shadow-raised);
}

.login-card.is-loading .login-form {
  pointer-events: none;

  opacity: 0.72;
}

.login-card-title {
  margin: 0;

  font-size: var(--login-card-title-size);

  font-weight: var(--font-weight-semibold);
}

.login-card-lead {
  margin: 8px 0 0;

  color: var(--text-secondary);

  font-size: var(--font-size-label);

  line-height: 1.6;
}

.login-tabs {
  display: grid;

  grid-template-columns: 1fr 1fr;

  margin-top: 24px;

  border-bottom: 1px solid var(--line);
}

.login-tab {
  min-height: 40px;

  border: 0;

  border-bottom: 2px solid transparent;

  background: transparent;

  color: var(--text-secondary);

  cursor: pointer;
}

.login-tab.is-active {
  border-bottom-color: var(--action);

  color: var(--action);

  font-weight: var(--font-weight-medium);
}

.login-form {
  display: grid;

  gap: 14px;

  margin-top: 20px;
}

.login-portal .form-field input.is-invalid {
  border-color: var(--danger);
}

.login-submit {
  width: 100%;

  min-height: var(--login-submit-height);
}

.login-spinner {
  width: 14px;

  height: 14px;

  border: 2px solid currentColor;

  border-right-color: transparent;

  border-radius: 50%;

  animation: login-spin 0.7s linear infinite;
}

@keyframes login-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes login-mascot-breathe {
  0%,
  100% {
    transform: scaleY(1);
  }

  50% {
    transform: scaleY(1.015);
  }
}

@keyframes login-mascot-blink {
  0%,
  100% {
    transform: scaleY(0);
  }

  50% {
    transform: scaleY(1);
  }
}

@keyframes login-mascot-hop-red {
  0%,
  100% {
    transform: translateY(0);
  }

  42% {
    transform: translateY(-13px);
  }
}

@keyframes login-mascot-hop-green {
  0%,
  100% {
    transform: translateY(0);
  }

  42% {
    transform: translateY(-11px);
  }
}

.login-error {
  margin: 0;

  color: var(--danger);

  font-size: var(--font-size-caption);
}

.login-error[hidden] {
  display: none;
}

.login-hint,
.login-privacy {
  margin: 16px 0 0;

  color: var(--text-tertiary);

  font-size: var(--font-size-caption);

  line-height: 1.6;
}

.login-portal .login-privacy {
  display: flex;

  align-items: center;

  gap: 6px;
}

.login-lock {
  font-size: 12px;
}

.login-back,
.login-manage {
  border: 0;

  background: transparent;

  color: var(--action);

  cursor: pointer;
}

.login-portal .login-back {
  margin-bottom: 12px;

  padding: 0;

  font-size: var(--font-size-label);
}

.login-portal .login-add {
  display: flex;

  align-items: center;

  justify-content: center;

  width: 100%;

  min-height: 44px;

  margin-top: 12px;

  border: 1px dashed var(--border-strong);

  border-radius: var(--size-radius-md);

  background: transparent;

  color: var(--action);

  cursor: pointer;
}

.login-portal .login-manage {
  display: block;

  width: 100%;

  min-height: 36px;

  margin-top: 8px;

  padding: 0;

  text-align: center;

  color: var(--text-secondary);
}

.login-manage-toolbar {
  display: flex;

  align-items: center;

  justify-content: space-between;

  gap: 12px;

  margin-top: 16px;
}

.login-manage-hint {
  margin: 0;

  color: var(--text-tertiary);

  font-size: var(--font-size-caption);
}

.login-manage-done {
  border: 0;

  background: transparent;

  color: var(--action);

  cursor: pointer;
}

.login-account-list {
  display: grid;

  gap: 10px;

  margin-top: 20px;
}

.login-account-row {
  display: grid;

  grid-template-columns: auto minmax(0, 1fr) auto;

  align-items: center;

  gap: 12px;

  min-height: var(--login-account-row-min);

  padding: 10px 14px;

  border: 1px solid var(--border);

  border-radius: var(--size-radius-md);

  background: var(--surface);
}

.login-account-row.is-switchable {
  cursor: pointer;
}

.login-account-row.is-current {
  border-color: var(--action);
}

.login-account-row.is-confirming {
  display: grid;

  grid-template-columns: minmax(0, 1fr);

  gap: 10px;

  padding: 12px 14px;

  border-color: var(--danger);
}

.login-avatar {
  display: grid;

  place-items: center;

  width: var(--login-account-avatar);

  height: var(--login-account-avatar);

  border-radius: 50%;

  color: #fff;

  font-size: var(--font-size-body);

  font-weight: var(--font-weight-semibold);
}

.login-avatar.tone-0 {
  background: var(--action);
}

.login-avatar.tone-1 {
  background: var(--market-up);
}

.login-avatar.tone-2 {
  background: var(--market-down);
}

.login-avatar.tone-3 {
  background: var(--warning);
}

.login-account-meta {
  display: grid;

  gap: 4px;

  min-width: 0;
}

.login-account-name {
  display: flex;

  flex-wrap: wrap;

  align-items: center;

  gap: 6px;
}

.login-account-meta strong {
  font-weight: var(--font-weight-medium);
}

.login-account-used {
  color: var(--text-tertiary);

  font-size: var(--font-size-caption);
}

.login-chip {
  display: inline-flex;

  align-items: center;

  min-height: 18px;

  padding: 0 6px;

  border-radius: 999px;

  background: var(--surface-muted);

  color: var(--text-secondary);

  font-size: var(--font-size-aux);
}

.login-chip-current {
  background: var(--action-soft);

  color: var(--action);
}

.login-chip-member {
  background: var(--warning-soft);

  color: var(--warning);
}

.login-account-check {
  color: var(--action);

  font-size: 16px;
}

.login-account-action {
  display: grid;

  justify-items: end;

  gap: 2px;

  color: var(--action);

  font-size: var(--font-size-caption);
}

.login-account-remove {
  display: grid;

  place-items: center;

  width: 28px;

  height: 28px;

  border: 0;

  background: transparent;

  color: var(--text-tertiary);

  cursor: pointer;
}

.login-account-remove:hover {
  color: var(--danger);
}

.login-confirm-copy {
  margin: 0;

  font-size: var(--font-size-label);
}

.login-confirm-actions {
  display: flex;

  gap: 8px;
}

@media (min-width: 1921px) {
  .login-brand {
    width: var(--login-brand-wide-share);

    min-width: var(--login-brand-cap);

    max-width: none;

    flex-basis: var(--login-brand-wide-share);
  }
}

@media (max-width: 900px) {
  .login-portal {
    flex-direction: column;
  }

  .login-brand {
    width: 100%;

    min-width: 0;

    max-width: none;

    flex-basis: auto;

    padding: 20px 20px 16px;
  }

  .login-brand-copy,
  .login-brand-market,
  .login-brand-disclaimer,
  .login-mascots {
    display: none;
  }

  .login-stage {
    padding: 28px 16px 40px;
  }
}
