/* ==========================================================================
   GW-Auth v2 · 统一登录主题层
   · 作用域：仅当 <html class="gwauth-theme"> 时生效（由 gw-auth.js 添加）
   · 目标：20 套系统登录页视觉统一（品牌蓝白 + 统一卡片/输入框/按钮），
           同时隐藏注册入口、强化「申请账号」。
   · 零侵入：不改动各系统 DOM 结构与提交逻辑，仅做样式覆盖与元素增删。
   ========================================================================== */

html.gwauth-theme {
  /* ---- GallopWave 设计令牌 ---- */
  --gw-primary: #2b4ea2;
  --gw-primary-600: #23408a;
  --gw-primary-050: #eef2fb;
  --gw-accent: #e8b23a;
  --gw-text: #1f2733;
  --gw-text-sub: #7a8499;
  --gw-border: #dfe4ee;
  --gw-radius: 14px;
  --gw-radius-lg: 18px;
  --gw-shadow-card: 0 18px 50px rgba(20, 32, 70, .13);
  --gw-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
             "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

/* ---- 页面底色：柔和品牌渐层（不影响卡片可读性） ---- */
html.gwauth-theme body {
  background: linear-gradient(160deg, #f5f7fc 0%, #eaeefb 45%, #e6ecfa 100%) !important;
  background-attachment: fixed !important;
  font-family: var(--gw-font);
}

/* ---- 登录卡片统一 ---- */
html.gwauth-theme .gwauth-card {
  background: #fff !important;
  border: 1px solid rgba(43, 78, 162, .10) !important;
  border-radius: var(--gw-radius-lg) !important;
  box-shadow: var(--gw-shadow-card) !important;
  padding: 30px 28px 26px !important;
  box-sizing: border-box !important;
  font-family: var(--gw-font) !important;
  color: var(--gw-text) !important;
  max-width: 420px !important;
  margin-left: auto !important;
  margin-right: auto !important;
}
/* 安全网：选中偏宽容器（>560px）时不限宽，避免把宿主整页布局夹扁 */
html.gwauth-theme .gwauth-card.gwauth-card-wide {
  max-width: none !important;
  width: auto !important;
}
html.gwauth-theme .gwauth-card form {
  margin: 0 !important;
  font-family: var(--gw-font) !important;
}

/* ---- 表单控件统一 ---- */
html.gwauth-theme .gwauth-card input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
html.gwauth-theme .gwauth-card select,
html.gwauth-theme .gwauth-card textarea {
  width: 100% !important;
  box-sizing: border-box !important;
  height: 46px !important;
  padding: 0 14px !important;
  border: 1px solid var(--gw-border) !important;
  border-radius: var(--gw-radius) !important;
  background: #fbfcfe !important;
  font-size: 15px !important;
  font-family: var(--gw-font) !important;
  color: var(--gw-text) !important;
  outline: none !important;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease !important;
}
html.gwauth-theme .gwauth-card textarea {
  height: auto !important;
  padding: 10px 14px !important;
}
html.gwauth-theme .gwauth-card input:not([type="checkbox"]):not([type="radio"]):focus,
html.gwauth-theme .gwauth-card select:focus,
html.gwauth-theme .gwauth-card textarea:focus {
  border-color: var(--gw-primary) !important;
  background: #fff !important;
  box-shadow: 0 0 0 3px rgba(43, 78, 162, .13) !important;
}
html.gwauth-theme .gwauth-card input::placeholder {
  color: #aab2c2 !important;
}
html.gwauth-theme .gwauth-card label {
  font-size: 13px !important;
  color: #55617a !important;
  font-family: var(--gw-font) !important;
}

/* ---- 主按钮统一 ---- */
html.gwauth-theme .gwauth-card button[type="submit"],
html.gwauth-theme .gwauth-card .gwauth-primary {
  width: 100% !important;
  height: 46px !important;
  border: 0 !important;
  border-radius: var(--gw-radius) !important;
  background: linear-gradient(180deg, var(--gw-primary) 0%, var(--gw-primary-600) 100%) !important;
  color: #fff !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  letter-spacing: .5px !important;
  cursor: pointer !important;
  box-shadow: 0 6px 16px rgba(43, 78, 162, .26) !important;
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease !important;
  font-family: var(--gw-font) !important;
}
html.gwauth-theme .gwauth-card button[type="submit"]:hover,
html.gwauth-theme .gwauth-card .gwauth-primary:hover {
  filter: brightness(1.06) !important;
  box-shadow: 0 8px 22px rgba(43, 78, 162, .32) !important;
}
html.gwauth-theme .gwauth-card button[type="submit"]:active,
html.gwauth-theme .gwauth-card .gwauth-primary:active {
  transform: translateY(1px) !important;
}
html.gwauth-theme .gwauth-card button[type="submit"]:disabled,
html.gwauth-theme .gwauth-card .gwauth-primary:disabled {
  filter: none !important;
  background: #b9c4dd !important;
  box-shadow: none !important;
  cursor: not-allowed !important;
}

/* ---- 复选框（记住我）统一 ---- */
html.gwauth-theme .gwauth-card input[type="checkbox"] {
  accent-color: var(--gw-primary) !important;
  width: 15px !important;
  height: 15px !important;
}

/* ---- 统一品牌头 ---- */
.gwauth-brand {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 10px !important;
  margin: 0 0 20px !important;
  text-align: center !important;
  font-family: var(--gw-font) !important;
}
.gwauth-brand img {
  width: 58px !important;
  height: 58px !important;
  object-fit: contain !important;
  background: #fff !important;
  border-radius: 16px !important;
  padding: 8px !important;
  box-shadow: 0 4px 14px rgba(20, 32, 70, .13) !important;
  border: 1px solid rgba(43, 78, 162, .08) !important;
  box-sizing: border-box !important;
}
.gwauth-brand-name {
  font-size: 17px !important;
  font-weight: 700 !important;
  color: var(--gw-text) !important;
  letter-spacing: .6px !important;
}
.gwauth-brand-sub {
  font-size: 12px !important;
  color: var(--gw-text-sub) !important;
  letter-spacing: .3px !important;
}

/* ---- 企业代码字段 ---- */
.gwauth-tenant {
  margin-bottom: 12px !important;
  font-family: var(--gw-font) !important;
}
.gwauth-tenant label {
  display: block !important;
  font-size: 13px !important;
  color: #55617a !important;
  margin-bottom: 6px !important;
}
.gwauth-tenant label .hint {
  color: #a3abbb !important;
  font-weight: 400 !important;
}
.gwauth-tenant .row {
  position: relative !important;
}
.gwauth-tenant input {
  padding-right: 76px !important;
  text-transform: uppercase !important;
}
.gwauth-tenant .clear {
  position: absolute !important;
  right: 8px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  border: 0 !important;
  background: #eef1f8 !important;
  color: #6b7588 !important;
  font-size: 12px !important;
  border-radius: 8px !important;
  padding: 5px 9px !important;
  cursor: pointer !important;
  font-family: var(--gw-font) !important;
}
.gwauth-tenant .clear:hover {
  background: #e2e7f2 !important;
  color: var(--gw-primary) !important;
}

/* ---- 密码显隐 ---- */
.gwauth-eye {
  position: absolute !important;
  right: 10px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  width: 32px !important;
  height: 32px !important;
  border: 0 !important;
  background: transparent !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: #8a94a6 !important;
  z-index: 5 !important;
  font-size: 16px !important;
  line-height: 1 !important;
  padding: 0 !important;
}
.gwauth-eye:hover { color: var(--gw-primary) !important; }
.gwauth-pwd-wrap { position: relative !important; }

/* ---- toast ---- */
.gwauth-toast {
  position: fixed !important;
  left: 50% !important;
  bottom: 32px !important;
  transform: translateX(-50%) translateY(20px) !important;
  background: rgba(20, 24, 33, .94) !important;
  color: #fff !important;
  padding: 11px 18px !important;
  border-radius: 12px !important;
  font-size: 14px !important;
  z-index: 999999 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity .22s ease, transform .22s ease !important;
  max-width: 86vw !important;
  box-shadow: 0 10px 34px rgba(0, 0, 0, .26) !important;
  font-family: var(--gw-font) !important;
}
.gwauth-toast.show { opacity: 1 !important; transform: translateX(-50%) translateY(0) !important; }
.gwauth-toast.err { background: rgba(200, 40, 40, .96) !important; }
.gwauth-toast.ok { background: rgba(24, 145, 88, .96) !important; }

/* ---- 底部：申请账号 / 第三方 ---- */
.gwauth-extra {
  margin-top: 18px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
  align-items: center !important;
  font-family: var(--gw-font) !important;
}
.gwauth-divider {
  width: 100% !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  color: #a3abbb !important;
  font-size: 12px !important;
}
.gwauth-divider::before,
.gwauth-divider::after {
  content: "" !important;
  flex: 1 !important;
  height: 1px !important;
  background: #e7ebf3 !important;
}
.gwauth-social { display: flex !important; gap: 12px !important; justify-content: center !important; }
.gwauth-social button {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  border: 1px solid var(--gw-border) !important;
  background: #fff !important;
  color: var(--gw-text) !important;
  border-radius: var(--gw-radius) !important;
  padding: 9px 16px !important;
  font-size: 13px !important;
  cursor: pointer !important;
  transition: .15s !important;
  font-family: var(--gw-font) !important;
}
.gwauth-social button:hover { border-color: var(--gw-primary) !important; color: var(--gw-primary) !important; }
.gwauth-social .ic { font-size: 16px !important; }
.gwauth-social .soon { opacity: .55 !important; cursor: not-allowed !important; }

.gwauth-request {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  background: var(--gw-primary-050) !important;
  border: 1px dashed rgba(43, 78, 162, .35) !important;
  color: var(--gw-primary) !important;
  font-size: 13.5px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  border-radius: 12px !important;
  padding: 10px 16px !important;
  transition: .15s !important;
  font-family: var(--gw-font) !important;
  text-decoration: none !important;
}
.gwauth-request:hover {
  background: #e3eaf9 !important;
  border-color: var(--gw-primary) !important;
}
.gwauth-footnote {
  font-size: 12px !important;
  color: #a3abbb !important;
  text-align: center !important;
  line-height: 1.7 !important;
  font-family: var(--gw-font) !important;
}
.gwauth-footnote a { color: var(--gw-primary) !important; text-decoration: none !important; }

/* ---- 申请账号弹窗 ---- */
.gwauth-mask {
  position: fixed !important;
  inset: 0 !important;
  background: rgba(15, 20, 30, .5) !important;
  display: none !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 999998 !important;
  padding: 16px !important;
  font-family: var(--gw-font) !important;
}
.gwauth-mask.open { display: flex !important; }
.gwauth-modal {
  width: 100% !important;
  max-width: 400px !important;
  max-height: 88vh !important;
  overflow: auto !important;
  background: #fff !important;
  border-radius: 18px !important;
  padding: 24px !important;
  box-shadow: 0 22px 64px rgba(0, 0, 0, .3) !important;
  font-size: 14px !important;
  color: var(--gw-text) !important;
  box-sizing: border-box !important;
}
.gwauth-modal h3 { margin: 0 0 4px !important; font-size: 19px !important; }
.gwauth-modal p.sub { margin: 0 0 16px !important; color: var(--gw-text-sub) !important; font-size: 12.5px !important; }
.gwauth-field { margin-bottom: 13px !important; }
.gwauth-field label {
  display: block !important;
  margin-bottom: 6px !important;
  color: #55617a !important;
  font-size: 13px !important;
}
.gwauth-field label .opt { color: #a3abbb !important; font-weight: 400 !important; }
.gwauth-field input,
.gwauth-field select,
.gwauth-field textarea {
  width: 100% !important;
  box-sizing: border-box !important;
  padding: 11px 13px !important;
  border: 1px solid var(--gw-border) !important;
  border-radius: var(--gw-radius) !important;
  font-size: 14px !important;
  outline: none !important;
  transition: .15s !important;
  font-family: var(--gw-font) !important;
  background: #fbfcfe !important;
}
.gwauth-field input:focus,
.gwauth-field select:focus,
.gwauth-field textarea:focus {
  border-color: var(--gw-primary) !important;
  background: #fff !important;
  box-shadow: 0 0 0 3px rgba(43, 78, 162, .13) !important;
}
.gwauth-field .err { color: #d83a3a !important; font-size: 12px !important; margin-top: 5px !important; display: none !important; }
.gwauth-field.invalid input,
.gwauth-field.invalid select { border-color: #d83a3a !important; }
.gwauth-field.invalid .err { display: block !important; }
.gwauth-actions { display: flex !important; gap: 10px !important; margin-top: 8px !important; }
.gwauth-actions button {
  flex: 1 !important;
  padding: 12px !important;
  border-radius: var(--gw-radius) !important;
  font-size: 14.5px !important;
  cursor: pointer !important;
  border: 0 !important;
  font-family: var(--gw-font) !important;
}
.gwauth-actions .primary {
  background: linear-gradient(180deg, var(--gw-primary) 0%, var(--gw-primary-600) 100%) !important;
  color: #fff !important;
  font-weight: 600 !important;
}
.gwauth-actions .primary:disabled { background: #b9c4dd !important; cursor: not-allowed !important; }
.gwauth-actions .ghost { background: #f1f3f8 !important; color: #55617a !important; }
.gwauth-tip { font-size: 12px !important; color: var(--gw-text-sub) !important; margin-top: 12px !important; line-height: 1.7 !important; }

/* ---- 隐藏注册入口（由 JS 打类，也可直接命中） ---- */
.gwauth-hide-reg { display: none !important; }

/* ---- 移动端 ---- */
@media (max-width: 540px) {
  html.gwauth-theme .gwauth-card { padding: 24px 20px 20px !important; }
  .gwauth-modal { padding: 18px !important; }
  .gwauth-social { flex-wrap: wrap !important; }
}
