/* == css/app/auth-modal.css · PC 端登录/注册/找回密码弹窗 ==
 *
 * 定位：工作台内的登录入口不再整页跳转，改为覆盖在当前页之上的模态层。
 * 设计语言完全对齐 workspace.css：
 *   圆角 12px（同 ws-table-card）· 描边 --border-light · 主色 --blue
 *   字号 13px 正文 / 12px 辅助（同工单表格）· 无阴影堆叠，仅一层浮起投影
 * 遮罩使用半透明黑而非模糊，克制且性能友好。
 *
 * 命名空间 am-（auth modal），与 .auth-* （独立登录页）完全隔离，互不影响。
 * 仅在桌面端注入；移动端不加载此组件。
 * ========================================================================== */

/* ---------- 遮罩层 ---------- */
.am-mask {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(24, 24, 27, 0.45);
  animation: amFade 0.16s ease;
}
.am-mask[hidden] { display: none; }
@keyframes amFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------- 弹窗主体 ---------- */
.am-dialog {
  width: 100%;
  max-width: 400px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 24px 64px -16px rgba(23, 23, 28, 0.28);
  overflow: hidden;
  animation: amRise 0.18s cubic-bezier(0.2, 0, 0, 1);
}
@keyframes amRise {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

/* ---------- 头部 ---------- */
.am-head {
  flex: none;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 20px 0;
}
.am-head-text { min-width: 0; }
.am-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--black);
  line-height: 1.3;
}
.am-sub {
  margin-top: 5px;
  font-size: 12px;
  color: var(--gray-3);
  line-height: 1.5;
}
.am-close {
  flex: none;
  width: 28px;
  height: 28px;
  margin: -4px -4px 0 0;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-2);
  transition: background 0.12s, color 0.12s;
}
.am-close:hover { background: var(--fill); color: var(--black); }
.am-close:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }

/* ---------- 主体（可滚动） ---------- */
.am-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 20px 20px;
}

/* ---------- 消息条 ---------- */
.am-msg {
  display: none;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 14px;
}
.am-msg.is-shown { display: block; }
.am-msg-err { background: var(--red-50); color: var(--red); }
.am-msg-ok { background: var(--green-50); color: #15803d; }

/* ---------- 表单 ---------- */
.am-form { display: flex; flex-direction: column; gap: 14px; }
.am-field { display: flex; flex-direction: column; gap: 6px; }
.am-field[hidden] { display: none; }
/* 找回密码的第二阶段是两个字段的包裹层，自身没有 display 规则；
   但一旦后续有人给它加上 display，UA 的 [hidden]{display:none} 会被覆盖，
   于是「隐藏」失效、字段裸露出来。这里一次性钉死。 */
.am-pwd-group { display: flex; flex-direction: column; gap: 14px; }
.am-pwd-group[hidden] { display: none; }
.am-label { font-size: 12px; font-weight: 500; color: var(--gray-1); }
.am-input {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: var(--font);
  color: var(--black);
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.am-input::placeholder { color: var(--gray-3); }
.am-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.am-input[aria-invalid="true"] { border-color: var(--red); }
.am-hint { font-size: 11px; color: var(--gray-3); line-height: 1.5; }
.am-hint[hidden] { display: none; }

/* 验证码行：输入自适应，按钮固定 */
.am-code-row { display: flex; gap: 8px; }
.am-code-row .am-input { flex: 1; min-width: 0; }
.am-code-btn {
  flex: none;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-size: 12px;
  color: var(--gray-1);
  white-space: nowrap;
  transition: border-color 0.12s, color 0.12s;
}
.am-code-btn:hover:not(:disabled) { border-color: var(--gray-3); color: var(--black); }
.am-code-btn:disabled { opacity: 0.6; cursor: default; }

/* 协议勾选 */
.am-agree {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: var(--gray-2);
  line-height: 1.6;
  cursor: pointer;
}
.am-agree input { margin: 2px 0 0; flex: none; accent-color: var(--blue); }
.am-agree a { color: var(--blue); }
.am-agree a:hover { text-decoration: underline; }

/* ---------- 提交按钮 ---------- */
.am-submit {
  width: 100%;
  height: 38px;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  transition: background 0.12s, opacity 0.12s;
}
.am-submit:hover:not(:disabled) { background: var(--blue-hover); }
.am-submit:disabled { opacity: 0.65; cursor: default; }

/* ---------- 底部切换 ---------- */
.am-foot {
  flex: none;
  padding: 13px 20px;
  border-top: 1px solid var(--border-light);
  background: #fafafa;
  font-size: 12px;
  color: var(--gray-2);
  text-align: center;
}
.am-foot a { color: var(--blue); font-weight: 500; }
.am-foot a:hover { text-decoration: underline; }
.am-sep { margin: 0 6px; color: var(--gray-3); }

/* ---------- 动效降级 ---------- */
@media (prefers-reduced-motion: reduce) {
  .am-mask, .am-dialog { animation: none; }
}

/* ---------- 窄屏：贴底抽屉形态，拇指可达 ---------- */
@media (max-width: 639px) {
  .am-mask { padding: 0; align-items: flex-end; }
  .am-dialog {
    max-width: none;
    max-height: 92vh;
    border-radius: 14px 14px 0 0;
  }
  .am-head { padding: 18px 18px 0; }
  .am-body { padding: 16px 18px 18px; }
  .am-foot { padding: 12px 18px; }
}
