/* ============================================================
   多站点账号统计 - 样式表
   ============================================================ */

:root {
    --bg:          #f4f6fb;
    --card-bg:     #ffffff;
    --text:        #1f2937;
    --text-soft:   #6b7280;
    --text-mute:   #9ca3af;
    --border:      #e5e7eb;
    --primary:     #2563eb;
    --primary-dark:#1d4ed8;
    --green:       #10b981;
    --green-soft:  #ecfdf5;
    --green-bg:    #d1fae5;
    --yellow:      #f59e0b;
    --yellow-soft: #fffbeb;
    --yellow-bg:   #fef3c7;
    --red:         #ef4444;
    --red-soft:    #fef2f2;
    --red-bg:      #fee2e2;
    --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), 0 4px 10px rgba(0,0,0,.04);
    --radius:      14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ============ 顶栏 ============ */
.topbar {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    color: #fff;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon {
    width: 42px; height: 42px;
    background: rgba(255,255,255,.18);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
}
.brand h1 { font-size: 18px; font-weight: 600; }
.brand-sub { font-size: 12px; opacity: .8; }

.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.auto-refresh {
    display: flex; align-items: center; gap: 6px;
    font-size: 13px; cursor: pointer; opacity: .92;
    user-select: none;
}
.auto-refresh input { cursor: pointer; }

/* ============ 按钮 ============ */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    border: none; cursor: pointer;
    font-size: 13px; font-weight: 500;
    padding: 8px 14px;
    border-radius: 8px;
    transition: all .15s ease;
    text-decoration: none;
    font-family: inherit;
}
.btn-primary { background: #fff; color: var(--primary-dark); }
.btn-primary:hover { background: #f0f4ff; }
.btn-ghost {
    background: rgba(255,255,255,.15);
    color: #fff;
}
.btn-ghost:hover { background: rgba(255,255,255,.28); }
.btn-block { width: 100%; justify-content: center; }

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

/* ============ 汇总卡片 ============ */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}
.summary-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px 22px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: transform .15s ease, box-shadow .15s ease;
}
.summary-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.summary-primary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
    border: none;
}
.summary-primary .summary-label,
.summary-primary .summary-foot { color: rgba(255,255,255,.85); }
.summary-label { font-size: 13px; color: var(--text-soft); margin-bottom: 8px; }
.summary-value { font-size: 32px; font-weight: 700; line-height: 1.1; }
.summary-foot { font-size: 12px; color: var(--text-mute); margin-top: 6px; }
.summary-warn { color: var(--yellow); }
.summary-danger { color: var(--red); }

/* ============ 区块标题 ============ */
.section-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap; gap: 8px;
}
.section-head h2 { font-size: 17px; font-weight: 600; }
.updated-at { font-size: 12px; color: var(--text-mute); }

/* ============ 站点卡片网格 ============ */
.sites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.site-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    border-left: 4px solid var(--border);
    transition: transform .15s ease, box-shadow .15s ease;
}
.site-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.site-card.online { border-left-color: var(--green); }
.site-card.offline { border-left-color: var(--red); }

.site-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 10px; margin-bottom: 16px;
}
.site-name {
    font-size: 15px; font-weight: 600;
    word-break: break-all;
}
.site-note { font-size: 12px; color: var(--text-mute); margin-top: 3px; }
.site-db { font-size: 11px; color: var(--text-mute); margin-top: 2px; }

.badge {
    font-size: 11px; font-weight: 600;
    padding: 3px 9px;
    border-radius: 20px;
    white-space: nowrap;
}
.badge-online { background: var(--green-bg); color: #047857; }
.badge-offline { background: var(--red-bg); color: #b91c1c; }

/* 核心指标：正常账号数量 */
.site-active {
    background: var(--green-soft);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    margin-bottom: 14px;
}
.site-active .num { font-size: 36px; font-weight: 700; color: var(--green); line-height: 1; }
.site-active .lbl { font-size: 12px; color: #047857; margin-top: 6px; }

/* 其它统计 */
.site-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.stat-item {
    background: var(--bg);
    border-radius: 8px;
    padding: 10px 8px;
    text-align: center;
}
.stat-item .num { font-size: 18px; font-weight: 600; }
.stat-item .lbl { font-size: 11px; color: var(--text-soft); margin-top: 2px; }
.stat-item.expiring .num { color: var(--yellow); }
.stat-item.expired .num { color: var(--red); }
.stat-item.total .num { color: var(--text); }

.site-error {
    background: var(--red-soft);
    color: #b91c1c;
    font-size: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 14px;
    word-break: break-all;
}

.site-foot {
    margin-top: 12px;
    font-size: 11px;
    color: var(--text-mute);
    display: flex; justify-content: space-between;
}

/* ============ 加载骨架 ============ */
.skeleton-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    height: 220px;
    position: relative;
    overflow: hidden;
}
.skeleton-card::after {
    content: "";
    position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, rgba(0,0,0,.05), transparent);
    transform: translateX(-100%);
    animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }

/* ============ 登录页 ============ */
.login-body {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    padding: 20px;
}
.login-card {
    background: #fff;
    border-radius: 20px;
    padding: 40px 36px;
    width: 100%; max-width: 380px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}
.login-icon {
    width: 70px; height: 70px;
    margin: 0 auto 20px;
    background: var(--green-soft);
    color: var(--green);
    border-radius: 18px;
    display: flex; align-items: center; justify-content: center;
}
.login-card h1 { font-size: 22px; margin-bottom: 6px; }
.login-subtitle { font-size: 13px; color: var(--text-soft); margin-bottom: 24px; }
.form-group { margin-bottom: 16px; text-align: left; }
.form-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.alert {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
}
.alert-error { background: var(--red-soft); color: #b91c1c; }

/* ============ 页脚 ============ */
.footer {
    margin-top: 36px;
    text-align: center;
    font-size: 12px;
    color: var(--text-mute);
}

/* ============ 响应式 ============ */
@media (max-width: 640px) {
    .topbar-inner { padding: 14px 16px; }
    .container { padding: 20px 16px 40px; }
    .summary-value { font-size: 26px; }
    .brand h1 { font-size: 16px; }
    .site-active .num { font-size: 30px; }
}
