/* ===== 德心守护 · 全局样式 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: #f5f7fa;
  color: #2e3b4e;
  min-height: 100vh;
}

a { text-decoration: none; color: #2b579a; }

/* 登录页 */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #f0f4fa 0%, #f8f6f2 100%);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: #fffdfa;
  border-radius: 20px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
  padding: 40px 36px 32px;
  border: 1px solid rgba(180, 160, 130, 0.15);
}

.login-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: #2b579a;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  color: #fff;
  box-shadow: 0 6px 16px rgba(43, 87, 154, 0.25);
}

.login-card h1 {
  font-size: 24px;
  text-align: center;
  letter-spacing: 4px;
  color: #2b579a;
  font-weight: 700;
}

.login-card .subtitle {
  text-align: center;
  font-size: 14px;
  color: #7f8c8d;
  margin-top: 6px;
  letter-spacing: 1px;
}

.login-badge {
  display: table;
  margin: 14px auto 24px;
  background: #f0f4fa;
  padding: 6px 20px;
  border-radius: 20px;
  font-size: 13px;
  color: #4a627a;
  border: 1px solid #dce3ed;
}

.login-card .form-group {
  margin-bottom: 20px;
}

.login-card label {
  display: block;
  font-size: 14px;
  margin-bottom: 6px;
  color: #4a5c6c;
 font-weight: 500;
}

.login-card input {
  width: 100%;
 padding: 12px 16px;
  border: 1px solid #dce3eb;
  border-radius: 12px;
  font-size: 15px;
  background: #fff;
}

.login-card input:focus {
  outline: none;
  border-color: #2b579a;
  box-shadow: 0 0 0 3px rgba(43, 87, 154, 0.1);
}

.login-card .btn {
  width: 100%;
  padding: 13px;
 border: none;
  border-radius: 40px;
  background: #2b579a;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  margin-top: 6px;
  font-weight: 500;
  letter-spacing: 2px;
}

.login-card .btn:hover {
 background: #1e4b7a;
}

.login-card .message {
  display: none;
  background: #fdecec;
  color: #b14a4a;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 16px;
  text-align: center;
}

.login-card .message.success {
 background: #d5f0e0;
  color: #1e8449;
}

.login-footer {
 display: flex;
  justify-content: space-between;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #f0e8dc;
  font-size: 13px;
}

.login-hint {
  text-align: center;
  font-size: 12px;
  color: #aaa29a;
 margin-top: 18px;
  line-height: 1.6;
}

/* 主布局 */
.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  background: #fff;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 20px;
  border-bottom: 1px solid #f0ece6;
  margin-bottom: 20px;
}

.sidebar .brand-icon {
  width: 42px;
  height: 42px;
  background: #2b579a;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
}

.sidebar .brand span {
  font-size: 17px;
  font-weight: 600;
  color: #2b579a;
  letter-spacing: 2px;
}

.sidebar nav {
  flex: 1;
}

.sidebar nav a {
  display: flex;
 align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 15px;
  margin-bottom: 4px;
  color: #4a5c6c;
  transition: background 0.2s, color 0.2s;
}

.sidebar nav a .icon {
  font-size: 18px;
  width: 22px;
  text-align: center;
}

.sidebar nav a:hover {
  background: #f0f4fa;
  color: #2b579a;
}

.sidebar nav a.active {
  background: #2b579a;
 color: #fff;
}

.sidebar nav a.active:hover {
  background: #2b579a;
}

.sidebar .user-info {
  border-top: 1px solid #f0ece6;
  padding-top: 16px;
}

.sidebar .user-info .name {
  font-weight: 500;
  font-size: 14px;
}

.sidebar .user-info .role {
  font-size: 12px;
  color: #8e9baa;
  margin-top: 2px;
}

.main {
  flex: 1;
  padding: 28px 32px;
  min-width: 0;
}

.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.main-header h2 {
  font-size: 22px;
  font-weight: 600;
}

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

/* 卡片 */
.card {
  background: #fff;
  border-radius: 16px;
  padding: 22px 24px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
  margin-bottom: 20px;
  border: 1px solid #f0ece6;
}

.card-title {
 font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 按钮 */
.btn {
 padding: 9px 20px;
  border-radius: 30px;
  font-size: 14px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.btn-primary {
  background: #2b579a;
 color: #fff;
}

.btn-primary:hover {
  background: #1e4b7a;
}

.btn-outline {
  background: transparent;
  border: 1px solid #2b579a;
  color: #2b579a;
}

.btn-outline:hover {
  background: #f0f4fa;
}

.btn-danger {
  background: #b14a4a;
  color: #fff;
}

.btn-sm {
 padding: 5px 14px;
  font-size: 13px;
}

/* 表格 */
.table-wrapper {
  overflow-x: auto;
}

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

.table th,
.table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid #f0ece6;
  font-size: 14px;
}

.table th {
  font-weight: 600;
  color: #4a5c6c;
  background: #faf8f5;
  white-space: nowrap;
}

.table tr:hover {
  background: #fcfbf9;
}

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

.badge-green {
  background: #d5f0e0;
  color: #1e8449;
}

.badge-red {
  background: #fdecec;
  color: #b14a4a;
}

.badge-orange {
  background: #fdf3d6;
  color: #b7791f;
}

.badge-blue {
  background: #e3edf7;
  color: #2b579a;
}

/* 统计卡片 */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
 background: #fff;
  border-radius: 16px;
  padding: 20px;
  border: 1px solid #f0ece6;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.stat-card .stat-label {
  font-size: 13px;
  color: #7f8c8d;
}

.stat-card .stat-value {
  font-size: 32px;
  font-weight: 700;
  margin-top: 6px;
}

.stat-card .stat-value.small {
  font-size: 24px;
}

/* 情绪标签 */
.emotion-tags {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.emotion-tag {
  padding: 10px 18px;
  border-radius: 30px;
  font-size: 14px;
  cursor: pointer;
  border: 2px solid #e5e0d8;
  transition: all 0.2s;
  background: #fff;
  user-select: none;
}

.emotion-tag.active {
  border-color: #2b579a;
  background: #f0f4fa;
  color: #2b579a;
  font-weight: 500;
}

.chip {
  display: inline-block;
  padding: 3px 12px;
  background: #f0f4fa;
  border-radius: 20px;
  font-size: 13px;
  margin: 2px;
  color: #4a627a;
}

/* 筛选栏 */
.filter-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
 align-items: center;
  margin-bottom: 16px;
}

.filter-bar select,
.filter-bar input {
  padding: 8px 14px;
  border: 1px solid #dce3eb;
  border-radius: 8px;
 font-size: 14px;
  background: #fff;
}

/* 响应式 */
@media (max-width: 768px) {
  .layout {
    flex-direction: column;
  }

 .sidebar {
    width: 100%;
    height: auto;
    position: static;
    padding: 12px;
    flex-direction: row;
    align-items: center;
  }

  .sidebar nav {
    display: flex;
    overflow-x: auto;
    gap: 4px;
  }

 .sidebar nav a {
    white-space: nowrap;
  }

  .sidebar .brand {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
  }

  .sidebar .brand span,
  .sidebar .user-info {
    display: none;
  }

  .main {
    padding: 20px 16px;
  }
}
/* 标签选中状态 */
.chip.active {
  background: #2b579a;
  color: #fff;
  border-radius: 20px;
}
/* ===== 标签多选（纯CSS方案） ===== */
.chip {
  position: relative;
  cursor: pointer;
  display: inline-block;
  padding: 8px 16px;
  background: #f0f4fa;
 border-radius: 20px;
  font-size: 14px;
  color: #4a627a;
  border: 2px solid transparent;
  transition: all 0.2s;
  user-select: none;
}
.chip input {
  display: none;
}
.chip input:checked + span {
  background: #2b579a;
  color: #fff;
  border-radius: 20px;
  padding: 4px 12px;
}
.chip span {
  display: inline-block;
  padding: 2px 6px;
}
/* ========================================
   手机适配（屏幕宽度 ≤ 768px 时生效）
   ======================================== */
@media (max-width: 768px) {

  /* ---------- 整体布局：侧边栏变顶部栏 ---------- */
  .layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    border-right: none;
    border-bottom: 1px solid #dce3eb;
    padding: 8px 12px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  }

  .brand {
    margin-bottom: 0;
 }

  .brand-icon {
    font-size: 20px;
  }

  .brand span {
    font-size: 16px;
    display: inline-block;
    margin-left: 4px;
  }

  /* 侧边栏导航：横向可滚动 */
  .sidebar nav {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    margin-top: 8px;
    padding-bottom: 4px;
    order: 3;
    width: 100%;
    gap: 4px;
  }

  .sidebar nav a {
    display: inline-block;
    padding: 6px 10px;
    font-size: 13px;
    border-radius: 20px;
    margin: 0;
    background: #f0f4fa;
    color: #2b579a;
    white-space: nowrap;
  }

  .sidebar nav a.active {
    background: #2b579a;
    color: #fff;
  }

  .sidebar nav a .icon {
    display: none;
  }

  /* 用户信息：移到右上角 */
  .sidebar .user-info {
    margin-top: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    order: 2;
  }

  .sidebar .user-info .name {
    font-size: 13px;
    font-weight: 600;
  }

  .sidebar .user-info .role {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    background: #e8f0fe;
    color: #2b579a;
  }

  /* ---------- 主内容区 ---------- */
  .main {
    margin-top: 110px;
    padding: 12px;
  }

  .main-header {
    padding: 12px 0;
    flex-wrap: wrap;
    gap: 8px;
  }

  .main-header h2 {
    font-size: 20px;
  }

  .main-header .actions {
    width: 100%;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
  }

  .main-header .actions .header-user {
    font-size: 13px;
  }

  /* ---------- 卡片 ---------- */
  .card {
    padding: 12px;
    margin-bottom: 12px;
    border-radius: 12px;
  }

  .card-title {
    font-size: 15px;
    margin-bottom: 10px;
  }

  /* ---------- 统计卡片：2列 ---------- */
  .stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
  }

  .stat-card {
    padding: 16px 10px;
    text-align: center;
  }

  .stat-label {
    font-size: 12px;
  }

  .stat-value {
    font-size: 24px;
  }

  .stat-value.small {
    font-size: 18px;
  }

  /* ---------- 表格：横向滚动 ---------- */
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -12px;
    padding: 0 12px;
  }

  table {
    width: 100%;
    min-width: 480px; /* 表格至少这么宽，可横向滑动 */
    font-size: 13px;
  }

  th, td {
    padding: 10px 8px;
    white-space: nowrap;
  }

  /* ---------- 筛选栏 ---------- */
  .filter-bar {
    flex-wrap: wrap;
    gap: 8px;
  }

  .filter-bar select,
  .filter-bar input,
  .filter-bar button {
    flex: 1 1 45%;
    min-width: 0;
    margin: 0;
  }

  .filter-bar button {
    flex: 1 1 100%;
  }

  /* ---------- 表单 ---------- */
  .form-row {
    flex-direction: column;
    gap: 10px;
  }

  .form-group {
    width: 100%;
    flex: none;
  }

  .form-group input[type="text"],
  .form-group select {
    font-size: 16px; /* 防止iOS聚焦时自动放大 */
  }

  /* ---------- 按钮 ---------- */
  .btn {
    font-size: 15px;
    padding: 10px 16px;
  }

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

  /* ---------- 弹窗 ---------- */
  .modal-box {
    max-width: 95%;
    border-radius: 12px;
  }

  .modal-body {
    padding: 16px;
    font-size: 14px;
  }

  /* ---------- 标签 ---------- */
  .chip {
    display: inline-block;
    padding: 6px 10px;
    margin: 4px 4px 4px 0;
    background: #f0f4fa;
    border-radius: 8px;
    font-size: 13px;
  }

  .chip input {
    margin-right: 4px;
  }

  /* ---------- 登录页 ---------- */
  .login-card {
    margin: 20px 16px;
    padding: 24px 20px;
    border-radius: 16px;
  }

  .login-card h1 {
    font-size: 22px;
  }

  .login-footer {
    flex-direction: column;
    gap: 8px;
  }

  .login-hint {
    font-size: 12px;
  }

  /* ---------- 头像/角标 ---------- */
  .badge {
    font-size: 12px;
    padding: 3px 8px;
  }
}

/* 超小屏幕（≤480px）微调 */
@media (max-width: 480px) {
  .sidebar .brand span {
    display: none;
  }

  .sidebar nav a {
    font-size: 12px;
    padding: 5px 8px;
  }

  .main {
    margin-top: 100px;
  }

  .stat-value {
    font-size: 20px;
  }

  .stat-card {
    padding: 12px 8px;
  }
}
/* 去除手机端点击链接/按钮时的蓝色半透明框 */
a, button, input, select, textarea, label {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

a:focus, button:focus, input:focus, select:focus {
  outline: none !important;
}
