/* ========================================
   TeachTools - 全局样式
   主色调：青蓝/水绿色系（冷静但不冰冷）
   ======================================== */

:root {
  /* 主色调 */
  --primary: #2D7A7E;
  --primary-light: #4A9DA1;
  --primary-dark: #1E5A5E;
  --primary-bg: #F0F7F7;

  /* 辅助色 */
  --accent: #6BB5B8;
  --accent-light: #A8D5D7;

  /* 文字色 */
  --text-primary: #2C3E50;
  --text-secondary: #5A6C7D;
  --text-muted: #8A9BAB;

  /* 背景色 */
  --bg-body: #F5F9FA;
  --bg-card: #FFFFFF;
  --bg-sidebar: #FFFFFF;

  /* 边框 */
  --border-color: #E1E8EC;
  --border-radius: 12px;
  --border-radius-sm: 8px;

  /* 阴影 */
  --shadow-sm: 0 2px 8px rgba(45, 122, 126, 0.06);
  --shadow-md: 0 4px 16px rgba(45, 122, 126, 0.1);
  --shadow-lg: 0 8px 32px rgba(45, 122, 126, 0.12);

  /* 状态色 */
  --success: #3D9970;
  --warning: #E8A838;
  --danger: #D64545;
  --info: #4A90A4;

  /* 侧边栏宽度 */
  --sidebar-width: 280px;
  --sidebar-collapsed-width: 0px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-body);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--primary-dark);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
  transition: all 0.2s ease;
}

input, textarea {
  font-family: inherit;
  font-size: 14px;
  outline: none;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 10px 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
  background: #fff;
}

input:focus, textarea:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(74, 157, 161, 0.15);
}

textarea {
  resize: vertical;
  min-height: 100px;
}

/* ========================================
   布局结构
   ======================================== */

.app-container {
  display: flex;
  min-height: 100vh;
}

/* ========================================
   左侧个人栏
   ======================================== */

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform 0.3s ease, width 0.3s ease;
  overflow-y: auto;
}

/* 桌面端"收起"：整体平移到屏幕外，同时将宽度收缩为 0
 * —— 双保险：flex 布局下 transform 仅视觉平移，flex 宽度仍占位，
 *    必须配合 width:0 才能让主内容区贴到左边；
 *    另外 overflow:hidden + border-right:none 防止收起时残留细线或内容 */
.sidebar.collapsed {
  transform: translateX(-100%);
  width: 0 !important;
  min-width: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border-right: none !important;
  overflow: hidden !important;
}

/* sidebar 内部的收起/展开按钮：贴在右上角，不依赖 top-nav 存在 */
.sidebar-toggle {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 102;            /* 高于 sidebar 内容 */
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary-bg);
  border: 1px solid var(--primary-light);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-dark);
  font-size: 16px;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.2s, right 0.2s, top 0.2s, box-shadow 0.2s;
  cursor: pointer;
}
.sidebar-toggle:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary-light);
}
/* 桌面端 collapsed：隐藏内部 toggle（整个 sidebar 已飞出屏幕，改用 float-toggle 浮标展开） */
.sidebar.collapsed .sidebar-toggle {
  display: none;
}

/* 锁定页（首页 / 登录注册页 data-sidebar-mode="locked"）：
 * 侧边栏永远展开，隐藏收起按钮；顶部 52px 让位空间也可以收掉 */
.sidebar[data-sidebar-mode="locked"] .sidebar-toggle {
  display: none !important;
}
.sidebar[data-sidebar-mode="locked"] .sidebar-profile {
  padding-top: 32px;
}

/* 移动端/窄屏浮标：sidebar 被 translate(-100%) 隐藏时仍能从屏幕最左边点开 sidebar
   —— 用于 <900px 响应式默认收起、toggle 跟随 sidebar 飞出屏幕外时 */
.sidebar-float-toggle {
  display: none;
  position: fixed;
  top: 18px;
  left: 6px;
  z-index: 99;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--primary-bg);
  border: 1px solid var(--primary-light);
  align-items: center;
  justify-content: center;
  color: var(--primary-dark);
  font-size: 17px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}
.sidebar-float-toggle:hover {
  background: var(--primary);
  color: #fff;
}
/* sidebar 展开后隐藏浮标（宽屏未收起 / 窄屏mobile-open） */
.sidebar.mobile-open ~ .sidebar-float-toggle,
.sidebar:not(.collapsed) ~ .sidebar-float-toggle {
  display: none;
}
/* 宽屏 sidebar 已收起(collapsed)时 → 显示浮标，用户可从屏幕左上角点出 sidebar */
.sidebar.collapsed ~ .sidebar-float-toggle {
  display: inline-flex;
}

.sidebar-profile {
  padding: 52px 24px 24px;   /* 顶部 52 避开 absolute 的 toggle */
  text-align: center;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 32px;
  font-weight: 600;
  margin: 0 auto 16px;
  box-shadow: var(--shadow-md);
}

.sidebar-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.sidebar-tagline {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.sidebar-bio {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 12px;
  text-align: left;
}

.sidebar-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
  justify-content: center;
}

.skill-tag {
  font-size: 11px;
  padding: 3px 10px;
  background: var(--primary-bg);
  color: var(--primary);
  border-radius: 20px;
}

.sidebar-contact {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-contact h4 {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.contact-item:last-child {
  margin-bottom: 0;
}

.contact-icon {
  width: 18px;
  text-align: center;
  font-size: 14px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 20px 24px;
  text-align: center;
}

.btn-feedback {
  width: 100%;
  padding: 10px 16px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--border-radius-sm);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-feedback:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.copyright {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 14px;
}

/* ========================================
   主内容区
   ======================================== */

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}

.sidebar.collapsed ~ .main-content {
  margin-left: 0;
}
/* 侧边栏收起时，float-toggle 浮标显示在左上角，top-nav 左内边距加大避免与"返回工具箱"按钮重叠 */
.sidebar.collapsed ~ .main-content .top-nav {
  padding-left: 88px;
}

.content-wrapper {
  max-width: 1000px;
  margin: 0 auto;
  padding: 48px 32px;
}

/* ========================================
   顶部导航（登录后）
   ======================================== */

.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.5px;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-user {
  font-size: 14px;
  color: var(--text-secondary);
}

.nav-user strong {
  color: var(--text-primary);
  font-weight: 600;
}

.btn-logout {
  padding: 6px 14px;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 13px;
}

.btn-logout:hover {
  color: var(--danger);
  border-color: var(--danger);
}

.btn-admin {
  padding: 6px 14px;
  background: var(--primary-bg);
  color: var(--primary);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
}

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

/* ========================================
   按钮样式
   ======================================== */

.btn {
  padding: 10px 20px;
  border-radius: var(--border-radius-sm);
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--bg-body);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--primary-bg);
  color: var(--primary);
  border-color: var(--primary-light);
}

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

.btn-success:hover {
  opacity: 0.9;
}

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

.btn-danger:hover {
  opacity: 0.9;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

/* ========================================
   卡片
   ======================================== */

.card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
  font-size: 16px;
}

.card-body {
  padding: 24px;
}

.card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-body);
  border-radius: 0 0 var(--border-radius) var(--border-radius);
}

/* ========================================
   登录/注册表单
   ======================================== */

.auth-section {
  max-width: 420px;
  margin: 0 auto 48px;
}

.auth-tabs {
  display: flex;
  margin-bottom: 24px;
  background: var(--bg-card);
  border-radius: var(--border-radius);
  padding: 4px;
  box-shadow: var(--shadow-sm);
}

.auth-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.auth-tab.active {
  background: var(--primary);
  color: #fff;
}

.auth-form .form-group {
  margin-bottom: 16px;
}

.auth-form label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.auth-form .form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.auth-error {
  background: #FEF2F2;
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--border-radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

.auth-error.show {
  display: block;
}

.auth-success {
  background: #F0FDF4;
  color: var(--success);
  padding: 10px 14px;
  border-radius: var(--border-radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

.auth-success.show {
  display: block;
}

/* ========================================
   工具介绍区（未登录）
   ======================================== */

.tools-intro {
  margin-top: 48px;
}

.section-title {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.section-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.tool-card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  padding: 24px;
  border: 1px solid var(--border-color);
  transition: all 0.25s ease;
  cursor: pointer;
  position: relative;
}

.tool-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-light);
}

.tool-card.disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.tool-card.disabled:hover {
  transform: none;
  box-shadow: var(--shadow-sm);
  border-color: var(--border-color);
}

.tool-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 16px;
  color: #fff;
}

.tool-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.tool-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.tool-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 11px;
  padding: 3px 8px;
  background: var(--warning);
  color: #fff;
  border-radius: 4px;
  font-weight: 500;
}

/* ========================================
   管理员页面
   ======================================== */

.admin-header {
  margin-bottom: 32px;
}

.admin-header h1 {
  font-size: 26px;
  font-weight: 600;
  margin-bottom: 6px;
}

.admin-header p {
  color: var(--text-muted);
  font-size: 14px;
}

.user-table {
  width: 100%;
  border-collapse: collapse;
}

.user-table th,
.user-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.user-table th {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg-body);
}

.user-table td {
  font-size: 14px;
  color: var(--text-primary);
}

.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.status-pending {
  background: #FFF7E6;
  color: var(--warning);
}

.status-approved {
  background: #E6F7EE;
  color: var(--success);
}

.status-rejected {
  background: #FEECEC;
  color: var(--danger);
}

.action-btns {
  display: flex;
  gap: 8px;
}

/* ========================================
   弹窗 / Modal
   ======================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(44, 62, 80, 0.5);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.show {
  display: flex;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 17px;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: var(--bg-body);
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.feedback-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.feedback-option {
  padding: 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 12px;
}

.feedback-option:hover {
  border-color: var(--primary-light);
  background: var(--primary-bg);
}

.feedback-option-icon {
  font-size: 24px;
}

.feedback-option-text h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.feedback-option-text p {
  font-size: 12px;
  color: var(--text-muted);
}

.email-display {
  background: var(--primary-bg);
  padding: 12px 16px;
  border-radius: var(--border-radius-sm);
  text-align: center;
  font-size: 15px;
  color: var(--primary);
  font-weight: 500;
  margin-top: 12px;
  word-break: break-all;
}

/* ========================================
   加载状态
   ======================================== */

.loading {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.loading-container {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

/* ========================================
   空状态
   ======================================== */

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 14px;
}

/* ========================================
   响应式 - 平板
   ======================================== */

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  /* 窄屏 sidebar 默认飞出屏幕外 → 显示屏幕最左侧的浮标来把它拉出来 */
  .sidebar-float-toggle {
    display: inline-flex;
  }
  .sidebar.mobile-open ~ .sidebar-float-toggle,
  .sidebar.collapsed.mobile-open ~ .sidebar-float-toggle {
    display: none;
  }

  /* 桌面端 collapsed 时的 right:-38px 按钮在窄屏也不可见，隐藏它以免奇怪 */
  .sidebar-toggle {
    right: 10px;
    top: 10px;
  }

  .main-content {
    margin-left: 0;
  }

  .content-wrapper {
    padding: 32px 20px;
  }
}

/* ========================================
   响应式 - 手机
   ======================================== */

@media (max-width: 600px) {
  .sidebar {
    width: 100%;
    transform: translateX(-100%);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-float-toggle {
    display: inline-flex;
  }
  .sidebar.mobile-open ~ .sidebar-float-toggle {
    display: none;
  }

  .tools-grid {
    grid-template-columns: 1fr;
  }

  .top-nav {
    padding: 12px 16px;
  }

  .nav-logo {
    font-size: 17px;
  }

  .nav-user {
    display: none;
  }

  .section-title {
    font-size: 18px;
  }

  .content-wrapper {
    padding: 24px 16px;
  }

  .user-table th:nth-child(3),
  .user-table td:nth-child(3),
  .user-table th:nth-child(4),
  .user-table td:nth-child(4) {
    display: none;
  }
}

/* ========================================
   全局：Toast 轻提示 / ttToast & ttConfirm
   ======================================== */

/* 容器：.tt-toast-wrap 老名 + .toast-wrap 新名（G5 断言兼容） */
.tt-toast-wrap,
.toast-wrap {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: calc(100% - 32px);
}

/* 单条 toast：.tt-toast 老名 + .toast 新名（G5 断言兼容） */
.tt-toast,
.toast {
  min-width: 240px;
  max-width: 480px;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  color: #fff;
  animation: tt-toast-in 240ms ease-out both;
  pointer-events: auto;
  word-break: break-word;
}

/* ---- 按 type 着色：同时支持老名(.tt-toast.X)和新 BEM 名(.toast--X) ---- */
.tt-toast.success,
.toast.toast--success  { background: rgba(16, 185, 129, 0.94); }
.tt-toast.info,
.toast.toast--info     { background: rgba(59, 130, 246, 0.94); }
/* warning/warn 两套都支持 */
.tt-toast.warn,
.tt-toast.warning,
.toast.toast--warn,
.toast.toast--warning  { background: rgba(245, 158, 11, 0.94); }
.tt-toast.error,
.toast.toast--error    { background: rgba(239, 68, 68, 0.94); }
.tt-toast.loading,
.toast.toast--loading  { background: rgba(107, 114, 128, 0.94); }

.tt-toast.fade-out,
.toast.fade-out { animation: tt-toast-out 240ms ease-in both; }

@keyframes tt-toast-in {
  from { opacity: 0; transform: translateY(-12px) translateX(-50%); }
  to   { opacity: 1; transform: translateY(0)     translateX(-50%); }
}
@keyframes tt-toast-out {
  from { opacity: 1; transform: translateY(0)     translateX(-50%); }
  to   { opacity: 0; transform: translateY(-12px) translateX(-50%); }
}

/* ========================================
   全局：ttConfirm 自定义弹窗（替代原生 confirm/alert）
   ======================================== */

/* .tt-confirm-modal 是别名：测试页/老代码 querySelector('.tt-confirm-modal') 也能命中 mask */
.tt-confirm-mask,
.tt-confirm-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: tt-mask-in 160ms ease-out both;
}

.tt-confirm-box {
  background: #ffffff;
  width: 100%;
  max-width: 420px;
  border-radius: 16px;
  padding: 22px 22px 18px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.18);
  animation: tt-modal-in 200ms ease-out both;
}

.tt-confirm-title {
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.tt-confirm-title .icon { width: 20px; height: 20px; display: inline-flex; }
.tt-confirm-title.confirm .icon { color: #3b82f6; }
.tt-confirm-title.danger  .icon { color: #ef4444; }
.tt-confirm-title.info    .icon { color: #6b7280; }
.tt-confirm-title.warn    .icon { color: #f59e0b; }

.tt-confirm-msg {
  font-size: 14px;
  color: #334155;
  line-height: 1.6;
  margin: 0 0 18px;
  white-space: pre-wrap;
  word-break: break-word;
}

.tt-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.tt-confirm-actions .btn {
  flex: 0 0 auto;
  min-width: 84px;
}
/* ttConfirm：取消按钮 hook 类（用于测试页 / 老代码选择器命中），无额外样式 */
.tt-confirm-cancel {}

@keyframes tt-mask-in  { from { opacity: 0 } to { opacity: 1 } }
@keyframes tt-modal-in { from { opacity: 0; transform: translateY(12px) scale(0.98) } to { opacity: 1; transform: translateY(0) scale(1) } }

/* ========================================
   登录注册：三 Tab / QQ邮箱提示 / 密码强度条
   ======================================== */

.auth-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 12px;
}

.auth-tabs button {
  flex: 1 1 0;
  border: none;
  background: transparent;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 600;
  color: #64748b;
  border-radius: 8px;
  cursor: pointer;
  transition: all 160ms ease;
}
.auth-tabs button.active {
  background: #ffffff;
  color: var(--accent);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.auth-panel { display: none; }
.auth-panel.active { display: block; animation: tt-modal-in 180ms ease-out both; }

/* 密码输入 + 眼睛 + QQ小图标 */

.input-with-suffix {
  position: relative;
}
.input-with-suffix input {
  padding-right: 44px;
  width: 100%;
}
.input-with-suffix .input-suffix {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #94a3b8;
  font-size: 13px;
  user-select: none;
}
.input-with-suffix .eye-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 2px 4px;
  color: #94a3b8;
  font-size: 13px;
  border-radius: 6px;
  transition: background 120ms;
}
.input-with-suffix .eye-btn:hover { background: #eef2ff; color: var(--accent); }

.qq-hint {
  font-size: 12px;
  margin-top: 4px;
  color: #f59e0b;
  line-height: 1.4;
}
.qq-hint.ok   { color: #10b981; }
.qq-hint.err  { color: #ef4444; }

.qq-hint::before { content: "💡 "; }
.qq-hint.ok::before  { content: "✅ "; }
.qq-hint.err::before { content: "⛔ "; }

/* 密码强度条 */

.pwd-strength {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pwd-strength-bar {
  height: 6px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  display: flex;
  gap: 3px;
}
.pwd-strength-bar span {
  flex: 1 1 0;
  height: 100%;
  background: transparent;
  border-radius: 999px;
  transition: background 160ms ease;
}
.pwd-strength.level-1 .pwd-strength-bar span:nth-child(-n+1) { background: #ef4444; }
.pwd-strength.level-2 .pwd-strength-bar span:nth-child(-n+2) { background: #f59e0b; }
.pwd-strength.level-3 .pwd-strength-bar span:nth-child(-n+3) { background: #3b82f6; }
.pwd-strength.level-4 .pwd-strength-bar span:nth-child(-n+3) { background: #10b981; }

.pwd-strength-text {
  font-size: 12px;
  color: #64748b;
}
.pwd-strength.level-1 .pwd-strength-text { color: #ef4444; }
.pwd-strength.level-2 .pwd-strength-text { color: #f59e0b; }
.pwd-strength.level-3 .pwd-strength-text { color: #3b82f6; }
.pwd-strength.level-4 .pwd-strength-text { color: #10b981; }

/* ========================================
   全局：反馈锁态（未登录禁用留言/侧边栏按钮/邮箱联系）
   支持两套类名：
     - TDD 约定的 BEM：.btn-feedback--locked / .sidebar-contact--locked
     - 后续实现会用的：.feedback-btn-lock / .sidebar-contact-btn-lock
   ======================================== */

.feedback-btn-lock,
.sidebar-contact-btn-lock,
.btn-feedback.btn-feedback--locked {
  position: relative;
  cursor: not-allowed !important;
  filter: grayscale(0.4);
  opacity: 0.7;
  pointer-events: none; /* 真正拦截点击，被拦截时需 JS 再附加 global click 捕获冒泡 toast 提示 */
}

.sidebar-contact-btn-lock,
#pg_sidebar_contact.sidebar-contact--locked,
.sidebar-contact--locked {
  position: relative;
  cursor: not-allowed;
  filter: grayscale(0.3);
  opacity: 0.85;
}
.sidebar-contact--locked::after,
.sidebar-contact-btn-lock::after {
  content: "🔒 登录后可用";
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  font-size: 11px;
  font-weight: 600;
  pointer-events: none;
}

.lock-overlay {
  position: relative;
}
.lock-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.55);
  border-radius: inherit;
  pointer-events: none;
  z-index: 1;
}

.lock-tooltip {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  font-size: 11px;
  font-weight: 600;
}

/* ========================================
   Supabase 未配置 / 配置引导卡
   ======================================== */

.config-guide-card {
  background: linear-gradient(135deg, #fff7ed 0%, #fef3c7 100%);
  border: 1px solid #fde68a;
  border-radius: 14px;
  padding: 18px 18px 16px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(251, 191, 36, 0.12);
}

.config-guide-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
  color: #78350f;
  display: flex;
  align-items: center;
  gap: 8px;
}
.config-guide-card ol,
.config-guide-card ul {
  padding-left: 20px;
  margin: 8px 0;
  font-size: 13px;
  color: #78350f;
  line-height: 1.8;
}
.config-guide-card code {
  background: #fff;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 12px;
  color: #9a3412;
}
.config-guide-card .btn {
  margin-top: 8px;
}

/* ========================================
   忘记密码：找回弹窗 / 重置密码小卡
   ======================================== */

.auth-notice {
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.6;
  margin: 8px 0 14px;
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}
.auth-notice.ok    { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.auth-notice.err   { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.auth-notice.warn  { background: #fffbeb; color: #92400e; border-color: #fde68a; }

.recovery-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  z-index: 99990;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: tt-mask-in 160ms ease-out both;
}

.recovery-box {
  background: #fff;
  border-radius: 16px;
  padding: 22px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.18);
  animation: tt-modal-in 200ms ease-out both;
}
.recovery-box h3 { margin: 0 0 8px; font-size: 18px; color: #0f172a; }
.recovery-box .desc { font-size: 13px; color: #475569; line-height: 1.6; margin-bottom: 14px; }

/* 顶部身份条（已登录/待审核/被驳回） */

.auth-level-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
}
.auth-level-badge.guest     { background: #e0e7ff; color: #3730a3; }
.auth-level-badge.pending   { background: #fef3c7; color: #92400e; }
.auth-level-badge.approved  { background: #d1fae5; color: #065f46; }
.auth-level-badge.rejected  { background: #fee2e2; color: #991b1b; }
.auth-level-badge.admin     { background: #ede9fe; color: #5b21b6; }

/* 响应式：小屏下 Toast 左对齐 */

@media (max-width: 480px) {
  .tt-toast  { min-width: 0; width: 100%; }
  .auth-tabs button { padding: 8px 6px; font-size: 13px; }
}

/* ========== s3-1 修复：三 Tab 显隐 / 激活下划线 / 配置引导卡显示动画 ========== */

/* 1) 三个面板：默认全隐藏，.active 才显示（关键！之前缺这条导致 3 个面板垂直堆叠） */
.auth-panel                 { display: none; }
.auth-panel.active          {
  display: block;
  animation: tt-modal-in 200ms ease-out both;
}

/* 2) Tab 条：flex 三等分 + 激活态下划线（强调当前面板） */
.auth-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid #e2e8f0;
  margin: 18px 0 22px;
  padding: 0 4px;
}
.auth-tabs .auth-tab {
  flex: 1 1 0;
  padding: 12px 10px;
  background: none;
  border: none;
  font-size: 15px;
  font-weight: 500;
  color: #64748b;
  border-radius: 10px 10px 0 0;
  cursor: pointer;
  position: relative;
  transition: all .15s ease;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.auth-tabs .auth-tab:hover:not(.active) {
  background: #f8fafc;
  color: #0f172a;
}
.auth-tabs .auth-tab.active {
  color: #2D7A7E;
  background: #f0fdfc;
  font-weight: 600;
}
.auth-tabs .auth-tab.active::after {
  content: '';
  position: absolute;
  left: 16%;
  right: 16%;
  bottom: -2px;
  height: 3px;
  background: linear-gradient(90deg, #2D7A7E, #4cc4b0);
  border-radius: 2px;
}

/* 3) 小屏：Tab 图标和文字字号再降一点，不换行溢出 */
@media (max-width: 420px) {
  .auth-tabs { margin: 14px 0 18px; gap: 2px; padding: 0; }
  .auth-tabs .auth-tab { padding: 10px 4px; font-size: 13px; letter-spacing: -0.2px; }
}

/* 4) 配置引导卡：默认占满卡片宽度 + 进入动画（在 auth-card 底部出现） */
#supabaseConfigCard {
  margin-top: 16px;
  animation: tt-fade-up 220ms ease-out both;
}
@keyframes tt-fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0);   }
}

/* 5) 重置密码弹窗的小细节（tt-reset-modal 下的 tip/按钮间距） */
.tt-reset-modal .tt-reset-modal__tip {
  font-size: 13px;
  color: #475569;
  line-height: 1.6;
  margin: 0 0 10px;
  padding: 8px 10px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
}

/* ========================================
   首页欢迎区（index.html 首页去掉认证表单后替代用）
   ======================================== */
.home-hero {
  max-width: 760px;
  margin: 0 auto 28px;
}
.home-hero__card {
  background: linear-gradient(135deg, #f0faf7 0%, #f8fbff 60%, #fefbf5 100%);
  border: 1px solid #d7e6e4;
  border-radius: 18px;
  padding: 32px 30px 28px;
  box-shadow: 0 10px 28px -18px rgba(45, 122, 126, 0.35),
              0 1px 2px rgba(15, 23, 42, 0.04);
}
.home-hero__title {
  margin: 0 0 10px;
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: 0.2px;
}
.home-hero__sub {
  margin: 0 0 22px;
  font-size: 14.5px;
  color: var(--text-secondary);
  line-height: 1.75;
}
.home-hero__btns {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.home-hero__btns .btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  font-weight: 600;
  font-size: 14px;
  border-radius: 10px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.home-hero__btns .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px -10px rgba(45, 122, 126, 0.55);
}
.home-hero__btns .btn:active {
  transform: translateY(0);
}

/* login.html 顶部「← 返回工具箱」链接 */
.login-back-home {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--primary);
  text-decoration: none;
  margin: -4px 0 14px;
  font-weight: 600;
  padding: 4px 6px;
  border-radius: 6px;
}
.login-back-home:hover {
  background: var(--primary-bg);
  text-decoration: underline;
}

/* 登录页的 auth-section 默认放大一点，左右留更舒适边距 */
.login-page .auth-section {
  max-width: 460px;
  margin: 0 auto 36px;
}
.login-page .supabase-config-card {
  max-width: 460px;
  margin: 0 auto 28px;
}

@media (max-width: 560px) {
  .home-hero { margin: 0 auto 20px; }
  .home-hero__card { padding: 22px 18px; border-radius: 14px; }
  .home-hero__title { font-size: 21px; }
  .home-hero__btns .btn { flex: 1 1 100%; }
}

/* ========================================
   首页登录后仪表盘（#homeDashboard）
   approved/admin 可见：用户信息 + 时钟 + 日历 + 黄历 + 天气 + 玩偶
   整体左对齐，右侧留给玩偶
   ======================================== */
.home-dashboard {
  position: relative;
  /* 容器整体缩小约 10%：卡片原宽 864px + 间距 20px + 玩偶列 280px = 1164px */
  max-width: 1164px;
  width: 100%;
  margin: -16px 0 16px -20px;  /* 外距略微收窄 */
  align-self: flex-start;
}
.dash-layout {
  position: relative;
  display: grid;
  /* 左：卡片自适应；右：玩偶 280px（从 320 缩小约 12.5%）；中间 20px 过道 */
  grid-template-columns: minmax(0, 1fr) 280px;
  column-gap: 20px;
  align-items: end;     /* 玩偶底部与卡片底部对齐，保持同一高度基线 */
  width: 100%;
}
.dash-layout > .dash-card { grid-column: 1; min-width: 0; }
.dash-layout > .dash-pet  { grid-column: 2; justify-self: end; width: 100%; }
.dash-card {
  background: linear-gradient(135deg, #f0faf7 0%, #f8fbff 60%, #fefbf5 100%);
  border: 1px solid #d7e6e4;
  border-radius: 16px;          /* 圆角从 18 → 16，收一点 */
  padding: 14px 16px 12px;      /* padding 从 16/18/14 → 14/16/12，约缩小 10% */
  box-shadow: 0 8px 24px -16px rgba(45, 122, 126, 0.35),
              0 1px 2px rgba(15, 23, 42, 0.04);
}

/* --- 头部：用户信息 + 时钟 --- */
.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 14px;            /* gap 略缩 */
  padding-bottom: 8px;      /* 10 → 8 */
  margin-bottom: 10px;      /* 12 → 10 */
  border-bottom: 1px dashed #cfe3e1;
}
.dash-user {
  display: flex;
  align-items: center;
  gap: 10px;                /* 12 → 10 */
  min-width: 0;
}
.dash-avatar {
  width: 40px;              /* 44 → 40 */
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light), var(--accent, #7c5cbf));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;          /* 22 → 20 */
  flex: 0 0 auto;
  box-shadow: 0 4px 10px -4px rgba(45, 122, 126, 0.5);
}
.dash-user__text { min-width: 0; }
.dash-welcome {
  font-size: 17px;          /* 18 → 17 */
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.3;
}
.dash-email {
  font-size: 12.5px;        /* 13 → 12.5 */
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;         /* 240 → 220 */
}
.dash-badge-admin {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;        /* 12 → 11.5 */
  font-weight: 700;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 999px;
  padding: 2.5px 9px;       /* 3 10 → 2.5 9 */
  flex: 0 0 auto;
}
.dash-clock { text-align: right; }
.dash-clock__time {
  font-size: 24px;          /* 26 → 24 */
  font-weight: 800;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  letter-spacing: 0.5px;
}
.dash-clock__date {
  font-size: 12px;          /* 12.5 → 12 */
  color: var(--text-secondary);
  margin-top: 2px;
}

/* --- 主体双栏 --- */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 11px;                /* 12 → 11 */
}
.dash-panel {
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid #dde9e8;
  border-radius: 11px;      /* 12 → 11 */
  padding: 9px 12px 10px;   /* 10 14 12 → 9 12 10 */
  min-width: 0;
}
.dash-panel__title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;                 /* 10 → 8 */
  font-size: 13px;          /* 13.5 → 13 */
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;       /* 7 → 6 */
}
.dash-panel__title--weather { justify-content: space-between; }

/* --- 日历 --- */
.dash-cal-nav {
  border: 1px solid #d3e2e0;
  background: #fff;
  color: var(--primary);
  width: 24px;              /* 26 → 24 */
  height: 24px;
  border-radius: 7px;       /* 8 → 7 */
  font-size: 15px;          /* 16 → 15 */
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}
.dash-cal-nav:hover { background: var(--primary-bg); }
.dash-cal-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 3px;       /* 4 → 3 */
}
.dash-cal-wd {
  text-align: center;
  font-size: 11.5px;        /* 12 → 11.5 */
  font-weight: 600;
  color: var(--text-secondary);
  padding: 2px 0;
}
.dash-cal-wd--we { color: #d48a8a; }
.dash-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.dash-cal-cell {
  text-align: center;
  font-size: 12.5px;        /* 13 → 12.5 */
  color: var(--text-primary);
  padding: 3.5px 0;         /* 4 → 3.5 */
  border-radius: 7px;       /* 8 → 7 */
  font-variant-numeric: tabular-nums;
}
.dash-cal-cell--weekend { color: #c07070; }
.dash-cal-cell--empty { visibility: hidden; }
.dash-cal-cell--today {
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 3px 8px -3px rgba(45, 122, 126, 0.6);
}

/* --- 左列（日历 + 黄历 纵向堆叠） --- */
.dash-col-left {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

/* --- 黄历 --- */
.dash-panel--almanac { padding: 9px 14px 10px; }
.dash-almanac { text-align: center; }
.dash-almanac__date {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
}
.dash-almanac__year {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.dash-almanac__rows {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px dashed #d9e6e4;
}
.dash-almanac__row {
  font-size: 12px;
  line-height: 1.7;
  text-align: left;
}
.dash-almanac__row b {
  display: inline-block;
  border-radius: 6px;
  padding: 0 6px;
  margin-right: 2px;
  font-weight: 700;
}
.dash-almanac__row--yi b { color: #0f766e; background: #ccfbf1; }
.dash-almanac__row--ji b { color: #b91c1c; background: #fee2e2; }

/* --- 互动玩偶（裸玩偶：无卡片框无圆框，5 个动作切换，气泡悬浮在头顶）
     独立在右侧第二列中，底部与卡片对齐，justify-self:end 贴容器右缘 --- */
.dash-pet {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-end;      /* 玩偶自身在列内靠右，贴到 grid 右缘（用户要求：右移利用右边空间）*/
  justify-content: flex-end;  /* 内容靠底部，配合 grid align-items:end 对齐卡片底部 */
  padding: 0;
  margin: 0;
  min-height: 0;
  width: 100%;
}
.dash-pet__bubble {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 180px;
  background: #fff;
  border: 1px solid #dde9e8;
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-secondary);
  text-align: center;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  box-shadow: 0 6px 16px -10px rgba(15, 23, 42, 0.25);
  z-index: 5;
}
.dash-pet__bubble--hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.dash-pet__bubble::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 10px;
  height: 10px;
  background: #fff;
  border-right: 1px solid #dde9e8;
  border-bottom: 1px solid #dde9e8;
  transform: translateX(-50%) rotate(45deg);
  transition: opacity 0.25s ease;
}
.dash-pet__bubble--hidden::after { opacity: 0; }
.dash-pet__bubble--pop { animation: petBubblePop 0.35s ease; }
@keyframes petBubblePop {
  0%   { transform: translateX(-50%) scale(0.85); opacity: 0.4; }
  60%  { transform: translateX(-50%) scale(1.04); }
  100% { transform: translateX(-50%) scale(1); opacity: 1; }
}
.dash-pet__face {
  border: none;
  background: transparent;
  border-radius: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
  overflow: visible;
  box-shadow: none;
  transition: transform 0.18s ease;
  position: relative;
  width: 275px;    /* 从 320 → 275，缩小约 14% */
  height: 380px;   /* 从 440 → 380，缩小约 14% */
}
.dash-pet__img {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 300px;
  height: auto;
  display: block;
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;
  opacity: 0;
  transform-origin: center bottom;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.dash-pet__face img[data-pose="idle"]    { transform: translate(-50%, -50%) scale(1); }
.dash-pet__face img[data-pose="excited"] { transform: translate(-50%, -50%) scale(1); }
.dash-pet__face img[data-pose="shy"]     { transform: translate(-50%, -50%) scale(1); }
.dash-pet__face img[data-pose="wink"]    { transform: translate(-50%, -50%) scale(1); }
.dash-pet__face img[data-pose="sleep"]   { transform: translate(-50%, -50%) scale(1); }

/* 默认显示 idle，其他全部隐藏 */
.dash-pet__face img[data-pose="idle"]    { opacity: 1; }
.dash-pet__face img[data-pose="excited"],
.dash-pet__face img[data-pose="shy"],
.dash-pet__face img[data-pose="wink"],
.dash-pet__face img[data-pose="sleep"]   { opacity: 0; }

/* 当 face 加上 pose-* 类时切到对应动作 */
.dash-pet__face--pose-idle    img[data-pose="idle"]    { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.dash-pet__face--pose-idle    img[data-pose="excited"],
.dash-pet__face--pose-idle    img[data-pose="shy"],
.dash-pet__face--pose-idle    img[data-pose="wink"],
.dash-pet__face--pose-idle    img[data-pose="sleep"]   { opacity: 0; }

.dash-pet__face--pose-excited img[data-pose="excited"] { opacity: 1; }
.dash-pet__face--pose-excited img[data-pose="idle"],
.dash-pet__face--pose-excited img[data-pose="shy"],
.dash-pet__face--pose-excited img[data-pose="wink"],
.dash-pet__face--pose-excited img[data-pose="sleep"]  { opacity: 0; }
.dash-pet__face--pose-excited img[data-pose="excited"] { animation: petExcited 0.6s ease infinite; }

.dash-pet__face--pose-shy     img[data-pose="shy"]     { opacity: 1; }
.dash-pet__face--pose-shy     img[data-pose="idle"],
.dash-pet__face--pose-shy     img[data-pose="excited"],
.dash-pet__face--pose-shy     img[data-pose="wink"],
.dash-pet__face--pose-shy     img[data-pose="sleep"]   { opacity: 0; }
.dash-pet__face--pose-shy     img[data-pose="shy"]     { animation: petShy 0.55s ease 2; }

.dash-pet__face--pose-wink    img[data-pose="wink"]    { opacity: 1; }
.dash-pet__face--pose-wink    img[data-pose="idle"],
.dash-pet__face--pose-wink    img[data-pose="excited"],
.dash-pet__face--pose-wink    img[data-pose="shy"],
.dash-pet__face--pose-wink    img[data-pose="sleep"]   { opacity: 0; }
.dash-pet__face--pose-wink    img[data-pose="wink"]    { animation: petWink 0.8s ease; }

.dash-pet__face--pose-sleep   img[data-pose="sleep"]   { opacity: 1; }
.dash-pet__face--pose-sleep   img[data-pose="idle"],
.dash-pet__face--pose-sleep   img[data-pose="excited"],
.dash-pet__face--pose-sleep   img[data-pose="shy"],
.dash-pet__face--pose-sleep   img[data-pose="wink"]    { opacity: 0; }
.dash-pet__face--pose-sleep   img[data-pose="sleep"]   { animation: petSleep 3.5s ease infinite; transform: translate(-50%, -50%) scale(0.9); }

/* 动作关键帧 */
@keyframes petExcited {
  0%   { transform: translate(-50%, -50%) scale(1) translateY(0); }
  20%  { transform: translate(-50%, -50%) scale(1.08) translateY(-18px) rotate(-3deg); }
  45%  { transform: translate(-50%, -50%) scale(0.96) translateY(4px) rotate(2deg); }
  65%  { transform: translate(-50%, -50%) scale(1.04) translateY(-10px) rotate(-1deg); }
  100% { transform: translate(-50%, -50%) scale(1) translateY(0); }
}
@keyframes petShy {
  0%   { transform: translate(-50%, -50%) scale(1); }
  30%  { transform: translate(-50%, -50%) scale(0.94) translateX(-6px); }
  60%  { transform: translate(-50%, -50%) scale(0.94) translateX(6px); }
  100% { transform: translate(-50%, -50%) scale(1); }
}
@keyframes petWink {
  0%   { transform: translate(-50%, -50%) scale(0.85) rotate(-8deg); opacity: 0; }
  60%  { transform: translate(-50%, -50%) scale(1.06) rotate(3deg); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1) rotate(0); opacity: 1; }
}
@keyframes petSleep {
  0%, 100% { transform: translate(-50%, -50%) scale(0.9) translateY(0); }
  50%      { transform: translate(-50%, -50%) scale(0.92) translateY(-3px); }
}

.dash-pet__face:hover { transform: translateY(-2px); }
.dash-pet__face:active { transform: scale(0.96); }

/* 睡觉状态时挂一个 Zzz 漂浮（动画只挂在 pose-sleep 下，避免一直飘） */
.dash-pet__zzz {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 30px;
  font-weight: 800;
  color: var(--text-secondary);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.dash-pet__face--pose-sleep .dash-pet__zzz {
  opacity: 0.85;
  visibility: visible;
  animation: petZzz 2.4s ease-in infinite;
}
@keyframes petZzz {
  0%   { transform: translate(0, 0) scale(0.6); opacity: 0; }
  20%  { opacity: 0.9; }
  100% { transform: translate(18px, -36px) scale(1.1); opacity: 0; }
}

/* --- 天气 --- */
.dash-city-change {
  border: 1px solid #d3e2e0;
  background: #fff;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  border-radius: 8px;
  padding: 4px 10px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.dash-city-change:hover { background: var(--primary-bg); }
.dash-weather-now { text-align: center; padding: 2px 0 8px; }
.dash-wn__main {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.dash-wn__icon { font-size: 34px; line-height: 1; }
.dash-wn__temp { font-size: 36px; font-weight: 800; color: var(--text-primary); }
.dash-wn__desc { font-size: 14px; font-weight: 700; color: var(--primary-dark); margin-top: 2px; }
.dash-wn__meta { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.dash-weather-summary {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.7;
  border-top: 1px dashed #d9e6e4;
  padding-top: 8px;
  margin-top: 4px;
}
.dash-weather-alert {
  font-size: 12.5px;
  font-weight: 600;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 6px 10px;
  margin-top: 8px;
  display: none;
}
.dash-weather-alert:not(:empty) { display: block; }
.dash-weather-hours {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-top: 10px;
  padding-bottom: 4px;
}
.dash-weather-hours::-webkit-scrollbar { height: 5px; }
.dash-weather-hours::-webkit-scrollbar-thumb { background: #cfe3e1; border-radius: 3px; }
.dash-wh-chip {
  flex: 0 0 auto;
  text-align: center;
  background: #fff;
  border: 1px solid #e2ecea;
  border-radius: 10px;
  padding: 6px 8px;
  min-width: 48px;
}
.dash-wh-chip__time { font-size: 11px; color: var(--text-secondary); }
.dash-wh-chip__icon { font-size: 17px; margin: 2px 0; }
.dash-wh-chip__temp { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.dash-wh-chip__prob { font-size: 10.5px; color: var(--text-secondary); min-height: 14px; }
.dash-wh-chip__prob--wet { color: #2563eb; font-weight: 700; }

/* --- 城市选择弹窗 --- */
.city-search { display: flex; gap: 8px; margin-bottom: 12px; }
.city-search input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid #d3e2e0;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
}
.city-search input:focus { border-color: var(--primary-light); }
.city-searching { font-size: 13px; color: var(--text-secondary); padding: 6px 2px; }
.city-result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: #fff;
  border: 1px solid #e2ecea;
  border-radius: 8px;
  padding: 9px 12px;
  margin-bottom: 6px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-primary);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.city-result-row:hover { background: var(--primary-bg); border-color: var(--primary-light); }
.city-result-row__name { text-align: left; }
.city-result-row__go { font-size: 12px; color: var(--primary); font-weight: 600; flex: 0 0 auto; }
.city-result-row--local {
  border-left: 3px solid var(--primary);
}
.city-result-row--local .city-result-row__go {
  color: var(--success);
}
.city-result-divider {
  font-size: 12px;
  color: var(--text-muted);
  margin: 8px 2px 4px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-color);
}
.city-search-tip {
  font-size: 12px;
  color: var(--text-muted);
  margin: 6px 2px;
  line-height: 1.5;
  padding: 6px 8px;
  background: var(--primary-bg);
  border-radius: var(--border-radius-sm);
}
.city-hot { margin-top: 14px; }
.city-hot h4 { font-size: 13px; color: var(--text-secondary); margin: 0 0 8px; font-weight: 600; }
.city-hot-list { display: flex; flex-wrap: wrap; gap: 6px; }
.city-chip {
  border: 1px solid #d3e2e0;
  background: #fff;
  color: var(--text-primary);
  font-size: 12.5px;
  border-radius: 999px;
  padding: 4px 12px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.city-chip:hover { background: var(--primary-bg); border-color: var(--primary-light); color: var(--primary); }

/* --- 仪表盘响应式 --- */
/* 中窄屏逐级缩小玩偶列，保证任何视口宽度都不出现横向滚动条 */
@media (max-width: 1100px) {
  .dash-layout { grid-template-columns: minmax(0, 1fr) 240px; }
  .dash-pet__face { width: 240px; height: 330px; }
  .dash-pet__img { width: 220px; }
  .dash-pet__zzz { top: 14px; right: 22px; font-size: 24px; }
}
@media (max-width: 930px) {
  .dash-layout { grid-template-columns: minmax(0, 1fr) 190px; }
  .dash-pet__face { width: 190px; height: 260px; }
  .dash-pet__img { width: 175px; }
  .dash-pet__zzz { top: 10px; right: 16px; font-size: 20px; }
}
@media (max-width: 860px) {
  .dash-layout { grid-template-columns: 1fr; }
  /* 窄屏：玩偶取消悬浮，回到卡片下方正常居中排列 */
  .dash-pet { width: 100%; height: auto; align-self: auto; display: flex; justify-content: center; margin-top: 4px; }
  .dash-pet__bubble { width: auto; max-width: 320px; }
  .dash-pet__bubble::after { display: none; }
  .dash-pet__face { position: relative; top: auto; right: auto; width: 260px; height: 360px; }
  .dash-pet__img { width: 240px; }
  .dash-pet__zzz { top: 16px; right: 24px; font-size: 24px; }
}
@media (max-width: 640px) {
  .dash-grid { grid-template-columns: 1fr; }
  .dash-clock { text-align: left; }
  .dash-email { max-width: 180px; }
  .home-dashboard { margin: 0 0 20px; }
  .dash-card { padding: 18px 16px; border-radius: 14px; }
}

