/* ============================================================
   account.css — Account 下拉组件（U Sourcing Hub Demo）
   命名空间：.account-widget*，不和原 upload.css 冲突
   ============================================================ */

.account-widget {
  position: relative;
}

.account-widget__trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 4px 4px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 9999px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: background 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
  outline: none;
  font: inherit;
  color: inherit;
}
.account-widget__trigger:hover {
  background: #f8fafc;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(15, 23, 42, 0.04);
}
.account-widget__trigger:focus-visible {
  border-color: #c7d2fe;
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.18), 0 6px 18px rgba(99, 102, 241, 0.12);
}
.account-widget__trigger.is-open {
  background: #ffffff;
  border-color: #c7d2fe;
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.18), 0 6px 18px rgba(99, 102, 241, 0.12);
}

.account-widget__avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: #eef2ff;
  color: #3730a3;
  display: grid; place-items: center;
  font-weight: 600; font-size: 13px;
  flex: 0 0 auto;
  overflow: hidden;
}
.account-widget__avatar--lg {
  width: 40px; height: 40px; font-size: 15px;
}

.account-widget__label {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  line-height: 1;
}

.account-widget__chevron {
  width: 14px; height: 14px;
  color: #94a3b8;
  transition: transform 180ms ease, color 180ms ease;
}
.account-widget__trigger.is-open .account-widget__chevron {
  color: #3730a3;
  transform: rotate(180deg);
}

/* Dropdown */
.account-widget__menu,
.account-widget__menu[hidden] {
  display: block; /* 覆盖 HTML [hidden] 默认的 display:none,避免 is-open 时仍 0×0 */
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 320px;
  max-width: calc(100vw - 24px);
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.10), 0 4px 8px rgba(15, 23, 42, 0.04);
  padding: 6px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.98);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease, visibility 0s linear 160ms;
  z-index: 60;
}
.account-widget.is-open .account-widget__menu,
.account-widget.is-open .account-widget__menu[hidden] {
  display: block !important; /* 覆盖 [hidden] { display:none !important } */
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  transition: opacity 160ms ease, transform 160ms ease, visibility 0s linear 0s;
}

.account-widget__user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
}
.account-widget__user-meta { min-width: 0; flex: 1 1 auto; }
.account-widget__user-name {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.2;
}
.account-widget__user-email {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.2;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-widget__user-tag {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  color: #3730a3;
  background: #eef2ff;
  border-radius: 9999px;
  letter-spacing: 0.02em;
}

.account-widget__divider {
  height: 1px;
  background: #eef2f7;
  margin: 4px 6px;
}

.account-widget__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #0f172a;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  background: transparent;
  border: 0;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background 140ms ease;
  font-family: inherit;
}
.account-widget__item:hover { background: #f8fafc; }
.account-widget__item .mi-icon {
  width: 18px; height: 18px;
  color: #94a3b8;
  flex: 0 0 auto;
}
.account-widget__item .mi-text { flex: 1 1 auto; line-height: 1.2; }
.account-widget__item .mi-hint {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
  font-weight: 400;
}
.account-widget__item.is-pro {
  position: relative;
}
.account-widget__item.is-pro::after {
  content: "Pro";
  font-size: 10px;
  font-weight: 700;
  color: #92400e;
  background: #fef3c7;
  padding: 2px 6px;
  border-radius: 9999px;
}
.account-widget__item.is-disabled {
  color: #94a3b8;
  cursor: not-allowed;
  opacity: 0.65;
}
.account-widget__item.is-disabled:hover { background: transparent; }
.account-widget__item--danger { color: #dc2626; }
.account-widget__item--danger:hover { background: #fef2f2; }
.account-widget__item--danger .mi-icon { color: #dc2626; }

/* Modal */
.account-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}
.account-modal-backdrop.is-open { display: flex; }

.account-modal {
  width: 100%;
  max-width: 400px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.10), 0 4px 8px rgba(15, 23, 42, 0.04);
  padding: 24px;
  animation: accountModalIn 180ms ease;
}
@keyframes accountModalIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.account-modal h2 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
}
.account-modal p {
  margin: 0 0 20px;
  font-size: 14px;
  color: #475569;
  line-height: 1.5;
}
.account-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.account-btn {
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  transition: background 140ms ease, border-color 140ms ease;
  border: 0;
  cursor: pointer;
  font-family: inherit;
}
.account-btn--secondary {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  color: #0f172a;
}
.account-btn--secondary:hover { background: #f8fafc; }
.account-btn--danger {
  background: #dc2626;
  color: #fff;
}
.account-btn--danger:hover { background: #b91c1c; }

/* 移动端 ≤768px：隐藏 Account 文字 */
@media (max-width: 768px) {
  .account-widget__label { display: none; }
  .account-widget__trigger { padding: 3px 8px 3px 3px; }
}

/* Last login 行（用户卡片下方的轻量提示） */
.account-widget__user-lastlogin {
  font-size: 11px;
  color: var(--text-hint, #94a3b8);
  margin-top: 4px;
  line-height: 1.4;
}