/* 公共布局、导航、标签页、共享提示区、按钮、弹窗和客服入口。 */

/* 升学计算器链接放大 */
.nav-calc-link {
  font-size: 1rem;
  font-weight: 700;
  padding: 0.4rem 1rem;
  border-radius: 20px;
  background: #f0fdf4;
  color: #16a34a;
  transition: all 0.2s;
}

.nav-calc-link:hover {
  background: #dcfce7;
  transform: scale(1.05);
}

.chat-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 0.5rem 1rem;
  border-radius: 50px;
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  color: white;
  border: none;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(37, 99, 235, 0.4);
  transition: all 0.2s;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 6px;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.chat-btn:hover {
  box-shadow: 0 6px 22px rgba(37, 99, 235, 0.55);
  transform: scale(1.05);
}

.chat-btn .chat-icon { font-size: 1rem; }

@media (max-width: 480px) {
  /* 升学计算器链接放大 */
  .nav-calc-link {
    font-size: 1rem;
    font-weight: 700;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    background: #f0fdf4;
    color: #16a34a;
    transition: all 0.2s;
  }

  .nav-calc-link:hover {
    background: #dcfce7;
    transform: scale(1.05);
  }

  .chat-btn {
    bottom: 16px;
    right: 16px;
    top: auto;
    transform: none;
    padding: 0.45rem 0.9rem;
    font-size: 0.75rem;
    border-radius: 50px;
    box-shadow: 0 4px 18px rgba(37, 99, 235, 0.5);
  }
}

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

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

.modal {
  background: white;
  border-radius: 16px;
  padding: 1.2rem;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.modal h3 { margin-bottom: 1.5rem; font-size: 1.2rem; }

.modal .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.modal .btn-group { display: flex; gap: 0.75rem; margin-top: 1.5rem; }

.modal .btn-group .btn { flex: 1; }

.admin-card {
  background: #fff;
  border-radius: 10px;
  padding: 1.25rem 1.25rem 1.25rem 1rem;
  border: 1px solid var(--gray-200);
  border-left: 4px solid var(--gray-300);
}

.admin-card h4 { display: flex; align-items: center; gap: 8px; }

.admin-card h4::before { content: ''; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.pwd-wrap { position: relative; display: flex; align-items: center; }

.pwd-wrap input { flex: 1; padding-right: 40px !important; }

.pwd-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; padding: 4px;
  color: #94a3b8; display: flex; align-items: center;
  -webkit-tap-highlight-color: transparent;
}

.pwd-toggle:active { color: #64748b; }

.batch-actions {
  display: inline-flex;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 4px 6px 4px 12px;
  gap: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.btn-batch {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 12px; border: none; border-radius: 8px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: all 0.12s;
  -webkit-tap-highlight-color: transparent;
}

.btn-batch._edit { background: #eef2ff; color: #4f46e5; }

.btn-batch._edit:active { background: #e0e7ff; transform: scale(0.95); }

.btn-batch._del { background: #fef2f2; color: #dc2626; }

.btn-batch._del:active { background: #fee2e2; transform: scale(0.95); }

@media (max-width: 600px) {
  .admin-section-header { align-items: flex-start; gap: 10px; }
}

.admin-section { margin-bottom: 2rem; }

.conv-item { transition: all 0.2s ease; }

.conv-item:hover { background: var(--primary-light) !important; }

/* Toast */
#toast-container {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 24px; border-radius: 12px;
  font-size: 0.9rem; font-weight: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  animation: toastIn 0.3s ease;
  pointer-events: auto;
  white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 90vw;
}

.toast.toast-error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }

.toast.toast-success { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }

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

/* 学科多选复选框 */
.subj-cb-grid { display: flex; flex-wrap: wrap; gap: 10px; }

.subj-cb {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 18px;
  border: 2px solid #e2e8f0; border-radius: 10px;
  cursor: pointer; font-size: 0.9rem; font-weight: 500;
  transition: all 0.2s ease;
  user-select: none;
  background: #f8fafc;
  color: #475569;
}

.subj-cb:hover { border-color: #a5b4fc; background: #eef2ff; color: #4338ca; }

.subj-cb:has(input:checked) {
  border-color: #6366f1; background: #4f46e5; color: #fff;
  box-shadow: 0 2px 8px rgba(79,70,229,0.3);
}

.subj-cb input { display: none; }

.conv-item.active { background: #dbeafe !important; border-color: #6366f1 !important; box-shadow: 0 0 0 1px #6366f1; }

@media (max-width: 600px) {
  .modal .form-row { grid-template-columns: 1fr; gap: 0.5rem; }

  .modal .form-group { margin-bottom: 0.4rem; }

  .modal h3 { margin-bottom: 0.8rem; }

  .modal .btn-group { margin-top: 0.8rem; }
}

@media (max-width: 768px) {
  .admin-card .form-row { grid-template-columns: 1fr !important; }

  .admin-card .form-row-3 { grid-template-columns: 1fr !important; }

  /* 课程管理表格横向滚动 */
  div[style*="overflow-x:auto"] { -webkit-overflow-scrolling: touch; }

  div[style*="overflow-x:auto"] table { min-width: 600px; }

  /* 按钮触控优化 */
  .btn { min-height: 40px; }

  .btn-sm { min-height: 36px; }

  input,
  select,
  textarea { font-size: 16px !important; }

  /* iOS 防缩放 */
  .modal { padding: 1.25rem; }

  .modal .btn-group { flex-direction: column; }

  .modal .btn-group .btn { width: 100%; }

  .admin-section--wide { max-width: 1436px; }

  .tab-content.active { padding-left: 0; padding-right: 0; }
}

/* 学科多选 */
.subject-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 42px;
  align-items: center;
}

.subject-grid .subject-empty {
  color: var(--gray-400);
  font-size: 0.9rem;
}

.btn-light { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; border-radius: 8px; padding: 8px 16px; font-weight: 600; font-size: 14px; cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; gap: 4px; font-family: inherit; }

.btn-light:hover { background: #e2e8f0; }

/* 预约记录手机端卡片 */
@media (max-width: 640px) {
  .admin-card table,
  .admin-card thead,
  .admin-card tbody,
  .admin-card th,
  .admin-card td,
  .admin-card tr { display:block; }

  .admin-card thead tr { display:none; }

  .admin-card tbody tr { margin-bottom:0.75rem; border:1px solid #e5e7eb; border-radius:10px; padding:0.75rem; background:#fff; }

  .admin-card tbody td { padding:4px 0; font-size:0.82rem; border:none; text-align:left; }

  .admin-card tbody td:before { content:attr(data-label); font-weight:600; display:inline-block; width:80px; color:var(--gray-500); }
}

/* 页面视觉优化 */
.admin-section {
  background: #fff;
  border-radius: 12px;
  padding: 0.25rem 1.25rem 1rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  border: 1px solid #f0f0f0;
}

@media (max-width: 768px) {
  .admin-section { padding: 0.1rem 1rem 0.75rem 1rem; margin-left: 0; margin-right: 0; }

  .section-header { padding-left: 1.2rem; padding-right: 1.2rem; }
}

.admin-section--wide {
  max-width: 1436px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

.admin-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-section-header h2 {
  font-size: 1rem;
  margin: 0;
  font-weight: 700;
}

.header-actions {
  display: flex;
  gap: 6px;
}

.btn-primary {
  background: #4f46e5;
  color: #fff;
  border: none;
  padding: 6px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.btn-primary:hover { background: #4338ca; transform: translateY(-1px); box-shadow: 0 2px 8px rgba(79,70,229,0.2); }

.btn-primary:active { transform: translateY(0); }

.btn-outline {
  background: transparent;
  color: #475569;
  border: 1px solid #d1d5db;
  padding: 6px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.btn-outline:hover { background: #f1f5f9; border-color: #94a3b8; }

.btn-sm { padding: 4px 12px; font-size: 0.78rem; }

/* 用户端我的资料 */
.materials-hero { background: linear-gradient(118deg, #ecfdf5 0%, #dff7ef 48%, #dbeafe 100%); border-color: #ccefe2; }

.materials-hero-mark { color: #059669; }

.materials-hero-mark img { width: 34px; height: 34px; object-fit: contain; margin-bottom: 5px; filter: drop-shadow(0 7px 10px rgba(30,41,59,0.14)); }

@media (max-width: 640px) {
  .materials-hero { min-height: 150px; }

  .materials-hero-mark { width: 78px; height: 78px; padding: 0.65rem; border-radius: 20px; }

  .materials-hero-mark img { width: 24px; height: 24px; }
}

.btn-light { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; border-radius: 8px; padding: 6px 14px; font-weight: 600; font-size: 0.85rem; cursor: pointer; transition: all 0.15s; font-family: inherit; }

.btn-light:hover { background: #e2e8f0; }

/* 预约记录手机端卡片 */
@media (max-width: 640px) {
  .admin-card table,
  .admin-card thead,
  .admin-card tbody,
  .admin-card th,
  .admin-card td,
  .admin-card tr { display: block; }

  .admin-card thead tr { display: none; }

  .admin-card tbody tr { margin-bottom: 0.75rem; border: 1px solid #e5e7eb; border-radius: 10px; padding: 0.75rem; background: #fff; }

  .admin-card tbody td { padding: 4px 0; font-size: 0.82rem; border: none; text-align: left; }

  .admin-card tbody td:before { content: attr(data-label); font-weight: 600; display: inline-block; width: 80px; color: #64748b; }
}

@keyframes spin {
      0% { transform: rotate(0deg); }
      100% { transform: rotate(360deg); }
    }

@keyframes regFadeIn {
      0% { opacity: 0; }
      100% { opacity: 1; }
    }

@media (max-width: 480px) {
  .section-header { padding-left: 0.95rem; padding-right: 0.95rem; }

  .admin-section { padding: 0.1rem 1rem 0.75rem 1rem; }
}

/* 学科多选增强 */
.subject-grid {
  display: flex; flex-wrap: wrap; gap: 10px;
  min-height: 42px; align-items: center;
}

.subject-grid .subject-empty {
  color: #94a3b8; font-size: 0.8rem;
  padding: 8px 0;
}

.section-header {
  display: flex; align-items: center; gap: 8px;
  font-size: 1.05rem; font-weight: 700; color: #1e293b;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  padding: 0.6rem 1rem;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border-radius: 12px;
  border-left: 4px solid #4f46e5;
}

.btn-export {
  margin-left: auto;
  padding: 0.35rem 0.75rem; border: 1.5px solid #c7d2fe; border-radius: 8px;
  background: #fff; color: #4f46e5;
  font-size: 0.73rem; font-weight: 700;
  cursor: pointer; transition: all .15s;
  font-family: inherit; white-space: nowrap;
}

.btn-export:hover { background: #eef2ff; border-color: #a5b4fc; }

.btn-export:active { transform: scale(0.96); }

/* ===== 最新消息样式 ===== */
.news-hero { background: linear-gradient(118deg, #eef2ff 0%, #e0e7ff 52%, #dbeafe 100%); }

.news-hero-mark { color: #4f46e5; }

.news-hero-mark img { width: 34px; height: 34px; object-fit: contain; margin-bottom: 5px; filter: drop-shadow(0 7px 10px rgba(30,41,59,0.14)); }

@media (max-width: 640px) {
  .news-hero { min-height: 150px; }

  .news-hero-mark { width: 78px; height: 78px; padding: 0.65rem; border-radius: 20px; }

  .news-hero-mark img { width: 24px; height: 24px; }
}

textarea.ann-input { resize: vertical; min-height: 80px; }

.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.2rem 1.4rem 0;
}

.modal-header h3 { margin: 0; font-size: 1.05rem; font-weight: 700; color: #1e293b; }

.modal-close {
  width: 32px; height: 32px; border: none; background: #f1f5f9;
  border-radius: 10px; font-size: 1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: #94a3b8;
  transition: all .15s;
}

.modal-close:hover { background: #e2e8f0; color: #475569; }

.modal-body { padding: 1rem 1.4rem; }

.modal-body .form-group { margin-bottom: 0.8rem; }

.modal-body .form-group label { display: block; font-size: 0.82rem; font-weight: 600; color: #475569; margin-bottom: 4px; }

.modal-footer {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 0.8rem 1.4rem 1.2rem;
}

/* ===== Tab 标签美化 ===== */
.tabs {
  display: flex !important;
  flex-wrap: wrap; column-gap: 12px; row-gap: 6px; align-items: center;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid #eef2f6;
  border-radius: 14px;
  padding: 8px 10px;
  min-height: 52px;
  margin-bottom: 0.15rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03), 0 4px 12px rgba(0,0,0,0.02);
  grid-template-columns: none !important;
}

.tab {
  padding: 8px 16px; border-radius: 10px;
  border: none; cursor: pointer;
  font-size: 0.82rem; font-weight: 600;
  color: #64748b;
  background: transparent;
  transition: all .2s;
  font-family: inherit;
  white-space: nowrap;
  touch-action: manipulation;
}

.tab:hover {
  color: #334155;
  background: rgba(79,70,229,0.05);
}

.tab.active {
  color: #4f46e5;
  background: linear-gradient(135deg, #eef2ff, #fff);
  box-shadow: 0 2px 8px rgba(79,70,229,0.12);
  border: 1px solid rgba(79,70,229,0.08);
  position: relative;
}

.tab.active::after {
  content: '';
  position: absolute; bottom: -1px; left: 20%; right: 20%;
  height: 2px; border-radius: 2px;
  background: #4f46e5;
}

/* 角标适配 */
.tab .chat-badge { vertical-align: middle; }

/* 移动端 tab */
@media (max-width: 640px) {
  .tabs {
    flex-wrap: nowrap; overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 4px; padding: 6px 1rem;
    border-radius: 12px;
    position: relative;
  }

  .tabs::-webkit-scrollbar { display: none; }

  .tabs::after {
    content: '';
    position: sticky; right: 0;
    width: 40px; height: 32px; flex-shrink: 0;
    background:
      linear-gradient(to right, transparent 0%, rgba(255,255,255,0.92) 55%),
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='14' viewBox='0 0 8 14'%3E%3Cpath d='M1 1l6 6-6 6' stroke='%230f172a' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center / 8px 14px;
    pointer-events: none;
    margin-left: -40px;
  }

  .tabs::-webkit-scrollbar { display: none; }

  .tab {
    padding: 6px 12px; font-size: 0.82rem;
    flex-shrink: 0;
  }

  .tab.active::after { left: 10%; right: 10%; }
}

/* ===== 用户端留言与预约升级 ===== */
.user-page-hero {
  position: relative;
  display: flex; align-items: center; justify-content: space-between;
  min-height: 172px; margin: 0.5rem 0 0.8rem; padding: 1.7rem 2rem;
  border-radius: 22px; overflow: hidden;
  border: 1px solid #dbe4ff;
  box-shadow: 0 14px 34px rgba(30,41,59,0.08);
}

.user-page-hero::before,
.user-page-hero::after { content: ''; position: absolute; border-radius: 50%; pointer-events: none; }

.user-page-hero::before {
  width: 220px; height: 220px; right: 7%; top: -145px;
  border: 1px solid rgba(255,255,255,0.58);
  box-shadow: 0 0 0 18px rgba(255,255,255,0.12), 0 0 0 36px rgba(255,255,255,0.08);
}

.user-page-hero::after {
  width: 90px; height: 90px; right: 24%; bottom: -58px;
  background: rgba(255,255,255,0.18);
}

.appointment-hero { background: linear-gradient(118deg, #eef2ff 0%, #e0e7ff 52%, #dbeafe 100%); }

.message-hero { background: linear-gradient(118deg, #ecfdf5 0%, #dff7ef 48%, #dbeafe 100%); border-color: #ccefe2; }

.user-page-hero-copy { position: relative; z-index: 1; max-width: 660px; }

.user-page-eyebrow {
  display: inline-block; margin-bottom: 0.45rem; color: #6366f1;
  font-size: 0.67rem; font-weight: 800; letter-spacing: 0.16em;
}

.message-hero .user-page-eyebrow { color: #059669; }

.user-page-hero h2 {
  margin: 0 0 0.35rem; color: #172554; font-size: clamp(1.2rem, 2.5vw, 1.72rem);
  line-height: 1.35; letter-spacing: -0.02em;
}

.message-hero h2 { color: #064e3b; }

.user-page-hero p { margin: 0; color: #52627d; font-size: 0.84rem; line-height: 1.75; }

.message-hero p { color: #37675c; }

.user-page-hero-mark {
  position: relative; z-index: 1; display: flex; flex-direction: column;
  justify-content: center; align-items: center; flex-shrink: 0;
  width: 112px; height: 112px; padding: 1rem;
  color: #4f46e5; border: 1px solid rgba(255,255,255,0.8); border-radius: 28px;
  background: rgba(255,255,255,0.46); box-shadow: inset 0 1px 0 #fff, 0 12px 24px rgba(79,70,229,0.12);
  transform: rotate(4deg);
}

.user-page-hero-mark img { width: 34px; height: 34px; object-fit: contain; margin-bottom: 5px; filter: drop-shadow(0 7px 10px rgba(30,41,59,0.14)); }

.user-page-hero-mark span { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.16em; }

.user-page-hero-mark strong { font-size: 2.9rem; line-height: 1; letter-spacing: -0.08em; }

.message-hero-mark { color: #059669; }

.message-hero-mark img { width: 34px; height: 34px; object-fit: contain; margin-bottom: 5px; filter: drop-shadow(0 7px 10px rgba(30,41,59,0.14)); }

.user-page-notes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 0.85rem; }

.user-page-note {
  display: flex; align-items: center; gap: 10px; min-width: 0; padding: 0.72rem 0.8rem;
  background: rgba(255,255,255,0.88); border: 1px solid #e7edf5; border-radius: 14px;
  box-shadow: 0 4px 14px rgba(30,41,59,0.035);
}

.user-page-note-num,
.user-page-note-icon {
  display: inline-flex; align-items: center; justify-content: center; width: 29px; height: 29px;
  flex-shrink: 0; border-radius: 9px; background: #eef2ff; color: #4f46e5;
  font-size: 0.68rem; font-weight: 800;
}

.user-page-note div { min-width: 0; }

.user-page-note b,
.user-page-note small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.user-page-note b { color: #334155; font-size: 0.75rem; }

.user-page-note small { margin-top: 2px; color: #94a3b8; font-size: 0.67rem; }

@media (max-width: 640px) {
  .user-page-hero { min-height: 150px; padding: 1.25rem 1.1rem; border-radius: 18px; }

  .user-page-hero-mark { width: 72px; height: 72px; padding: 0.55rem; border-radius: 18px; overflow: hidden; }

  .user-page-hero-mark img { width: 24px; height: 24px; margin-bottom: 3px; }

  .user-page-hero-mark span { max-width: 100%; font-size: 0.52rem; letter-spacing: 0.08em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  .user-page-hero-mark strong { max-width: 100%; font-size: 1.75rem; letter-spacing: -0.05em; }

  .message-hero-mark img { width: 24px; height: 24px; }

  .user-page-hero p { font-size: 0.75rem; max-width: 235px; }

  .user-page-eyebrow { font-size: 0.58rem; letter-spacing: 0.1em; }

  .user-page-notes { grid-template-columns: 1fr; gap: 7px; }

  .user-page-note { padding: 0.58rem 0.72rem; }
}

/* ===== Dashboard polish: cleaner admin/user workspace ===== */
.dashboard {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.25rem clamp(0.75rem, 2vw, 1.5rem) 2rem;
}

.dashboard-welcome {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(99, 102, 241, 0.16);
  box-shadow: 0 18px 45px rgba(79, 70, 229, 0.13);
}

.dashboard-welcome::after {
  content: '';
  position: absolute;
  right: -70px;
  bottom: -95px;
  width: 230px;
  height: 230px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.42), rgba(255,255,255,0));
  pointer-events: none;
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 0.85rem 0 1rem;
  padding: 0.45rem;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
}

.tab {
  border-radius: 14px;
  border: 1px solid transparent;
  background: transparent;
}

.tab:hover {
  border-color: rgba(99, 102, 241, 0.18);
  background: #f8fafc;
  transform: translateY(-1px);
}

.tab.active { box-shadow: 0 10px 24px rgba(79, 70, 229, 0.22); }

.tab-content.active { animation: dashboardFadeUp 0.22s ease-out; }

.admin-card,
.admin-section { box-shadow: 0 10px 28px rgba(15, 23, 42, 0.07); }

.admin-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.1);
}

.admin-card { transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease; }

@keyframes dashboardFadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
  .dashboard { padding: 0.85rem 0.7rem 1.5rem; }

  .tabs { top: 0; border-radius: 16px; overflow-x: auto; flex-wrap: nowrap; }

  .tab { flex: 0 0 auto; }
}

/* ===== Admin operations polish: info, registrations, campus, announcements, messages ===== */
.admin-polish-page { position: relative; }

.admin-polish-page > .section-header,
.admin-polish-page .admin-section-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255,255,255,0.98), rgba(248,250,252,0.92));
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

.admin-polish-page > .section-header::before,
.admin-polish-page .admin-section-header::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: linear-gradient(180deg, #4f46e5, #06b6d4);
}

.admin-polish-page > .section-header .tab-icon,
.admin-polish-page .admin-section-header .tab-icon {
  padding: 7px;
  width: 34px !important;
  height: 34px !important;
  border-radius: 12px;
  background: #eef2ff;
  box-shadow: inset 0 0 0 1px rgba(79,70,229,0.08);
}

.admin-polish-page .btn-export,
.admin-polish-page .header-actions .btn,
.admin-polish-page .info-save-btn,
.admin-polish-page .ann-admin-btn,
.admin-polish-page .ann-refresh {
  border-radius: 999px !important;
  box-shadow: 0 8px 18px rgba(79,70,229,0.16);
}

@media (max-width: 768px) {
  .admin-polish-page > .section-header,
  .admin-polish-page .admin-section-header { align-items: flex-start; flex-direction: column; padding: 0.9rem; }
}

/* ===== Compact correction: restore desktop width and reduce empty spacing ===== */
@media (min-width: 769px) {
  .dashboard {
    max-width: 1500px;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  .dashboard-welcome {
    padding: 1.05rem 1.25rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 10px 26px rgba(79, 70, 229, 0.09);
  }

  .tabs {
    position: static;
    margin: 0.6rem 0 0.85rem;
    padding: 0.28rem;
    border-radius: 14px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
  }

  .tab {
    padding-top: 0.48rem;
    padding-bottom: 0.48rem;
    border-radius: 11px;
  }

  .admin-polish-page > .section-header,
  .admin-polish-page .admin-section-header {
    padding: 0.72rem 0.95rem;
    margin-bottom: 0.75rem;
    border-radius: 14px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.055);
  }
}

/* ===== Spacing correction: restore compact vertical rhythm ===== */
@media (min-width: 769px) {
  .dashboard {
    padding-top: 0.75rem;
    padding-bottom: 1.25rem;
  }

  .dashboard-welcome { margin-bottom: 0.45rem; }

  .tabs {
    margin-top: 0.45rem;
    margin-bottom: 0.55rem;
  }

  .tab-content.active { padding-top: 0 !important; }

  .section-header,
  .admin-section-header,
  .user-page-hero { margin-top: 0 !important; }

  .section-header,
  .admin-polish-page > .section-header,
  .admin-polish-page .admin-section-header {
    margin-bottom: 0.5rem !important;
    padding-top: 0.58rem !important;
    padding-bottom: 0.58rem !important;
  }

  .admin-section { margin-bottom: 1rem; }
}

/* ===== Final rhythm reset: restore original compact vertical spacing ===== */
.dashboard {
  max-width: 1480px !important;
  padding-top: 0.5rem !important;
  padding-bottom: 0.8rem !important;
}

.dashboard-welcome { margin-bottom: 0.5rem !important; }

.tabs {
  position: static !important;
  margin-top: 0.35rem !important;
  margin-bottom: 0.55rem !important;
}

.tab-content.active {
  padding-top: 0 !important;
  margin-top: 0 !important;
}

.section-header,
.admin-section-header,
.user-page-hero { margin-top: 0 !important; }

.section-header,
.admin-polish-page > .section-header,
.admin-polish-page .admin-section-header { margin-bottom: 0.45rem !important; }

.admin-section {
  margin-top: 0 !important;
  margin-bottom: 0.85rem !important;
}

@media (min-width: 769px) {
  .dashboard {
    padding-left: 2rem !important;
    padding-right: 2rem !important;
  }

  .dashboard-welcome { padding: 1.05rem 1.35rem !important; }

  .tabs {
    column-gap: 18px;
    padding: 0.22rem !important;
    border-radius: 12px !important;
  }

  .tab { padding: 0.55rem 0.48rem !important; }

  .section-header,
  .admin-polish-page > .section-header,
  .admin-polish-page .admin-section-header {
    padding-top: 0.52rem !important;
    padding-bottom: 0.52rem !important;
  }
}

@media (max-width: 768px) {
  .dashboard { padding: 0.6rem !important; }

  .dashboard-welcome {
    padding: 0.85rem !important;
    margin-bottom: 0.45rem !important;
    border-radius: 14px !important;
    gap: 0.35rem !important;
  }

  .welcome-eyebrow { margin-bottom: 0.35rem !important; }

  .tabs {
    padding: 3px !important;
    margin: 0.35rem 0 0.45rem !important;
    border-radius: 12px !important;
    gap: 2px !important;
  }

  .tab {
    padding: 0.34rem 0.42rem !important;
    font-size: 0.72rem !important;
    border-radius: 8px !important;
  }

  .tab-icon {
    width: 20px !important;
    height: 20px !important;
    margin-right: 2px !important;
  }

  .section-header,
  .admin-polish-page > .section-header,
  .admin-polish-page .admin-section-header {
    padding: 0.5rem 0.75rem !important;
    margin-bottom: 0.4rem !important;
    border-radius: 12px !important;
  }

  .admin-section {
    padding: 0.1rem 0.75rem 0.6rem 0.75rem !important;
    margin-bottom: 0.65rem !important;
  }
}

/* ===== Final compact layout pass: tighter panels and larger mobile controls ===== */
.dashboard { max-width: 1480px !important; }

.dashboard-welcome,
.tabs,
.section-header,
.admin-section-header,
.admin-section { margin-top: 0 !important; }

.dashboard-welcome { margin-bottom: 0.4rem !important; }

.tabs { margin: 0.25rem 0 0.42rem !important; }

.tab-content.active { padding-top: 0 !important; }

.section-header,
.admin-section-header,
.admin-polish-page > .section-header,
.admin-polish-page .admin-section-header { margin-bottom: 0.35rem !important; }

.admin-section { margin-bottom: 0.55rem !important; }

.admin-header-subtitle {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--gray-500);
  line-height: 1.3;
}

@media (min-width: 769px) {
  .dashboard { padding: 0.5rem 2rem 0.8rem !important; }

  .dashboard-welcome { padding: 0.95rem 1.25rem !important; }

  .section-header,
  .admin-section-header,
  .admin-polish-page > .section-header,
  .admin-polish-page .admin-section-header { padding: 0.48rem 0.85rem !important; }
}

@media (max-width: 768px) {
  .dashboard { padding: 0.5rem !important; }

  .dashboard-welcome { padding: 0.8rem !important; margin-bottom: 0.35rem !important; }

  .tabs {
    margin: 0.25rem 0 0.4rem !important;
    padding: 4px !important;
    gap: 3px !important;
  }

  .tab {
    padding: 0.46rem 0.52rem !important;
    font-size: 0.78rem !important;
    min-height: 36px !important;
  }

  .tab-icon { width: 22px !important; height: 22px !important; }

  .section-header,
  .admin-section-header,
  .admin-polish-page > .section-header,
  .admin-polish-page .admin-section-header {
    padding: 0.48rem 0.65rem !important;
    margin-bottom: 0.32rem !important;
  }

  .admin-section {
    padding: 0.52rem !important;
    margin-bottom: 0.45rem !important;
  }

  .admin-header-subtitle { font-size: 0.72rem; flex-basis: 100%; }
}

/* ===== Stable dashboard width across tabs ===== */
html {
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

.tabs { margin-bottom: 0.25rem !important; }

@media (max-width: 768px) {
  .tabs { margin-bottom: 0.22rem !important; }
}

@media (max-width: 600px) {
  .modal .edit-grade-compact { display: flex; flex-direction: column; align-items: flex-start; }
}

/* ===== Dashboard compact vertical spacing final pass ===== */
.dashboard {
  padding-top: 0.32rem !important;
  padding-bottom: 0.45rem !important;
}

.dashboard-welcome {
  padding-top: 0.72rem !important;
  padding-bottom: 0.72rem !important;
  margin-bottom: 0.26rem !important;
}

.welcome-eyebrow { margin-bottom: 0.36rem !important; }

.dashboard-welcome p { margin-top: 0.18rem !important; }

.tabs { margin-top: 0.14rem !important; margin-bottom: 0.24rem !important; }

.tab-content.active { padding-top: 0 !important; }

.user-page-hero,
.user-page-notes,
.admin-section,
.admin-polish-page > .section-header,
.admin-polish-page .admin-section-header { margin-top: 0 !important; }

.user-page-hero,
.user-page-notes,
.admin-section { margin-bottom: 0.42rem !important; }

.section-header,
.admin-section-header,
.admin-polish-page > .section-header,
.admin-polish-page .admin-section-header { margin-bottom: 0.25rem !important; }

@media (min-width: 769px) {
  .dashboard { padding-top: 0.28rem !important; padding-bottom: 0.55rem !important; }

  .dashboard-welcome { padding: 0.78rem 1.15rem !important; }

  .tabs { margin-bottom: 0.22rem !important; }
}

@media (max-width: 768px) {
  .dashboard { padding: 0.32rem 0.5rem 0.42rem !important; }

  .dashboard-welcome { padding: 0.62rem 0.75rem !important; margin-bottom: 0.2rem !important; }

  .welcome-eyebrow { margin-bottom: 0.28rem !important; }

  .dashboard-welcome h2 { line-height: 1.25 !important; }

  .dashboard-welcome p { margin-top: 0.12rem !important; }

  .tabs { margin: 0.12rem 0 0.2rem !important; padding: 3px !important; }

  .tab { min-height: 34px !important; padding-top: 0.4rem !important; padding-bottom: 0.4rem !important; }

  .user-page-hero,
  .user-page-notes,
  .admin-section { margin-bottom: 0.32rem !important; }

  .section-header,
  .admin-section-header,
  .admin-polish-page > .section-header,
  .admin-polish-page .admin-section-header { margin-bottom: 0.22rem !important; }
}

/* ===== Dashboard navbar compact override ===== */
.navbar {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

.navbar-row { min-height: 32px !important; }

.navbar .nav-links {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  line-height: 1.35 !important;
}

.navbar .nav-links a,
.navbar .nav-links .btn-logout {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

@media (max-width: 768px) {
  .navbar { padding-left: 0.65rem !important; padding-right: 0.65rem !important; }

  .navbar-row { min-height: 31px !important; }

  .navbar .nav-links { padding-bottom: 2px !important; }
}

/* ===== User dashboard bottom space for the floating consultation button ===== */
body:not([data-role="admin"]) #tab-course-intro,
body:not([data-role="admin"]) #tab-my-materials,
body:not([data-role="admin"]) #tab-my-registrations,
body:not([data-role="admin"]) #tab-messages,
body:not([data-role="admin"]) #tab-announcements { padding-bottom: calc(5rem + env(safe-area-inset-bottom, 0px)) !important; }

/* ===== Polished floating chat button ===== */
.chat-btn {
  right: 22px !important;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px)) !important;
  min-height: 44px !important;
  padding: 0.42rem 0.9rem 0.42rem 0.48rem !important;
  border-radius: 999px !important;
  border: 1px solid rgba(255,255,255,0.55) !important;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.2), rgba(255,255,255,0.06)) padding-box,
    linear-gradient(135deg, #22c55e 0%, #06b6d4 42%, #4f46e5 100%) border-box !important;
  color: #fff !important;
  font-size: 0.82rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.01em !important;
  line-height: 1 !important;
  gap: 0.42rem !important;
  box-shadow: 0 12px 30px rgba(37,99,235,0.24), 0 5px 14px rgba(15,23,42,0.14) !important;
  backdrop-filter: blur(14px) !important;
  -webkit-backdrop-filter: blur(14px) !important;
  isolation: isolate;
  overflow: visible !important;
}

.chat-btn::before {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: inherit;
  background: linear-gradient(135deg, #10b981 0%, #06b6d4 46%, #4f46e5 100%);
  z-index: -1;
}

.chat-btn::after {
  content: '';
  position: absolute;
  right: 7px;
  top: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 3px rgba(52,211,153,0.22);
}

.chat-btn:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 16px 34px rgba(37,99,235,0.3), 0 8px 18px rgba(15,23,42,0.18) !important;
}

.chat-btn:active { transform: translateY(0) scale(0.97) !important; }

.chat-btn .chat-icon {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 32px !important;
  height: 32px !important;
  border-radius: 50% !important;
  background: rgba(255,255,255,0.22) !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.24) !important;
  font-size: 1rem !important;
  line-height: 1 !important;
  flex: 0 0 auto !important;
}

.chat-btn #chat-badge {
  position: absolute !important;
  top: -6px !important;
  right: -6px !important;
  min-width: 18px !important;
  height: 18px !important;
  padding: 0 5px !important;
  border-radius: 999px !important;
  border: 2px solid #fff !important;
  background: #ef4444 !important;
  color: #fff !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  font-size: 0.64rem !important;
  font-weight: 800 !important;
  margin-left: 0 !important;
  box-shadow: 0 6px 14px rgba(239,68,68,0.28) !important;
}

.chat-btn #chat-badge[style*="display:none"],
.chat-btn #chat-badge[style*="display: none"] { display: none !important; }

@media (max-width: 480px) {
  .chat-btn {
    right: 12px !important;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px)) !important;
    min-height: 40px !important;
    padding: 0.34rem 0.74rem 0.34rem 0.4rem !important;
    font-size: 0.74rem !important;
    gap: 0.34rem !important;
  }

  .chat-btn .chat-icon {
    width: 28px !important;
    height: 28px !important;
    font-size: 0.92rem !important;
  }

  .chat-btn::after {
    right: 6px;
    top: 6px;
    width: 6px;
    height: 6px;
  }
}

/* ===== Floating chat button calmer palette ===== */
.chat-btn {
  border: 1px solid #dbeafe !important;
  background: rgba(255,255,255,0.96) !important;
  color: #1d4ed8 !important;
  box-shadow: 0 10px 24px rgba(15,23,42,0.12), 0 3px 10px rgba(37,99,235,0.12) !important;
}

.chat-btn::before {
  inset: auto !important;
  width: 0 !important;
  height: 0 !important;
  background: transparent !important;
}

.chat-btn::after {
  background: #60a5fa !important;
  box-shadow: 0 0 0 3px rgba(96,165,250,0.18) !important;
}

.chat-btn:hover {
  background: #f8fbff !important;
  border-color: #bfdbfe !important;
  box-shadow: 0 12px 26px rgba(15,23,42,0.14), 0 5px 12px rgba(37,99,235,0.14) !important;
}

.chat-btn .chat-icon {
  background: #eff6ff !important;
  color: #2563eb !important;
  box-shadow: inset 0 0 0 1px #dbeafe !important;
}

@media (max-width: 480px) {
  .chat-btn { box-shadow: 0 8px 20px rgba(15,23,42,0.12), 0 3px 9px rgba(37,99,235,0.1) !important; }
}

/* ===== Floating chat button balanced blue palette ===== */
.chat-btn {
  border: 1px solid rgba(191,219,254,0.95) !important;
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%) !important;
  color: #fff !important;
  box-shadow: 0 12px 26px rgba(37,99,235,0.26), 0 4px 12px rgba(15,23,42,0.14) !important;
}

.chat-btn::before {
  inset: auto !important;
  width: 0 !important;
  height: 0 !important;
  background: transparent !important;
}

.chat-btn::after {
  background: #34d399 !important;
  box-shadow: 0 0 0 3px rgba(52,211,153,0.2) !important;
}

.chat-btn:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #4338ca 100%) !important;
  border-color: rgba(147,197,253,0.95) !important;
  box-shadow: 0 15px 30px rgba(37,99,235,0.32), 0 6px 15px rgba(15,23,42,0.16) !important;
}

.chat-btn .chat-icon {
  background: rgba(255,255,255,0.2) !important;
  color: #fff !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.24) !important;
}

@media (max-width: 480px) {
  .chat-btn { box-shadow: 0 10px 22px rgba(37,99,235,0.24), 0 3px 10px rgba(15,23,42,0.13) !important; }
}

.subject-selection-hint {
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 .55rem;
  padding: .55rem .7rem;
  border: 1px solid #fde68a;
  border-radius: 9px;
  background: #fffbeb;
  color: #a16207;
  font-size: .78rem;
  line-height: 1.5;
}

/* ===== Welcome banner: slightly more breathing room ===== */
.dashboard-welcome {
  padding-top: .92rem !important;
  padding-bottom: .92rem !important;
}

@media (min-width: 769px) {
  .dashboard-welcome {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
  }
}

@media (max-width: 768px) {
  .dashboard-welcome {
    padding-top: .76rem !important;
    padding-bottom: .76rem !important;
  }
}

/* ===== Floating consultation button: more compact on desktop ===== */
/* 有未读角标时隐藏右下角装饰圆点，避免小尺寸下两者重叠 */
.chat-btn:has(#chat-badge:not([style*="display:none"]):not([style*="display: none"]))::after { display: none; }

@media (min-width: 769px) {
  .chat-btn {
    min-height: 34px !important;
    padding: 0.25rem 0.7rem 0.25rem 0.3rem !important;
    gap: 0.32rem !important;
    font-size: 0.72rem !important;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.22), 0 2px 8px rgba(15, 23, 42, 0.12) !important;
  }

  .chat-btn .chat-icon {
    width: 22px !important;
    height: 22px !important;
    font-size: 0.82rem !important;
  }

  .chat-btn::after {
    right: 5px;
    top: 5px;
    width: 5px;
    height: 5px;
  }

  .chat-btn #chat-badge {
    top: -4px !important;
    right: -4px !important;
    min-width: 16px !important;
    height: 16px !important;
    font-size: 0.56rem !important;
  }
}
