/* shared-tokens 由 login.html <link> 引入；此处仅覆盖登录气质 */
:root {
  --radius: 22px;
  --radius-sm: 12px;
  --shadow: 0 22px 48px rgba(8, 24, 42, 0.28);
}

* {
  box-sizing: border-box;
}

/* 手机端登录：隐藏横竖滚动条（手势仍可滚，不占屏宽） */
html,
body,
* {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
*::-webkit-scrollbar {
  width: 0 !important;
  height: 0 !important;
  display: none !important;
  background: transparent;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.hidden {
  display: none !important;
}

/* 无会话 / 扫码整改：首屏直接表单（与 head 内联 login-ready 一致） */
html.login-ready #bootSplash {
  display: none !important;
}
html.login-ready #loginView.hidden {
  display: flex !important;
}

/* 启动屏：登录态校验期间显示品牌加载态，避免登录表单闪现 */
.boot {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #f2f4f7;
  color: #5a6472;
  font-size: 15px;
}

.boot-logo {
  width: 88px;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2px;
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
}

.boot-logo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.boot-name {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 700;
  color: #163a5f;
  letter-spacing: 0.02em;
}

.boot-spin {
  width: 20px;
  height: 20px;
  margin-top: 4px;
  border: 2px solid #d7e0ea;
  border-top-color: #163a5f;
  border-radius: 50%;
  animation: bootSpin 0.8s linear infinite;
}

.boot-text {
  margin: 0;
  font-size: 0.82rem;
  color: #8a94a6;
}

@keyframes bootSpin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .boot-spin {
    animation-duration: 2.4s;
  }
}

.shell {
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
}

.login {
  position: relative;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  /* safe center：有空间时居中，空间不足时自动改为顶部对齐，避免登录框被裁掉 */
  justify-content: safe center;
  gap: 30px;
  overflow: hidden;
  /* 底部留白大于顶部：把「标题+登录框」整体上抬，使登录框落在屏幕正中 */
  padding: 28px 22px 140px;
  color: #fff;
  background:
    radial-gradient(120% 70% at 12% -8%, rgba(232, 163, 23, 0.22), transparent 52%),
    radial-gradient(90% 50% at 100% 18%, rgba(120, 170, 220, 0.16), transparent 48%),
    linear-gradient(168deg, var(--navy-hover, #1a456e) 0%, var(--navy-deep) 48%, var(--navy) 100%);
}

.login::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -18deg,
    transparent,
    transparent 14px,
    rgba(255, 255, 255, 0.025) 14px,
    rgba(255, 255, 255, 0.025) 15px
  );
  pointer-events: none;
}

.login-brand {
  position: relative;
  z-index: 1;
  margin-top: 0;
  animation: rise 0.55s ease-out both;
}

.mark {
  display: none;
}

.login-brand h1 {
  margin: 0 0 10px;
  font-size: 2.35rem;
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.03em;
}

.login-brand p {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.95rem;
  line-height: 1.55;
  max-width: 16em;
}

.login-form {
  position: relative;
  z-index: 1;
  margin-top: 0;
  background: #fff;
  color: var(--ink);
  border-radius: var(--radius);
  padding: 22px 18px 20px;
  box-shadow: var(--shadow);
  animation: rise 0.55s ease-out 0.08s both;
}

.login-form h2 {
  margin: 0 0 16px;
  font-size: 1.08rem;
  font-weight: 650;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 500;
}

.project-locked {
  border: 1px solid #c5d0dc;
  border-radius: 10px;
  padding: 10px 12px;
  background: #f3f6f9;
  color: #163a5f;
  font-weight: 650;
  min-height: 42px;
  display: flex;
  align-items: center;
}

.project-locked.is-empty {
  color: #9aa7b5;
  font-weight: 500;
}

.field input,
.field select {
  width: 100%;
  border: 1px solid var(--line-strong, #d8e0ea);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  font: inherit;
  font-size: 1rem;
  background: var(--navy-soft, #f7f9fc);
  color: var(--ink);
  transition: border-color var(--motion) var(--ease, ease), background var(--motion) var(--ease, ease),
    box-shadow var(--motion) var(--ease, ease);
}

.field input:focus {
  outline: none;
  border-color: var(--brand-2, #1f4e79);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(22, 58, 95, 0.16);
}

.field-error {
  min-height: 1.2em;
  margin: 2px 0 12px;
  font-size: 0.8rem;
  color: var(--danger);
}

.hint-box {
  display: none;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 12px;
  padding: 14px 16px;
  min-height: var(--touch-min);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: background var(--motion) ease, opacity var(--motion) ease;
}

.btn.block {
  display: block;
  width: 100%;
}

.btn.primary {
  background: var(--navy);
  color: #fff;
}

.btn.primary:active {
  background: var(--navy-deep);
  opacity: 0.96;
}

.btn.primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}

/* 桌面端：系统管理入口（可折叠） */
.sys-login-wrap {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}

.sys-login-fold {
  align-self: center;
  margin: 0;
  padding: 4px 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  opacity: 0.85;
}

.sys-login-fold:hover {
  color: var(--ink);
  opacity: 1;
}

.sys-login-panel .btn.ghost {
  width: 100%;
}

.btn:focus-visible,
.desk-link:focus-visible,
.login-form input:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.desk {
  min-height: 100dvh;
  padding: 24px 18px 32px;
  background:
    radial-gradient(120% 80% at 100% -10%, rgba(232, 163, 23, 0.12), transparent 55%),
    linear-gradient(180deg, #e8eef5 0%, var(--paper) 40%);
  animation: rise 0.45s ease-out both;
}

.desk-top h1 {
  margin: 10px 0 4px;
  font-size: 1.65rem;
  letter-spacing: -0.02em;
}

.desk-top .sub {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.9rem;
}

.desk-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.desk-link {
  display: block;
  padding: 16px 16px;
  background: #fff;
  border-radius: 14px;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 0 rgba(22, 58, 95, 0.04);
  border: 1px solid rgba(22, 58, 95, 0.06);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.desk-link:active {
  transform: scale(0.99);
}

.desk-link-t {
  display: block;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 4px;
}

.desk-link-d {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
}

.desk-link-primary {
  border-color: var(--navy);
  background: linear-gradient(180deg, #fff 0%, #f0f5fb 100%);
  box-shadow: var(--shadow-sm);
}

.desk-link-primary .desk-link-t {
  color: var(--navy);
  font-weight: 700;
}

.desk-more {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.desk-more summary {
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  padding: 8px 0;
  list-style: none;
}

.desk-more summary::-webkit-details-marker {
  display: none;
}

.desk-more[open] summary {
  color: var(--navy);
  margin-bottom: 8px;
}

.desk-more .desk-link {
  margin-top: 8px;
}

.desk .btn.ghost {
  margin-top: 8px;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .login-brand,
  .login-form,
  .desk {
    animation: none;
  }
}
