* { box-sizing: border-box; }
html, body {
    margin: 0; padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
    background: #f5f6fa;
    color: #2c3e50;
    font-size: 14px;
}

.hidden { display: none !important; }

/* 登录 */
#login-view {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea, #764ba2);
}
.login-box {
    background: #fff; padding: 40px;
    border-radius: 12px; width: 360px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.login-box h1 { margin: 0 0 4px; font-size: 24px; color: #2c3e50; }
.login-box .subtitle { margin: 0 0 24px; color: #95a5a6; font-size: 13px; }
.login-box input {
    width: 100%; padding: 12px;
    margin-bottom: 12px;
    border: 1px solid #dfe4ea; border-radius: 6px;
    font-size: 14px;
}
.login-box button {
    width: 100%; padding: 12px;
    background: #667eea; color: #fff;
    border: 0; border-radius: 6px;
    font-size: 15px; cursor: pointer;
    margin-top: 8px;
}
.login-box button:hover { background: #5568d3; }
.error { color: #e74c3c; margin-top: 12px; min-height: 20px; }

/* 主布局 */
.topbar {
    background: #fff;
    padding: 0 24px;
    height: 56px;
    display: flex; align-items: center;
    border-bottom: 1px solid #e1e4e8;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.brand { font-weight: 600; font-size: 16px; margin-right: 32px; color: #667eea; }
.topbar nav { flex: 1; display: flex; gap: 4px; }
.nav-link {
    padding: 8px 14px; text-decoration: none; color: #6b7280;
    border-radius: 6px; font-size: 14px;
}
.nav-link:hover { background: #f1f3f5; color: #2c3e50; }
.nav-link.active { background: #eef0ff; color: #667eea; font-weight: 500; }
.user-area { display: flex; align-items: center; gap: 12px; }
.user-area #user-name { color: #2c3e50; font-weight: 500; }
.link-btn { background: transparent; border: 0; color: #6b7280; cursor: pointer; font-size: 13px; }
.link-btn:hover { color: #667eea; }

main { padding: 24px; }

/* 仪表盘 */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.stat-card {
    background: #fff; padding: 24px;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.stat-num { font-size: 32px; font-weight: 600; color: #2c3e50; }
.stat-label { color: #95a5a6; font-size: 13px; margin-top: 4px; }

/* 工具栏 */
.toolbar {
    display: flex; gap: 8px; margin-bottom: 16px;
}
.toolbar select, .toolbar button {
    padding: 8px 14px; border: 1px solid #dfe4ea;
    border-radius: 6px; background: #fff;
    font-size: 14px; cursor: pointer;
}
.toolbar button { background: #667eea; color: #fff; border-color: #667eea; }
.toolbar button:hover { background: #5568d3; }

/* 表格 */
.table {
    background: #fff;
    width: 100%; border-collapse: collapse;
    border-radius: 10px; overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.table thead { background: #f8f9fa; }
.table th, .table td {
    padding: 12px 14px; text-align: left;
    border-bottom: 1px solid #f1f3f5;
    font-size: 13px;
}
.table th { color: #6b7280; font-weight: 600; }
.table tr:last-child td { border-bottom: 0; }
.table .col-content {
    max-width: 280px; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap;
}
.table button {
    padding: 4px 10px; border: 1px solid #dfe4ea;
    background: #fff; border-radius: 4px;
    cursor: pointer; font-size: 12px; margin-right: 4px;
}
.table button:hover { background: #f1f3f5; }
.table button.danger { color: #e74c3c; }

/* 状态徽章 */
.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 12px; }
.badge-online   { background: #d4edda; color: #155724; }
.badge-offline  { background: #f8d7da; color: #721c24; }
.badge-pending  { background: #fff3cd; color: #856404; }
.badge-fetched  { background: #cce5ff; color: #004085; }
.badge-sent     { background: #d4edda; color: #155724; }
.badge-failed   { background: #f8d7da; color: #721c24; }
.badge-expired  { background: #e2e3e5; color: #383d41; }

/* 分页 */
.pager { margin-top: 16px; display: flex; gap: 4px; align-items: center; }
.pager button {
    padding: 6px 10px; border: 1px solid #dfe4ea;
    background: #fff; border-radius: 4px; cursor: pointer;
}
.pager button.active { background: #667eea; color: #fff; border-color: #667eea; }
.pager span { color: #6b7280; font-size: 13px; }

/* 表单卡 */
.form-card {
    background: #fff; padding: 32px;
    border-radius: 10px; max-width: 600px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.form-card h2 { margin: 0 0 24px; font-size: 18px; }
.form-card label {
    display: block; margin-bottom: 6px;
    color: #6b7280; font-size: 13px;
}
.form-card input, .form-card select, .form-card textarea {
    width: 100%; padding: 10px;
    margin-bottom: 16px;
    border: 1px solid #dfe4ea; border-radius: 6px;
    font-size: 14px; font-family: inherit;
}
.form-card button {
    padding: 12px 28px; background: #667eea; color: #fff;
    border: 0; border-radius: 6px;
    font-size: 14px; cursor: pointer;
}
.form-card button:hover { background: #5568d3; }
.result { margin-top: 16px; }
.result.success { color: #27ae60; }
.result.error   { color: #e74c3c; }

/* 弹窗 */
.modal {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex; align-items: center; justify-content: center;
    z-index: 100;
}
.modal-box {
    background: #fff; padding: 28px;
    border-radius: 10px; width: 360px;
}
.modal-box h3 { margin: 0 0 16px; }
.modal-box input {
    width: 100%; padding: 10px;
    margin-bottom: 12px;
    border: 1px solid #dfe4ea; border-radius: 6px;
}
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.modal button {
    padding: 8px 16px; border: 0;
    border-radius: 6px; cursor: pointer;
    background: #667eea; color: #fff;
}
.modal .btn-secondary { background: #ecf0f1; color: #2c3e50; }
