/* ============================================
   系统聚合中心 - 样式
   ============================================ */

:root {
  --bg:        #f5f7fb;
  --surface:   #ffffff;
  --border:    #e5e7eb;
  --text:      #111827;
  --text-soft: #6b7280;
  --primary:   #4f46e5;
  --primary-d: #4338ca;
  --danger:    #dc2626;
  --success:   #16a34a;
  --shadow:    0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 导航 ---------- */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.navbar.admin { background: #1f2937; border-bottom-color: #111; }
.navbar.admin .nav-brand,
.navbar.admin .nav-link,
.navbar.admin .nav-user { color: #e5e7eb; }
.navbar.admin .nav-link.active { color: #fff; background: rgba(255,255,255,.1); }

.nav-inner {
  max-width: 1200px; margin: 0 auto;
  padding: 0 20px; height: 56px;
  display: flex; align-items: center; gap: 20px;
}
.nav-brand { font-weight: 600; font-size: 18px; color: var(--text); }
.nav-links { display: flex; gap: 4px; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.nav-link {
  padding: 6px 12px; border-radius: 6px;
  color: var(--text-soft); font-size: 14px;
}
.nav-link:hover { text-decoration: none; background: rgba(79,70,229,.08); }
.nav-link.muted { opacity: .7; }
.nav-user { font-size: 14px; color: var(--text-soft); }

/* ---------- 容器 ---------- */
.container { max-width: 1200px; margin: 28px auto; padding: 0 20px; }

/* ---------- Flash 消息 ---------- */
.alert {
  padding: 12px 16px; border-radius: 8px; margin-bottom: 16px;
  border: 1px solid; font-size: 14px;
}
.alert-success { background: #dcfce7; border-color: #bbf7d0; color: #14532d; }
.alert-error   { background: #fee2e2; border-color: #fecaca; color: #7f1d1d; }
.alert-info    { background: #dbeafe; border-color: #bfdbfe; color: #1e3a8a; }

/* ---------- 聚合首页 - 卡片墙 ---------- */
.hero {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #fff; padding: 40px 28px; border-radius: 16px;
  margin-bottom: 28px; box-shadow: var(--shadow-lg);
}
.hero h1 { margin: 0 0 8px; font-size: 26px; }
.hero p  { margin: 0; opacity: .85; }

.grid-title { font-size: 16px; font-weight: 600; margin: 0 0 14px; color: var(--text); }

.app-grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.app-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 22px 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 8px;
  transition: transform .15s ease, box-shadow .15s ease;
  cursor: pointer;
  text-decoration: none; color: inherit;
  position: relative; overflow: hidden;
}
.app-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: var(--color, var(--primary));
}
.app-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  text-decoration: none; color: inherit;
}
.app-icon {
  font-size: 32px; line-height: 1;
}
.app-name {
  font-size: 17px; font-weight: 600; margin-top: 4px;
}
.app-desc {
  font-size: 13px; color: var(--text-soft);
}
.app-badge {
  position: absolute; top: 12px; right: 12px;
  font-size: 11px; padding: 2px 8px; border-radius: 10px;
  background: #fef3c7; color: #92400e;
}
.app-badge.sso { background: #dcfce7; color: #166534; }

/* ---------- 登录页 ---------- */
.auth-wrap {
  min-height: calc(100vh - 56px);
  display: flex; align-items: center; justify-content: center;
  padding: 40px 20px;
}
.auth-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 36px 32px;
  box-shadow: var(--shadow-lg); width: 100%; max-width: 400px;
}
.auth-card h2 { margin: 0 0 4px; }
.auth-card p.sub { margin: 0 0 24px; color: var(--text-soft); font-size: 14px; }

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 13px; color: var(--text-soft); margin-bottom: 6px;
}
.form-control {
  width: 100%; padding: 10px 12px; font-size: 14px;
  border: 1px solid var(--border); border-radius: 8px;
  background: #fff; color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
.form-row { display: flex; gap: 12px; align-items: flex-end; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 18px; font-size: 14px; font-weight: 500;
  border-radius: 8px; border: 1px solid transparent;
  cursor: pointer; background: #fff; color: var(--text);
  transition: background .15s, border-color .15s, color .15s;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); }
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-ghost   { background: transparent; border-color: var(--border); color: var(--text-soft); }
.btn-ghost:hover { background: #f9fafb; color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }

/* ---------- 管理后台 ---------- */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.page-header h1 { margin: 0; font-size: 22px; }
.page-header .actions { display: flex; gap: 10px; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow);
}
.card-body { padding: 20px; }

.data-table {
  width: 100%; border-collapse: collapse; font-size: 14px;
}
.data-table th, .data-table td {
  text-align: left; padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.data-table thead th {
  background: #f9fafb; font-weight: 600; color: var(--text-soft);
  font-size: 13px;
}
.data-table tbody tr:hover { background: #fafbfc; }

.tag {
  display: inline-block; padding: 2px 10px; border-radius: 10px;
  font-size: 12px; background: #f3f4f6; color: #374151;
}
.tag.green  { background: #dcfce7; color: #166534; }
.tag.red    { background: #fee2e2; color: #991b1b; }
.tag.blue   { background: #dbeafe; color: #1e40af; }

/* 模态框 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: none; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.modal-mask.open { display: flex; }
.modal {
  background: var(--surface); border-radius: 12px;
  width: 100%; max-width: 500px; box-shadow: var(--shadow-lg);
  max-height: 90vh; overflow: auto;
}
.modal-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-header h3 { margin: 0; font-size: 16px; }
.modal-close { cursor: pointer; background: none; border: none; font-size: 22px; color: var(--text-soft); }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); text-align: right; display: flex; gap: 10px; justify-content: flex-end; }

.empty { text-align: center; color: var(--text-soft); padding: 40px 20px; }

/* 仪表盘统计卡片 */
.stats {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 24px;
}
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px; box-shadow: var(--shadow);
}
.stat .num { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat .lbl { font-size: 13px; color: var(--text-soft); margin-top: 4px; }

@media (max-width: 600px) {
  .nav-inner { flex-wrap: wrap; height: auto; padding: 10px 16px; }
  .nav-right { margin-left: 0; }
  .nav-links { order: 3; width: 100%; }
  .app-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .hero { padding: 28px 20px; }
  .hero h1 { font-size: 22px; }
}
