/* ============================================================
   AlphaDesk · auth.css
   多用户登录：登录/注册浮层、顶栏用户区、邀请码、用户管理
   变量沿用 style.css :root；本文件所有样式均以 .au-* / #auth-*
   / #user-chip 前缀限定，避免全局污染。
   ============================================================ */

/* 浮层打开时锁背景滚动（手机端 body 默认可滚） */
html.au-locked,
html.au-locked body { overflow: hidden !important; }

/* ============================================================
   1. 全屏遮罩
   ============================================================ */
.au-mask {
  position: fixed;
  inset: 0;
  z-index: 260;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background:
    radial-gradient(900px 420px at 50% -10%, rgba(56, 225, 255, .10), transparent 62%),
    rgba(3, 7, 13, .74);
  backdrop-filter: blur(9px) saturate(120%);
  -webkit-backdrop-filter: blur(9px) saturate(120%);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.au-mask.show { display: flex; }
.au-mask2 { z-index: 270; }

/* 玻璃卡片 */
.au-card {
  position: relative;
  width: 400px;
  max-width: 100%;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 24px 22px 18px;
  border-radius: 16px;
  border: 1px solid var(--line2);
  background:
    radial-gradient(520px 200px at 12% -14%, rgba(56, 225, 255, .13), transparent 62%),
    radial-gradient(420px 190px at 108% 0%, rgba(255, 184, 92, .07), transparent 58%),
    linear-gradient(180deg, rgba(19, 30, 47, .97), rgba(9, 14, 23, .985));
  box-shadow:
    0 24px 70px rgba(0, 0, 0, .62),
    0 0 0 1px rgba(56, 225, 255, .07),
    inset 0 1px 0 rgba(255, 255, 255, .05);
  animation: au-rise .22s cubic-bezier(.2, .8, .3, 1);
}
@keyframes au-rise {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to { opacity: 1; transform: none; }
}
/* 卡片顶部高光条 */
.au-card::before {
  content: "";
  position: absolute;
  left: 16%;
  right: 16%;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(56, 225, 255, .55), transparent);
  border-radius: 1px;
}

.au-card-login { width: 392px; }

/* ============================================================
   2. 品牌 / 标题
   ============================================================ */
.au-brand { display: flex; align-items: center; gap: 10px; }
.au-brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  font-size: 17px;
  color: #06131a;
  background: linear-gradient(135deg, var(--accent), #1b8fd6);
  border-radius: 11px;
  box-shadow: 0 0 22px rgba(56, 225, 255, .38);
  flex: 0 0 auto;
}
.au-brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.au-brand-text b {
  font-size: 17px;
  letter-spacing: .8px;
  background: linear-gradient(90deg, #eaf7ff, #8fdcff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.au-brand-text span { font-size: 9.5px; color: var(--text3); letter-spacing: 2.4px; }

.au-sub { margin: 12px 0 16px; font-size: 11.5px; color: var(--text3); line-height: 1.55; }

/* ============================================================
   3. Tab
   ============================================================ */
.au-tabs {
  display: flex;
  gap: 3px;
  padding: 3px;
  margin-bottom: 14px;
  background: rgba(0, 0, 0, .30);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.au-tab {
  flex: 1 1 0;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text3);
  font-family: var(--font);
  font-size: 12.5px;
  letter-spacing: .5px;
  cursor: pointer;
  transition: .16s;
}
.au-tab:hover { color: var(--text2); }
.au-tab.active {
  color: #05121a;
  font-weight: 600;
  background: linear-gradient(135deg, var(--accent), #24a9e6);
  box-shadow: 0 4px 14px rgba(56, 225, 255, .24);
}

/* ============================================================
   4. 表单
   ============================================================ */
.au-form { display: flex; flex-direction: column; gap: 10px; }

.au-field { display: flex; flex-direction: column; gap: 5px; }
.au-field > span { font-size: 10.5px; color: var(--text3); letter-spacing: .3px; }
.au-field input {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  background: rgba(0, 0, 0, .30);
  border: 1px solid var(--line2);
  border-radius: 9px;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  transition: .15s;
  -webkit-appearance: none;
  appearance: none;
}
.au-field input::placeholder { color: #4d6076; }
.au-field input:hover { border-color: #2d4056; }
.au-field input:focus {
  border-color: var(--accent-line);
  background: rgba(56, 225, 255, .05);
  box-shadow: 0 0 0 3px rgba(56, 225, 255, .10);
}

.au-error {
  min-height: 15px;
  font-size: 11.5px;
  line-height: 1.35;
  color: #ff5f70;
  padding-left: 1px;
  word-break: break-word;
}
.au-error:not(.show) { min-height: 0; }

.au-submit {
  height: 40px;
  margin-top: 2px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #1e97dd);
  color: #04121b;
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: .16s;
  box-shadow: 0 8px 22px rgba(56, 225, 255, .18);
}
.au-submit:hover { filter: brightness(1.07); }
.au-submit:active { transform: translateY(1px); }
.au-submit:disabled,
.au-submit.loading {
  cursor: progress;
  filter: grayscale(.25) brightness(.82);
  box-shadow: none;
}
.au-submit.loading { position: relative; }

.au-hint { margin-top: 2px; font-size: 10.5px; color: var(--text3); text-align: center; line-height: 1.5; }

/* ============================================================
   5. 顶栏用户区
   ============================================================ */
#user-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  max-width: 168px;
  padding: 0 8px 0 5px;
  background: rgba(255, 255, 255, .02);
  border: 1px solid var(--line2);
  border-radius: 999px;
  color: var(--text2);
  font-family: var(--font);
  font-size: 11.5px;
  cursor: pointer;
  transition: .15s;
  flex: 0 0 auto;
}
#user-chip:hover {
  border-color: var(--accent-line);
  color: var(--accent);
  background: var(--accent-dim);
}
#user-chip.au-admin { border-color: rgba(255, 184, 92, .38); }
#user-chip.au-admin:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-dim);
}

.au-avatar {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-family: var(--font);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  color: #06131a;
  background: linear-gradient(135deg, var(--accent), #1b8fd6);
  box-shadow: 0 0 10px rgba(56, 225, 255, .30);
}
#user-chip.au-admin .au-avatar { background: linear-gradient(135deg, var(--gold), #e08a35); box-shadow: 0 0 10px rgba(255, 184, 92, .28); }
.au-avatar.sm { width: 22px; height: 22px; font-size: 11px; }

.au-uname {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 104px;
}
.au-caret { font-size: 9px; opacity: .65; flex: 0 0 auto; }

/* 下拉菜单（fixed，body 直挂，避免顶栏换行影响定位） */
.au-menu {
  position: fixed;
  z-index: 280;
  min-width: 190px;
  padding: 5px;
  border: 1px solid var(--line2);
  border-radius: 11px;
  background: linear-gradient(180deg, #16233a, #0b1220);
  box-shadow: 0 16px 44px rgba(0, 0, 0, .6), 0 0 0 1px rgba(56, 225, 255, .06);
  animation: au-drop .14s ease-out;
}
@keyframes au-drop {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}
.au-menu-hd {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px 9px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.au-menu-hd .au-avatar { width: 22px; height: 22px; font-size: 11px; }
.au-menu-who { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.au-menu-who b {
  font-size: 12px;
  color: var(--text);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.au-menu-who em { font-style: normal; font-size: 9.5px; color: var(--text3); }

.au-menu-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  width: 100%;
  padding: 7px 9px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text2);
  font-family: var(--font);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  transition: .12s;
}
.au-menu-item:hover { background: rgba(56, 225, 255, .10); color: var(--accent); }
.au-menu-item.danger:hover { background: rgba(255, 77, 94, .13); color: #ff6474; }
.au-mi-hint { font-size: 9.5px; color: var(--text3); }
.au-menu-item:hover .au-mi-hint { color: inherit; opacity: .72; }
.au-menu-sep { height: 1px; margin: 4px 6px; background: var(--line); }

/* ============================================================
   6. 二级弹窗（邀请码 / 用户管理）
   ============================================================ */
.au-card-dlg { width: 520px; padding: 0; overflow: hidden; }
.au-card-sm { width: 460px; }
.au-card-md { width: 620px; }

.au-modal-hd {
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 12px 0 16px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
  background: rgba(255, 255, 255, .015);
}
.au-modal-hd h3 { font-size: 13px; font-weight: 600; color: var(--text2); letter-spacing: .6px; }
.au-x {
  margin-left: auto;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text3);
  font-size: 12px;
  cursor: pointer;
  transition: .12s;
}
.au-x:hover { background: rgba(255, 255, 255, .07); color: var(--text); }

.au-modal-bd {
  padding: 14px 16px 16px;
  overflow-y: auto;
  min-height: 0;
  flex: 1 1 auto;
  -webkit-overflow-scrolling: touch;
}

.au-dlg-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.au-muted { font-size: 10.5px; color: var(--text3); }
.au-sec-hd {
  margin: 16px 0 8px;
  font-size: 10.5px;
  letter-spacing: .8px;
  color: var(--text3);
  text-transform: uppercase;
}
.au-dlg-foot {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

/* 按钮 */
.au-btn {
  height: 30px;
  padding: 0 13px;
  border: 1px solid var(--line2);
  border-radius: 8px;
  background: rgba(255, 255, 255, .02);
  color: var(--text2);
  font-family: var(--font);
  font-size: 11.5px;
  cursor: pointer;
  transition: .15s;
  flex: 0 0 auto;
}
.au-btn:hover { border-color: var(--accent-line); color: var(--accent); background: var(--accent-dim); }
.au-btn.primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), #1e97dd);
  color: #04121b;
  font-weight: 700;
}
.au-btn.primary:hover { filter: brightness(1.07); color: #04121b; }
.au-btn.sm { height: 26px; padding: 0 9px; font-size: 11px; }
.au-btn.warn:hover {
  border-color: rgba(255, 77, 94, .45);
  color: #ff6474;
  background: rgba(255, 77, 94, .10);
}
.au-btn:disabled { opacity: .45; cursor: not-allowed; }

/* ============================================================
   7. 邀请码
   ============================================================ */
.au-code {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px dashed var(--accent-line);
  border-radius: 10px;
  background: rgba(56, 225, 255, .06);
  flex-wrap: wrap;
}
.au-code-txt {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 1.4px;
  color: var(--accent);
}
.au-code .au-btn { margin-left: auto; }

.au-list { display: flex; flex-direction: column; gap: 7px; }

.au-invite-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, .18);
}
.au-invite-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.au-invite-row .au-code-txt { font-size: 13px; }
.au-invite-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1 1 150px;
  min-width: 0;
}
.au-invite-meta em {
  font-style: normal;
  font-size: 10px;
  color: var(--text3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.au-invite-row .au-btn { margin-left: auto; }

/* 状态胶囊 */
.au-pill {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 7px;
  border: 1px solid var(--line2);
  border-radius: 999px;
  font-size: 9.5px;
  line-height: 1;
  color: var(--text3);
  flex: 0 0 auto;
  white-space: nowrap;
}
.au-pill.free { color: var(--accent); border-color: var(--accent-line); background: var(--accent-dim); }
.au-pill.used { color: var(--text3); }
.au-pill.admin { color: var(--gold); border-color: rgba(255, 184, 92, .38); background: var(--gold-dim); }
.au-pill.user { color: var(--text2); }
.au-pill.off { color: #ff6474; border-color: rgba(255, 77, 94, .38); background: rgba(255, 77, 94, .10); }
.au-pill.me { color: var(--text3); border-style: dashed; }

/* ============================================================
   8. 用户管理
   ============================================================ */
.au-users { display: flex; flex-direction: column; gap: 8px; }

.au-urow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, .18);
  transition: .15s;
}
.au-urow:hover { border-color: var(--line2); background: rgba(255, 255, 255, .022); }
.au-urow.off { opacity: .62; }

.au-uhead { display: flex; align-items: center; gap: 7px; min-width: 0; flex: 1 1 200px; }
.au-urow-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 150px;
}

.au-umeta { display: flex; gap: 14px; flex-wrap: wrap; flex: 1 1 240px; }
.au-meta-cell { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.au-meta-cell i { font-style: normal; font-size: 9px; color: var(--text3); letter-spacing: .3px; }
.au-meta-cell b {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text2);
  white-space: nowrap;
}

.au-uacts { display: flex; gap: 6px; margin-left: auto; flex: 0 0 auto; }

.au-empty {
  padding: 20px 12px;
  text-align: center;
  font-size: 11px;
  color: var(--text3);
  line-height: 1.6;
}

/* ============================================================
   9. auth 自己的一条轻提示（不复用 app.js 的 #toasts）
   ============================================================ */
#auth-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 300;
  max-width: calc(100vw - 32px);
  padding: 9px 14px;
  border: 1px solid var(--line2);
  border-left: 3px solid var(--accent);
  border-radius: 9px;
  background: rgba(13, 20, 32, .97);
  color: var(--text);
  font-size: 12px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
#auth-toast.show { opacity: 1; transform: translate(-50%, 0); }
#auth-toast.ok { border-left-color: #12d99a; }
#auth-toast.bad { border-left-color: #ff4d5e; }

/* ============================================================
   10. 响应式
   ============================================================ */
@media (max-width: 760px) {
  .au-mask { align-items: flex-start; padding: 14px 12px; }
  .au-card {
    width: 100%;
    max-width: 100%;
    max-height: calc(100vh - 28px);
    margin: auto;
    padding: 20px 17px 15px;
    border-radius: 14px;
  }
  .au-card-login { width: 100%; }
  .au-card-sm,
  .au-card-md { width: 100%; }
  .au-card-dlg { padding: 0; }
  .au-modal-bd { padding: 12px 13px 14px; max-height: calc(100vh - 120px); }
  .au-umeta { gap: 10px; flex: 1 1 100%; }
  .au-uacts { margin-left: 0; flex: 1 1 100%; justify-content: flex-end; }
  .au-invite-meta { flex: 1 1 100%; }
  .au-invite-row .au-btn { margin-left: 0; }
  .au-uname { max-width: 74px; }
}

@media (max-width: 420px) {
  .au-mask { padding: 10px 8px; }
  .au-card { padding: 18px 14px 13px; }
  .au-brand-mark { width: 34px; height: 34px; font-size: 15px; border-radius: 10px; }
  .au-brand-text b { font-size: 16px; }
  .au-sub { margin: 10px 0 13px; font-size: 11px; }
  .au-tab { font-size: 12px; }
  .au-field input { height: 36px; font-size: 13px; }
  .au-submit { height: 38px; }
  #user-chip { max-width: 132px; padding-right: 6px; }
  .au-uname { max-width: 62px; }
  .au-card-dlg .au-modal-hd { height: 40px; padding-left: 13px; }
  .au-urow { padding: 9px 10px; }
}

/* 管理弹窗：比登录墙更轻的遮罩，保证背景界面可辨认 */
.au-mask2 {
  background: rgba(3, 7, 13, .38);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}