/* ===== 全局重置 & 基础样式 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: #f0f2f5;
  color: #333;
  font-size: 14px;
  line-height: 1.6;
}
a { text-decoration: none; color: inherit; }
a:hover { text-decoration: none; }

/* ===== 导航栏 ===== */
.navbar {
  background: #fff;
  border-bottom: 1px solid #e8eaed;
  display: flex;
  align-items: center;
  padding: 0 28px;
  height: 60px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.nav-brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
}
.nav-brand a {
  font-size: 17px;
  font-weight: 700;
  color: #1a1a2e;
  letter-spacing: -.3px;
}
.nav-links {
  margin-left: 40px;
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}
.nav-links a {
  padding: 7px 16px;
  border-radius: 8px;
  color: #5f6368;
  font-size: 13.5px;
  font-weight: 500;
  transition: all .18s ease;
  position: relative;
}
.nav-links a:hover {
  background: #f1f3f4;
  color: #202124;
  text-decoration: none;
}
.nav-links a.active {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(99,102,241,.35);
}
.nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.nav-logout {
  color: #9aa0a6 !important;
  font-size: 13px !important;
  padding: 6px 14px !important;
  border: 1px solid #dadce0;
  border-radius: 8px !important;
  transition: all .18s;
}
.nav-logout:hover {
  color: #ea4335 !important;
  border-color: #ea4335;
  background: #fef7f6;
}

/* ===== 主容器 ===== */
.container { max-width: 1100px; margin: 24px auto; padding: 0 24px; }

/* ===== 统计卡片 ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px 22px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform .15s, box-shadow .15s;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
}
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-icon.sms { background: #ede9fe; color: #7c3aed; }
.stat-icon.device { background: #dbeafe; color: #2563eb; }
.stat-icon.webhook { background: #d1fae5; color: #059669; }
.stat-icon.auth { background: #fef3c7; color: #d97706; }
.stat-info h4 { font-size: 12px; color: #9ca3af; font-weight: 500; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .5px; }
.stat-info .stat-num { font-size: 26px; font-weight: 700; color: #111827; line-height: 1.2; }

/* ===== 页面标题区域 ===== */
.page-section {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  overflow: hidden;
}
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 0;
}
.page-header h3 { font-size: 17px; font-weight: 600; color: #111827; }
.total-info { font-size: 13px; color: #6b7280; background: #f3f4f6; padding: 4px 12px; border-radius: 20px; }
.total-info strong { color: #6366f1; font-weight: 700; }

/* ===== 消息提示 ===== */
.msg { padding: 11px 18px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.msg::before { content: ''; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.msg-info { background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0; }
.msg-info::before { background: #10b981; }
.msg-error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.msg-error::before { background: #ef4444; }

/* ===== 搜索栏 ===== */
.search-area { padding: 16px 24px; border-bottom: 1px solid #f0f0f0; }
.search-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search-bar input, .search-bar select {
  padding: 9px 14px;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  min-width: 160px;
  transition: all .18s;
  background: #fafafa;
}
.search-bar input:focus, .search-bar select:focus {
  border-color: #6366f1;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(99,102,241,.1);
}
.search-bar button {
  padding: 9px 22px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all .18s;
}
.search-bar button:hover { opacity: .9; transform: translateY(-1px); box-shadow: 0 2px 8px rgba(99,102,241,.35); }
.search-bar a.btn-link { color: #6366f1; font-size: 13px; font-weight: 500; padding: 9px 12px; }
.search-bar a.btn-link:hover { text-decoration: underline; }

/* ===== 工具栏 ===== */
.toolbar { 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  padding: 12px 24px; 
  border-bottom: 1px solid #f0f0f0; 
}
.toolbar-left { 
  display: flex; 
  gap: 8px; 
  align-items: center; 
}
.toolbar-right { 
  display: flex; 
  gap: 8px; 
  align-items: center; 
}

/* ===== 按钮 ===== */
.btn {
  display: inline-block;
  padding: 8px 18px;
  border-radius: 8px;
  border: 1.5px solid #e5e7eb;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  color: #374151;
  font-weight: 500;
  transition: all .18s;
}
.btn:hover { background: #f9fafb; border-color: #d1d5db; text-decoration: none; }
.btn-primary {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border-color: transparent;
}
.btn-primary:hover { opacity: .88; transform: translateY(-1px); }
.btn-small { padding: 5px 13px; font-size: 12px; border-radius: 6px; }
.btn-danger { color: #dc2626; border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; border-color: #fca5a5; }
.btn-warn { color: #d97706; border-color: #fde68a; }
.btn-warn:hover { background: #fffbeb; border-color: #fcd34d; }
.btn-link {
  display: inline-flex;
  align-items: center;
  color: #6366f1;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
  font-weight: 500;
  line-height: inherit;
}
.btn-link:hover { text-decoration: underline; color: #4f46e5; }
.btn-link.btn-del { color: #dc2626; }
.btn-link.btn-del:hover { color: #b91c1c; }
.btn-link.btn-primary { font-weight: 600; }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  background: #f9fafb;
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: .3px;
  white-space: nowrap;
  border-bottom: 1.5px solid #e5e7eb;
}
.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
  color: #374151;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover { background: #fafafa; }
.data-table tr.unread { background: #f5f3ff; }
.data-table tr.unread:hover { background: #ede9fe; }
.data-table tr.row-fail { background: #fef2f2; }
.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: #9ca3af;
}
.empty-state-icon {
  font-size: 52px;
  margin-bottom: 14px;
  opacity: .45;
}
.empty-state p {
  font-size: 15px;
  color: #6b7280;
  margin-bottom: 4px;
}
.empty-state small {
  font-size: 13px;
  color: #9ca3af;
}

.content-cell { white-space: pre-wrap; word-break: break-all; line-height: 1.5; }
.url-cell { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: #6b7280; }
.key-cell code { background: #f3f4f6; padding: 3px 8px; border-radius: 6px; font-size: 11.5px; color: #4b5563; font-weight: 500; }
.time-cell { white-space: nowrap; font-size: 12.5px; color: #6b7280; }
.error-cell { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: #dc2626; }
.btn-copy {
  font-size: 11px; color: #6366f1; background: #f3f4f6; border: 1px solid #e5e7eb;
  border-radius: 5px; padding: 2px 8px; cursor: pointer; margin-left: 6px; transition: all .15s;
}
.btn-copy:hover { background: #eef2ff; border-color: #c7d2fe; }

/* ===== 徽标 ===== */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 600; }
.badge-on { background: #ecfdf5; color: #059669; }
.badge-off { background: #fef2f2; color: #dc2626; }
.badge-read { background: #f3f4f6; color: #6b7280; }
.badge-unread { background: #eef2ff; color: #4f46e5; }
.badge-success { background: #ecfdf5; color: #059669; }
.badge-fail { background: #fef2f2; color: #dc2626; }

/* ===== 表单卡片 ===== */
.form-card {
  background: #fff; padding: 32px; border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06); max-width: 650px; margin: 0 auto;
}
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 7px; color: #374151; }
.required { color: #ef4444; }
.form-group input[type="text"], .form-group input[type="password"], .form-group input[type="number"],
.form-group textarea, .form-group select {
  width: 100%; padding: 10px 14px; border: 1.5px solid #e5e7eb; border-radius: 8px;
  font-size: 13.5px; outline: none; transition: all .18s; font-family: inherit; background: #fafafa;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  border-color: #6366f1; background: #fff; box-shadow: 0 0 0 3px rgba(99,102,241,.1);
}
.form-group input:disabled { background: #f3f4f6; color: #9ca3af; }
.form-group small { display: block; margin-top: 5px; font-size: 12px; color: #9ca3af; }
.hint { font-size: 13px; color: #4b5563; padding: 10px 14px; background: #eff6ff; border-radius: 8px; border-left: 3px solid #6366f1; }
.form-inline label { display: inline-flex; align-items: center; gap: 6px; font-weight: normal; cursor: pointer; font-size: 13px; }
.form-section-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 1.5px solid #e5e7eb; color: #111827; }
.form-actions { margin-top: 26px; padding-top: 18px; border-top: 1.5px solid #e5e7eb; display: flex; gap: 10px; }
.checkbox-label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #4b5563; cursor: pointer; font-weight: 500; }
.unread-count { font-size: 12.5px; color: #6366f1; font-weight: 600; margin-left: auto; background: #eef2ff; padding: 3px 10px; border-radius: 12px; }

/* ===== 分页 ===== */
.pagination { display: flex; justify-content: center; align-items: center; gap: 20px; margin-top: 20px; padding: 18px 0; }
.pg-btn {
  display: inline-block; padding: 8px 20px; border: 1.5px solid #e5e7eb; border-radius: 8px;
  font-size: 13px; color: #6366f1; font-weight: 500; transition: all .18s;
}
.pg-btn:hover { background: #6366f1; color: #fff; border-color: #6366f1; text-decoration: none; }
.pg-info { font-size: 13px; color: #6b7280; font-weight: 500; }

/* ===== 登录页 ===== */
.login-page {
  display: flex; justify-content: center; align-items: center; min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-box {
  background: #fff; padding: 44px 38px; border-radius: 16px;
  box-shadow: 0 25px 80px rgba(0,0,0,.3); width: 380px; text-align: center;
}
.login-box h2 { font-size: 23px; color: #111827; margin-bottom: 4px; font-weight: 700; }
.login-subtitle { font-size: 13px; color: #9ca3af; margin-bottom: 28px; }
.login-box form { text-align: left; }
.login-box input[type="password"] {
  width: 100%; padding: 13px 16px; border: 2px solid #e5e7eb; border-radius: 10px;
  font-size: 15px; outline: none; margin-bottom: 18px; transition: all .2s; background: #fafafa;
}
.login-box input[type="password"]:focus { border-color: #667eea; box-shadow: 0 0 0 4px rgba(102,126,234,.12); background: #fff; }
.login-box button[type="submit"] {
  width: 100%; padding: 13px; background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff; border: none; border-radius: 10px; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: all .2s; letter-spacing: .5px;
}
.login-box button[type="submit"]:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(102,126,234,.4); }
.login-box button[type="submit"]:disabled { opacity: .55; cursor: not-allowed; }

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .container { padding: 0 14px; margin-top: 16px; }
  .navbar { padding: 0 14px; height: 56px; }
  .nav-brand-icon { display: none; }
  .nav-brand a { font-size: 15px; }
  .nav-links { margin-left: 16px; gap: 2px; }
  .nav-links a { padding: 6px 10px; font-size: 12.5px; }
  .search-bar { flex-direction: column; }
  .search-bar input { min-width: 100%; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stat-card { padding: 16px; }
  .stat-info .stat-num { font-size: 22px; }
  .page-header { padding: 16px 16px 0; }
  .search-area { padding: 12px 16px; }
  .toolbar { padding: 10px 16px; }
  .data-table th, .data-table td { padding: 10px 12px; font-size: 12px; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}
