/* ==========================================================================
   账户 / 同步组件样式（acct.css）· 自包含 · 固定色值
   --------------------------------------------------------------------------
   账户挂件、登录弹层、账户切换器、同步状态胶囊的完整样式。
   供未引入 style.css 的页面（如 teacher-workbench.html）单独引入，
   确保「切换账户」组件在全站样式一致。

   重要：本文件刻意使用固定色值（不依赖 :root 主题变量）。
   因为像 teacher-workbench.html 这类页面有自定义主题变量（且同名不同值，
   如 --accent/#danger 与全站相反），若依赖变量会导致账户组件在不同页面
   颜色不一致。固定色值保证账户组件在任何页面外观统一。
   注：色值与 css/style.css 中 .acct* / .sync-* 保持一致；
       已引入 style.css 的页面本就含这些样式，无需再引本文件。
   ========================================================================== */

.acct { display: flex; align-items: center; gap: 6px; margin-right: 10px; }
.acct [hidden], .acct-user-wrap[hidden], .acct-menu[hidden] { display: none !important; }

/* 同步状态胶囊：状态显示与「立即同步」操作合二为一 */
.sync-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: 11.5px; font-weight: 650; letter-spacing: .2px;
  padding: 4px 10px; border-radius: 999px; white-space: nowrap;
  border: 1px solid #e3e9f2; background: #eef2f9; color: #7b879c;
  cursor: pointer; transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.sync-chip:hover { border-color: #cbd5e1; box-shadow: 0 1px 2px rgba(27,36,55,.06), 0 1px 3px rgba(27,36,55,.05); }
.sync-chip:disabled { cursor: default; opacity: .8; }
.sync-dot {
  width: 6px; height: 6px; border-radius: 50%; flex: none;
  background: currentColor;
}
.sync-chip.sync-off  { color: #7b879c;          background: #eef2f9;   border-color: #e3e9f2; }
.sync-chip.sync-ok   { color: #0b7a5b;          background: #e7f7f1; border-color: #bfe8d9; }
.sync-chip.sync-wait { color: #96610a;          background: #fdf3e2;          border-color: #f3ddb5; }
.sync-chip.sync-busy { color: #1d4ed8; background: #e8f0fe; border-color: #c9dcfb; }
.sync-chip.sync-err  { color: #ef4444;    background: #fdecec;  border-color: #f6cccc; }
.sync-chip.sync-busy .sync-dot {
  width: 9px; height: 9px; background: transparent;
  border: 1.5px solid currentColor; border-top-color: transparent;
  animation: sync-spin .7s linear infinite;
}
@keyframes sync-spin { to { transform: rotate(360deg); } }

/* 账号触发区：头像 + 姓名 + 下拉箭头 */
.acct-user-wrap { position: relative; }
.acct-user {
  display: inline-flex; align-items: center; gap: 7px;
  font: inherit; font-size: 13px; font-weight: 650; color: #46536b;
  padding: 3px 8px 3px 3px; border-radius: 999px; cursor: pointer;
  border: 1px solid transparent; background: transparent;
  transition: background .15s, border-color .15s;
}
.acct-user:hover, .acct-user[aria-expanded="true"] {
  background: #eef2f9; border-color: #e3e9f2;
}
.acct-ava {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, #2563eb, #8b5cf6);
}
.acct-ava.warn { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.acct-who {
  font-size: 13px; color: #46536b; white-space: nowrap; font-weight: 650;
  max-width: 150px; overflow: hidden; text-overflow: ellipsis;
}
.acct-caret {
  width: 0; height: 0; flex: none;
  border-left: 4px solid transparent; border-right: 4px solid transparent;
  border-top: 5px solid #7b879c; transition: transform .15s;
}
.acct-user[aria-expanded="true"] .acct-caret { transform: rotate(180deg); }

/* 账号下拉菜单 */
.acct-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60;
  width: 236px; padding: 6px; border-radius: 13px;
  background: #ffffff; border: 1px solid #e3e9f2;
  box-shadow: 0 14px 40px rgba(27,36,55,.11);
  animation: acct-pop .14s ease-out;
}
@keyframes acct-pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.acct-menu-head { padding: 9px 10px 10px; border-bottom: 1px solid #e3e9f2; margin-bottom: 4px; }
.acct-menu-name { font-size: 13.5px; font-weight: 800; line-height: 20px; color: #1b2437; }
.acct-menu-sub { font-size: 12px; line-height: 17px; color: #7b879c; margin-top: 1px; }
.acct-menu-note {
  margin-top: 6px; padding: 3px 7px; border-radius: 6px;
  font-size: 11.5px; font-weight: 650; line-height: 17px; color: #b45309;
  background: #fff8ec; border: 1px solid #fde3b8;
}
.acct-item {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font: inherit; font-size: 13px; line-height: 22px; color: #46536b; text-align: left;
  padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; cursor: pointer;
  text-decoration: none;
}
.acct-item:hover { background: #eef2f9; color: #1b2437; text-decoration: none; }
.acct-item:disabled { opacity: .5; cursor: default; }
/* 菜单项图标位：与「宠物小屋」的小图标同规格，保证五项文字左对齐 */
.acct-item-main { display: flex; align-items: center; gap: 9px; min-width: 0; }
.acct-item-ico {
  flex: none; width: 22px; height: 22px; border-radius: 7px;
  display: grid; place-items: center;
  background: #eef2f9; box-shadow: inset 0 0 0 1px rgba(27, 36, 55, .04);
  transition: background .15s;
}
.acct-item-ico svg {
  width: 14px; height: 14px; display: block;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.acct-item-ico svg.solid { fill: currentColor; stroke: none; }
.acct-item-ico.ico-pet { color: #8b5cf6; }
.acct-item-ico.ico-switch { color: #2563eb; }
.acct-item-ico.ico-sync { color: #0b7a5b; }
.acct-item-ico.ico-pwd { color: #b45309; }
.acct-item:hover .acct-item-ico { background: #ffffff; }
.acct-item.danger .acct-item-ico { color: #ef4444; background: #fdecec; box-shadow: none; }
.acct-item-meta { font-size: 11.5px; color: #7b879c; font-weight: 500; }
.acct-item.danger {
  color: #ef4444; margin-top: 4px; border-top: 1px solid #e3e9f2;
  border-radius: 0 0 8px 8px; padding-top: 9px;
}
.acct-item.danger:hover { background: #fdecec; }
/* 锁定菜单项文字色，避免被页面级链接色覆盖 */
.acct .acct-menu .acct-item { color: #46536b; }
.acct .acct-menu .acct-item:hover { color: #1b2437; }
.acct .acct-menu .acct-item.danger { color: #ef4444; }
.acct .acct-menu .acct-item.danger:hover { color: #ef4444; }

.acct-btn {
  font: inherit; font-size: 13px; font-weight: 600;
  padding: 5px 13px; border-radius: 8px; cursor: pointer;
  border: 1px solid #cbd5e1; background: #ffffff; color: #46536b;
  transition: background .15s, border-color .15s, color .15s;
}
.acct-btn:hover { background: #e8f0fe; border-color: #2563eb; color: #1d4ed8; }
.acct-btn.primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.acct-btn.primary:hover { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }
.acct-btn.ghost { background: transparent; }
.acct-btn:disabled { opacity: .55; cursor: default; }

.acct-mini {
  font: inherit; font-size: 12px; padding: 4px 10px; border-radius: 7px; cursor: pointer;
  border: 1px solid #e3e9f2; background: #f8fafc; color: #46536b;
}
.acct-mini:hover { border-color: #cbd5e1; color: #1b2437; }

.acct-veil {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(15, 23, 42, .42);
  display: grid; place-items: center; padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity .18s ease;
}
/* 从宠物对话面板 / 学习信息面板打开时置顶 */
.acct-veil.acct-top { z-index: 996; }
.acct-veil.show { opacity: 1; pointer-events: auto; }

.acct-modal {
  width: min(460px, 100%); background: #ffffff; border-radius: 16px;
  border: 1px solid #e3e9f2; padding: 24px 24px 20px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, .18);
}
.acct-modal h3 { margin: 0 0 10px; font-size: 18px; color: #1b2437; }
.acct-hint { margin: 0 0 16px; font-size: 13px; line-height: 1.7; color: #7b879c; }
.acct-hint b { color: #46536b; }
.acct-modal label {
  display: block; font-size: 13px; color: #46536b; font-weight: 600; margin-bottom: 12px;
}
.acct-modal input {
  display: block; width: 100%; margin-top: 6px; box-sizing: border-box;
  font: inherit; font-size: 14px; font-weight: 400;
  padding: 9px 12px; border-radius: 9px;
  border: 1px solid #cbd5e1; background: #f8fafc; color: #1b2437;
}
.acct-modal input:focus { outline: 2px solid #2563eb; outline-offset: 1px; border-color: #2563eb; }
.acct-msg { font-size: 13px; min-height: 18px; margin-bottom: 10px; }
.acct-msg.err { color: #ef4444; }
.acct-acts { display: flex; justify-content: flex-end; gap: 10px; }
.acct-forgot { margin: 12px 0 0; text-align: right; font-size: 12.5px; color: #7b879c; }
.acct-forgot button {
  border: 0; background: none; padding: 0; font: inherit; font-weight: 700;
  color: #2563eb; cursor: pointer;
}
.acct-forgot button:hover { text-decoration: underline; }

/* ---------- 账户切换器（多孩家庭同设备免密切换） ---------- */
.acct-switch-list {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 46vh; overflow-y: auto; margin: 2px 0 18px; padding: 2px;
}
.acct-switch-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 12px;
  border: 1px solid #e3e9f2; background: #f8fafc;
  cursor: pointer; transition: border-color .15s, background .15s, transform .12s;
}
.acct-switch-item:hover { border-color: #2563eb; background: #e8f0fe; transform: translateY(-1px); }
.acct-switch-item.active {
  border-color: #2563eb; background: #e8f0fe;
  box-shadow: inset 3px 0 0 #2563eb;
}
.acct-switch-item.active:hover { transform: none; }
.acct-ava-lg {
  flex: none; width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 17px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, #2563eb, #f59e0b);
}
.acct-switch-info { flex: 1; min-width: 0; }
.acct-switch-name {
  font-size: 14px; font-weight: 700; color: #1b2437;
  display: flex; align-items: center; gap: 7px;
}
.acct-switch-tag {
  font-size: 10.5px; font-weight: 700; color: #1d4ed8;
  background: #fff; border: 1px solid #2563eb; border-radius: 20px; padding: 1px 8px;
}
.acct-switch-sub {
  font-size: 12px; color: #7b879c; margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.acct-switch-remove {
  flex: none; font: inherit; font-size: 12px; color: #7b879c;
  border: 1px solid transparent; background: transparent; border-radius: 8px;
  padding: 6px 9px; cursor: pointer; opacity: 0;
  transition: opacity .15s, color .15s, border-color .15s, background .15s;
}
.acct-switch-item:hover .acct-switch-remove { opacity: 1; }
.acct-switch-remove:hover { color: #ef4444; border-color: #ef4444; background: #fdecec; }
@media (hover: none) { .acct-switch-remove { opacity: 1; } }

.sync-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 16px);
  background: #1b2437; color: #fff; font-size: 13px;
  padding: 10px 18px; border-radius: 10px; z-index: 95;
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
}
.sync-toast.show { opacity: .96; transform: translate(-50%, 0); }

@media (max-width: 720px) {
  .acct-who { display: none; }
  .sync-chip { font-size: 11px; padding: 3px 8px; }
}
