/* ===== 企业微信客户管理系统 · 公共样式 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  color: #1e293b;
  background: #eef6fc;
}
a { color: inherit; }

/* ===== 后台整体布局 ===== */
.layout { height: 100vh; display: flex; overflow: hidden; }

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #0284c7 0%, #0ea5e9 60%, #38bdf8 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 12px rgba(2, 132, 199, .25);
}
.sidebar .brand {
  padding: 22px 20px 18px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 1px;
  border-bottom: 1px solid rgba(255,255,255,.18);
}
.sidebar .brand .sub {
  display: block; font-size: 11px; font-weight: 400;
  opacity: .75; margin-top: 4px; letter-spacing: 0;
}
.sidebar nav { flex: 1; padding: 14px 12px; overflow-y: auto; }
.sidebar .menu-group {
  font-size: 11px; opacity: .7; padding: 10px 10px 6px; letter-spacing: 1px;
}
.sidebar a.menu-item {
  display: flex; align-items: center; gap: 10px;
  color: rgba(255,255,255,.92); text-decoration: none;
  font-size: 14px; padding: 11px 12px; margin-bottom: 4px;
  border-radius: 8px; transition: background .15s; cursor: pointer;
}
.sidebar a.menu-item:hover { background: rgba(255,255,255,.15); }
.sidebar a.menu-item.active {
  background: #fff; color: #0284c7; font-weight: 600;
  box-shadow: 0 2px 8px rgba(2,132,199,.25);
}
.sidebar a.menu-item .ico { font-size: 16px; width: 20px; text-align: center; }
.sidebar .sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,.18);
  display: flex; justify-content: space-between; align-items: center; font-size: 13px;
}
.sidebar .sidebar-footer a {
  color: #fff; text-decoration: none;
  background: rgba(255,255,255,.2);
  padding: 5px 12px; border-radius: 6px; font-size: 12px;
}
.sidebar .sidebar-footer a:hover { background: rgba(255,255,255,.32); }

.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; padding: 24px 28px; }
.page-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px; flex-shrink: 0; gap: 12px;
}
.page-header h1 { font-size: 20px; font-weight: 700; }
.page-header .actions { display: flex; gap: 10px; align-items: center; }
.scroll-area { flex: 1; overflow-y: auto; min-height: 0; }

/* ===== 卡片 ===== */
.card {
  background: #fff; border-radius: 10px;
  box-shadow: 0 1px 4px rgba(15, 118, 165, .10);
  padding: 20px 22px; margin-bottom: 18px;
}
.card h2 { font-size: 15px; margin-bottom: 16px; color: #0c4a6e; font-weight: 600; }
.card h3 { font-size: 14px; margin-bottom: 12px; color: #0c4a6e; }

/* ===== 表单 ===== */
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 13px; color: #64748b; margin-bottom: 6px; }
.form-row input[type="text"], .form-row input[type="password"], .form-row input[type="number"],
.form-row select {
  width: 100%; padding: 9px 12px; border: 1px solid #cbd5e1;
  border-radius: 8px; font-size: 14px; outline: none; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.form-row input:focus, .form-row select:focus {
  border-color: #0ea5e9; box-shadow: 0 0 0 3px rgba(14, 165, 233, .15);
}
.form-inline { display: flex; gap: 8px; align-items: center; }
.form-inline input[type="number"] { width: 90px; padding: 6px 10px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 14px; color: #334155; }
.checkbox-row input { width: 16px; height: 16px; }

/* ===== 搜索框 ===== */
.search-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.search-form input[type="text"], .search-form select {
  padding: 8px 12px; border: 1px solid #cbd5e1; border-radius: 8px;
  font-size: 14px; outline: none; height: 38px; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.search-form input[type="text"]:focus, .search-form select:focus {
  border-color: #0ea5e9; box-shadow: 0 0 0 3px rgba(14, 165, 233, .15);
}
.search-form .btn { height: 38px; display: inline-flex; align-items: center; justify-content: center; }

/* ===== 按钮 ===== */
.btn {
  display: inline-block; padding: 9px 18px; border: none; border-radius: 8px;
  font-size: 14px; cursor: pointer; text-decoration: none; transition: all .15s;
}
.btn-primary { background: linear-gradient(135deg, #0ea5e9, #38bdf8); color: #fff; box-shadow: 0 2px 8px rgba(14,165,233,.35); }
.btn-primary:hover { box-shadow: 0 4px 14px rgba(14,165,233,.45); }
.btn-default { background: #fff; color: #334155; border: 1px solid #cbd5e1; }
.btn-default:hover { border-color: #0ea5e9; color: #0284c7; }
.btn-danger { background: #fff; color: #b91c1c; border: 1px solid #fecaca; }
.btn-danger:hover { border-color: #ef4444; }
.btn-sm { padding: 5px 12px; font-size: 13px; border-radius: 6px; }
.btn-xs { padding: 3px 10px; font-size: 12px; border-radius: 5px; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* ===== 消息 / 空态 ===== */
.msg { padding: 11px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.msg-success { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.msg-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.muted { color: #94a3b8; font-size: 12px; }
.nowrap { white-space: nowrap; }
.hint { font-size: 12px; color: #94a3b8; margin-top: 6px; }
.empty { color: #94a3b8; text-align: center; padding: 40px 0; }
.empty .ico { font-size: 40px; display: block; margin-bottom: 10px; }

/* ===== 表格 ===== */
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data-table th {
  text-align: left; padding: 10px 12px; background: #f0f9ff; color: #0c4a6e;
  font-weight: 600; border-bottom: 2px solid #bae6fd; white-space: nowrap;
  position: sticky; top: 0; z-index: 5;
}
table.data-table td { padding: 11px 12px; border-bottom: 1px solid #f0f7fb; vertical-align: middle; }
table.data-table tr:hover td { background: #f8fdff; }
table.data-table td.mono { font-family: Consolas, Monaco, monospace; font-size: 12px; color: #64748b; word-break: break-all; }
.mono { font-family: Consolas, Monaco, monospace; }

.info-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.info-table td { padding: 9px 12px; border-bottom: 1px solid #f0f7fb; }
.info-table td:first-child { width: 150px; color: #64748b; font-weight: 500; background: #f8fdff; }

.token-box {
  font-family: Consolas, Monaco, monospace; font-size: 12px;
  background: #f0f9ff; border: 1px solid #bae6fd;
  border-radius: 6px; padding: 8px 10px; word-break: break-all; margin-top: 6px;
}
.status-ok { color: #15803d; font-weight: 600; }
.status-fail { color: #b91c1c; font-weight: 600; }

/* ===== 标签 ===== */
.tag { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.tag-blue { background: #e0f2fe; color: #0369a1; }
.tag-green { background: #dcfce7; color: #15803d; }
.tag-gray { background: #f1f5f9; color: #64748b; }
.tag-orange { background: #ffedd5; color: #c2410c; }
.tag-red { background: #fee2e2; color: #b91c1c; }
.tag-wrap { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.tag-wrap .tag { font-size: 11px; padding: 2px 8px; }

/* ===== 模态框 ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal {
  background: #fff; border-radius: 14px; box-shadow: 0 20px 50px rgba(2, 132, 199, .35);
  padding: 28px 30px; width: 420px; max-width: 92vw;
}
.modal h2 { font-size: 17px; color: #0c4a6e; margin-bottom: 8px; }
.modal .modal-tip { font-size: 13px; color: #64748b; margin-bottom: 18px; line-height: 1.6; }

/* ===== 右上角提示卡（2 秒自动消失） ===== */
.toast-container {
  position: fixed; top: 22px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  min-width: 250px; max-width: 380px; padding: 13px 16px; border-radius: 12px;
  background: #fff; border: 1px solid #e2e8f0; border-left: 4px solid #0ea5e9;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .14);
  font-size: 13.5px; line-height: 1.6; color: #1e293b;
  pointer-events: auto; animation: toast-in .28s cubic-bezier(.22, .9, .35, 1);
}
.toast.hide { animation: toast-out .3s ease forwards; }
.toast-icon {
  width: 20px; height: 20px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0; margin-top: 1px; background: #0ea5e9;
}
.toast-success { border-left-color: #10b981; }
.toast-success .toast-icon { background: #10b981; }
.toast-error { border-left-color: #ef4444; }
.toast-error .toast-icon { background: #ef4444; }
@keyframes toast-in { from { opacity: 0; transform: translateX(28px) scale(.96); } to { opacity: 1; transform: translateX(0) scale(1); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(28px) scale(.96); } }