/* ============================================================
 * 登录页 —— iOS 26 风格「液态玻璃」质感
 *   · 半透明磨砂 backdrop-filter 多层叠加
 *   · 缓慢流动的彩色光斑背景
 *   · 高光描边 + 内发光，明/暗主题自适应
 * ============================================================ */

#loginRoot {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-family: var(--font);
  background: var(--login-bg, #eef1f8);
  transition: opacity .45s ease, visibility .45s ease;
}

#loginRoot.hide { opacity: 0; visibility: hidden; pointer-events: none; }

/* 已登录 / 本地模式时登录层是空的 —— 必须彻底移出布局，否则会盖住整个系统 */
#loginRoot:empty { display: none; }

/* ---------- 流动光斑背景 ---------- */
.lg-aurora { position: absolute; inset: -20%; z-index: 0; overflow: hidden; filter: blur(0); }

.lg-blob {
  position: absolute;
  width: 46vmax;
  height: 46vmax;
  border-radius: 50%;
  opacity: .62;
  filter: blur(70px);
  will-change: transform;
}

.lg-b1 { background: radial-gradient(circle at 30% 30%, #6f8dff, #4a6cf7 60%, transparent 72%); top: -14%; left: -12%; animation: lgDrift1 26s ease-in-out infinite; }
.lg-b2 { background: radial-gradient(circle at 60% 40%, #56e3c8, #17b8a6 60%, transparent 72%); bottom: -20%; right: -14%; animation: lgDrift2 32s ease-in-out infinite; }
.lg-b3 { background: radial-gradient(circle at 40% 60%, #c98cff, #8b5cf6 60%, transparent 72%); top: 30%; right: 18%; opacity: .45; animation: lgDrift3 38s ease-in-out infinite; }
.lg-b4 { background: radial-gradient(circle at 50% 50%, #ffc46b, #ff8a3d 60%, transparent 72%); bottom: 6%; left: 16%; opacity: .34; animation: lgDrift4 44s ease-in-out infinite; }

@keyframes lgDrift1 { 0%, 100% { transform: translate3d(0, 0, 0) scale(1); } 33% { transform: translate3d(9vw, 7vh, 0) scale(1.12); } 66% { transform: translate3d(-5vw, 11vh, 0) scale(.94); } }
@keyframes lgDrift2 { 0%, 100% { transform: translate3d(0, 0, 0) scale(1); } 40% { transform: translate3d(-11vw, -8vh, 0) scale(1.14); } 70% { transform: translate3d(-4vw, 6vh, 0) scale(.92); } }
@keyframes lgDrift3 { 0%, 100% { transform: translate3d(0, 0, 0) scale(1); } 50% { transform: translate3d(-9vw, 10vh, 0) scale(1.18); } }
@keyframes lgDrift4 { 0%, 100% { transform: translate3d(0, 0, 0) scale(1); } 45% { transform: translate3d(10vw, -9vh, 0) scale(1.1); } }

/* 顶部柔光 + 底部压暗，让卡片浮起来 */
.lg-veil {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(255, 255, 255, .55), transparent 60%),
    linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(15, 23, 42, .06));
}

[data-theme="dark"] .lg-veil {
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(120, 160, 255, .22), transparent 60%),
    linear-gradient(180deg, rgba(10, 14, 24, .35), rgba(4, 6, 12, .55));
}

/* 极细颗粒，消除大面积渐变的色带 */
.lg-grain {
  position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.045'/%3E%3C/svg%3E");
}

/* ---------- 双栏布局：左介绍面板 + 右登录卡 ---------- */
.lg-cols {
  position: relative; z-index: 2;
  width: 100%; max-width: 1120px;
  padding: 24px;
  display: flex; align-items: center; justify-content: center;
  gap: clamp(40px, 8vw, 120px);
}
.lg-info { max-width: 460px; animation: lgIn .7s cubic-bezier(.22, 1, .36, 1) both; }

/* 左面板主标题（原小标语位置，已放大） */
.lg-info-title {
  font-size: 30px; font-weight: 800; letter-spacing: 1.5px;
  line-height: 1.3; word-break: break-word;
  color: var(--primary, #3d6df5);
}
.lg-info-desc {
  margin-top: 14px;
  font-size: 13.5px; line-height: 1.9; color: var(--text2);
}
.lg-info-cards {
  margin-top: 26px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.lg-icard {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 13px 14px; border-radius: 16px;
  background: rgba(255, 255, 255, .42);
  border: 1px solid rgba(255, 255, 255, .6);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  box-shadow: 0 4px 16px -8px rgba(19, 30, 66, .16), inset 0 1px 0 rgba(255, 255, 255, .8);
  transition: transform .2s, box-shadow .2s;
}
.lg-icard:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -10px rgba(19, 30, 66, .26), inset 0 1px 0 rgba(255, 255, 255, .8); }
.lg-icard-ico {
  flex: none; width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center; font-size: 17px;
  background: linear-gradient(145deg, rgba(91, 134, 255, .16), rgba(61, 109, 245, .1));
  border: 1px solid rgba(61, 109, 245, .18);
}
.lg-icard-txt { min-width: 0; }
.lg-icard-txt b { display: block; font-size: 13.5px; color: var(--text); line-height: 1.4; }
.lg-icard-txt span { display: block; margin-top: 2px; font-size: 11.5px; line-height: 1.6; color: var(--text3); }
.lg-info-tags { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 8px; }
.lg-itag {
  padding: 4px 12px; border-radius: 999px;
  font-size: 11.5px; color: var(--text2);
  background: rgba(255, 255, 255, .4);
  border: 1px solid rgba(255, 255, 255, .55);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}

[data-theme="dark"] .lg-icard {
  background: rgba(24, 31, 47, .5);
  border-color: rgba(255, 255, 255, .1);
  box-shadow: 0 4px 16px -8px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .08);
}
[data-theme="dark"] .lg-icard:hover { box-shadow: 0 10px 24px -10px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .08); }
[data-theme="dark"] .lg-icard-ico { background: rgba(91, 134, 255, .14); border-color: rgba(91, 134, 255, .22); }
[data-theme="dark"] .lg-itag { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .12); }
[data-theme="dark"] .lg-info-desc { color: #c5cfe0; }
[data-theme="dark"] .lg-icard-txt span { color: #9dabc4; }
[data-theme="dark"] .lg-info-title { color: #8fb2ff; }
[data-theme="dark"] .lg-icard-txt b { color: #eef2fa; }

/* 窄屏：隐藏左侧介绍，只留登录卡 */
@media (max-width: 980px) {
  .lg-cols { gap: 0; }
  .lg-info { display: none; }
}

/* ---------- 玻璃卡片 ---------- */
.lg-wrap { position: relative; z-index: 2; width: 100%; max-width: 412px; padding: 0; flex: none; }

.lg-card {
  position: relative;
  padding: 40px 34px 30px;
  border-radius: 30px;
  background: var(--lg-card-bg, rgba(255, 255, 255, .58));
  -webkit-backdrop-filter: blur(34px) saturate(190%);
  backdrop-filter: blur(34px) saturate(190%);
  border: 1px solid var(--lg-card-line, rgba(255, 255, 255, .78));
  box-shadow:
    0 28px 70px -22px rgba(19, 30, 66, .38),
    0 6px 20px -10px rgba(19, 30, 66, .22),
    inset 0 1px 0 rgba(255, 255, 255, .95),
    inset 0 -1px 0 rgba(255, 255, 255, .28);
  animation: lgIn .62s cubic-bezier(.22, 1, .36, 1) both;
}

@keyframes lgIn { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }

/* 卡片顶部一道流动高光 */
.lg-card::before {
  content: '';
  position: absolute; left: 12%; right: 12%; top: -1px; height: 1.5px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .95), transparent);
  opacity: .9;
}

[data-theme="dark"] .lg-card {
  background: rgba(24, 31, 47, .62);
  border-color: rgba(255, 255, 255, .13);
  box-shadow:
    0 28px 70px -22px rgba(0, 0, 0, .72),
    0 6px 20px -10px rgba(0, 0, 0, .5),
    inset 0 1px 0 rgba(255, 255, 255, .14),
    inset 0 -1px 0 rgba(255, 255, 255, .04);
}
[data-theme="dark"] .lg-card::before { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .42), transparent); }

/* ---------- 品牌区（纯文字副标语作主标识，无公司名大标题） ---------- */
.lg-brand { text-align: center; margin-bottom: 30px; }

.lg-sub {
  font-size: 21px; font-weight: 700; letter-spacing: 1px;
  color: var(--text); line-height: 1.4;
  word-break: break-word;
}
.lg-brand::after {
  content: '';
  display: block; width: 46px; height: 2px; margin: 14px auto 0;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--primary, #3d6df5), transparent);
  opacity: .7;
}

/* ---------- 表单 ---------- */
.lg-form { display: block; }

.lg-field { position: relative; margin-bottom: 14px; }

.lg-field .lg-ico {
  position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
  font-size: 15px; opacity: .55; pointer-events: none; line-height: 1;
}

.lg-input {
  width: 100%;
  height: 52px;
  padding: 0 44px 0 44px;
  box-sizing: border-box;
  font-size: 15px;
  color: var(--text);
  border-radius: 16px;
  border: 1px solid var(--lg-input-line, rgba(255, 255, 255, .85));
  background: var(--lg-input-bg, rgba(255, 255, 255, .62));
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: inset 0 1px 2px rgba(19, 30, 66, .06), 0 1px 0 rgba(255, 255, 255, .55);
  outline: none;
  transition: border-color .18s, box-shadow .18s, background .18s;
  font-family: var(--font);
}

.lg-input::placeholder { color: var(--text3); }

.lg-input:focus {
  border-color: rgba(61, 109, 245, .72);
  background: var(--lg-input-bg-focus, rgba(255, 255, 255, .86));
  box-shadow: 0 0 0 4px rgba(61, 109, 245, .16), inset 0 1px 2px rgba(19, 30, 66, .05);
}

.lg-input.err { border-color: rgba(245, 63, 63, .8); box-shadow: 0 0 0 4px rgba(245, 63, 63, .14); }

[data-theme="dark"] .lg-input {
  border-color: rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .06);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .3);
  color: #e8ecf4;
}
[data-theme="dark"] .lg-input:focus { background: rgba(255, 255, 255, .1); }
[data-theme="dark"] .lg-input::placeholder { color: #6d788c; }

/* 显示/隐藏密码 */
.lg-eye {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; border: 0; border-radius: 9px;
  background: transparent; color: var(--text3); cursor: pointer;
  font-size: 14px; line-height: 1; display: grid; place-items: center;
  transition: background .15s, color .15s;
}
.lg-eye:hover { background: rgba(127, 140, 168, .16); color: var(--text2); }

/* 记住我 */
.lg-row { display: flex; align-items: center; justify-content: space-between; margin: 4px 2px 20px; }
.lg-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text2); cursor: pointer; user-select: none; }
.lg-check input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.lg-hint { font-size: 12px; color: var(--text3); }

/* 登录按钮 */
.lg-btn {
  width: 100%;
  height: 52px;
  border: 0;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 2px;
  color: #fff;
  cursor: pointer;
  font-family: var(--font);
  background: linear-gradient(140deg, #5b86ff, #3d6df5 48%, #2f55d4);
  box-shadow:
    0 14px 28px -12px rgba(61, 109, 245, .8),
    inset 0 1px 0 rgba(255, 255, 255, .45),
    inset 0 -10px 22px -14px rgba(0, 0, 0, .4);
  transition: transform .14s ease, box-shadow .2s ease, opacity .2s;
  position: relative;
  overflow: hidden;
}

.lg-btn:hover { transform: translateY(-1px); box-shadow: 0 18px 34px -12px rgba(61, 109, 245, .88), inset 0 1px 0 rgba(255, 255, 255, .5), inset 0 -10px 22px -14px rgba(0, 0, 0, .4); }
.lg-btn:active { transform: translateY(0) scale(.99); }
.lg-btn:disabled { opacity: .62; cursor: default; transform: none; }

/* 按钮上的扫光 */
.lg-btn::after {
  content: ''; position: absolute; top: 0; left: -40%; width: 40%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .42), transparent);
  animation: lgSheen 3.6s ease-in-out infinite;
}
@keyframes lgSheen { 0% { left: -40%; } 55% { left: 120%; } 100% { left: 120%; } }

/* 错误提示 */
.lg-err {
  display: none;
  align-items: center; gap: 8px;
  margin: 0 0 14px;
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 13px; line-height: 1.5;
  color: #b42318;
  background: rgba(245, 63, 63, .1);
  border: 1px solid rgba(245, 63, 63, .26);
}
.lg-err.on { display: flex; animation: lgShake .42s; }
@keyframes lgShake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }

[data-theme="dark"] .lg-err { color: #ffb3ae; background: rgba(255, 107, 107, .13); border-color: rgba(255, 107, 107, .3); }

.lg-err.ok { color: #0a7a54; background: rgba(0, 181, 120, .12); border-color: rgba(0, 181, 120, .3); }
[data-theme="dark"] .lg-err.ok { color: #7ee0bd; }

/* 底部 */
.lg-foot { margin-top: 22px; text-align: center; font-size: 12px; color: var(--text3); line-height: 1.7; }
.lg-foot b { color: var(--text2); font-weight: 600; }

/* 运行模式标识（服务端 / 本地） */
.lg-mode {
  display: flex; align-items: center; gap: 6px; width: fit-content;
  margin: 18px auto 0; padding: 5px 12px;
  border-radius: 999px;
  font-size: 11.5px; color: var(--text3);
  border: 1px solid var(--line2, rgba(0, 0, 0, .08));
  background: rgba(255, 255, 255, .34);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.lg-mode .lg-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--orange, #ff7d00); }
.lg-mode.on .lg-dot { background: var(--green, #00b578); }
[data-theme="dark"] .lg-mode { border-color: rgba(255, 255, 255, .13); background: rgba(255, 255, 255, .06); }

/* 侧边栏「本地单机模式」角标 */
.local-flag {
  display: inline-block; margin-top: 4px; padding: 1px 8px;
  border-radius: 999px; font-size: 11px;
  color: var(--orange); background: var(--orange-bg);
}

.lg-theme {
  position: absolute; top: 18px; right: 18px; z-index: 3;
  width: 38px; height: 38px; border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .6);
  background: rgba(255, 255, 255, .42);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  color: var(--text2); font-size: 16px; cursor: pointer;
  display: grid; place-items: center;
}
.lg-theme:hover { background: rgba(255, 255, 255, .62); }
[data-theme="dark"] .lg-theme { border-color: rgba(255, 255, 255, .14); background: rgba(255, 255, 255, .08); color: #cbd4e4; }

/* ---------- 首次登录强制改密 ---------- */
.lg-sec { display: none; }
.lg-sec.on { display: block; }

@media (max-width: 460px) {
  .lg-cols { padding: 16px; }
  .lg-card { padding: 32px 22px 24px; border-radius: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  .lg-blob, .lg-btn::after { animation: none; }
  .lg-card { animation: none; }
}

/* ============ 顶栏用户信息 & 同步状态 ============ */
.usr-chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 10px 0 6px; margin-left: 8px;
  border-radius: 17px; cursor: pointer;
  border: 1px solid var(--line2); background: var(--card);
  color: var(--text2); font-size: 13px; white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.usr-chip:hover { background: var(--th-hover); border-color: var(--primary); color: var(--primary); }
.usr-ava {
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; color: #fff; font-weight: 600;
  background: linear-gradient(145deg, #5b86ff, #2f55d4);
}
.usr-role { font-size: 11px; color: var(--text3); }

.sync-dot {
  display: inline-flex; align-items: center; gap: 5px;
  margin-left: 8px; font-size: 12px; color: var(--text3);
}
.sync-dot i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); display: inline-block; }
.sync-dot.saving i { background: var(--orange); animation: syncPulse .9s infinite; }
.sync-dot.err { color: var(--red); }
.sync-dot.err i { background: var(--red); }
@keyframes syncPulse { 0%, 100% { opacity: 1; } 50% { opacity: .28; } }

/* 冲突提示条 */
.conflict-bar {
  display: none; align-items: center; gap: 10px;
  padding: 9px 14px; font-size: 13px;
  background: var(--orange-bg); color: var(--orange);
  border-bottom: 1px solid var(--line);
}
.conflict-bar.on { display: flex; }
.conflict-bar .btn { margin-left: auto; }
