:root {
    --bg: #f3f5f9;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --line: #e5e7eb;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --red: #dc2626;
    --green: #16a34a;
    --amber: #d97706;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

h1, h2 { margin: 0 0 16px; font-weight: 600; }
h2 { font-size: 17px; }
a { color: var(--primary); text-decoration: none; }
.muted { color: var(--muted); }

/* ---------- 登录 ---------- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e3a8a, #2563eb);
}
.login-card {
    width: 380px;
    max-width: calc(100vw - 32px);
    background: var(--card);
    padding: 36px;
    border-radius: 14px;
    box-shadow: 0 18px 50px rgba(0,0,0,.2);
    text-align: center;
}
.login-logo {
    width: 56px; height: 56px;
    margin: 0 auto 14px;
    border-radius: 14px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 18px;
    display: flex; align-items: center; justify-content: center;
}
.login-card h1 { font-size: 20px; }
.login-card form { text-align: left; margin-top: 20px; }
.login-card .tip { font-size: 12px; color: var(--muted); margin-top: 16px; }

/* ---------- 顶栏 ---------- */
.topbar { background: #111827; color: #fff; }
.topbar-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 20px;
    height: 58px;
    display: flex; align-items: center; justify-content: space-between;
}
.brand { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.brand-badge {
    background: var(--primary); color: #fff;
    font-size: 11px; padding: 3px 7px; border-radius: 5px; letter-spacing: .5px;
}
.logout { color: #cbd5e1; font-size: 13px; }
.logout:hover { color: #fff; }

/* ---------- 布局 ---------- */
.wrap { max-width: 1240px; margin: 0 auto; padding: 24px 20px 60px; }
.layout { display: grid; grid-template-columns: minmax(320px, 420px) 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 22px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.guide { margin-top: 20px; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.field > label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px; }
.field em { color: var(--red); font-style: normal; }
input[type=text], input[type=number], input[type=password],
input[type=datetime-local], input[type=time], textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font: inherit;
    color: var(--text);
    background: #fff;
    outline: none;
}
input:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
textarea { resize: vertical; }
input[type=file] { width: 100%; font-size: 13px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-2 .sub-field { grid-column: 1 / -1; margin-top: 10px; }
.sub-field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px; }
.hint { color: var(--muted); font-size: 12px; margin: 6px 0 0; }
.divider { height: 1px; background: var(--line); margin: 20px 0; }
.checks { display: flex; flex-direction: column; gap: 8px; }
.cb { display: flex !important; align-items: center; gap: 8px; font-weight: 500 !important; cursor: pointer; }
.cb input { width: 16px; height: 16px; accent-color: var(--primary); }
.actions { display: flex; gap: 10px; margin-top: 20px; }

.btn {
    display: inline-block;
    padding: 9px 18px;
    border: 1px solid transparent;
    border-radius: 8px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.ghost { background: #fff; border-color: var(--line); color: var(--text); }
.btn.block { width: 100%; }
.btn.sm { padding: 4px 10px; font-size: 12px; font-weight: 500; margin-left: 10px; }

/* ---------- 提示 ---------- */
.alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.alert.success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert.error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* ---------- 表格 ---------- */
.count {
    background: var(--bg); color: var(--muted);
    font-size: 12px; padding: 2px 8px; border-radius: 10px; margin-left: 6px;
}
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 11px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; white-space: nowrap; }
tbody tr:hover { background: #fafbfc; }
.pkg { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 600; font-size: 12px; }
.ver { color: var(--muted); font-size: 12px; margin-top: 2px; }
.small { font-size: 12px; white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 36px 10px; }

.status { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11px; white-space: nowrap; }
.status.on { background: #dcfce7; color: #166534; }
.status.off { background: #f3f4f6; color: #4b5563; }
.status.wait { background: #fef3c7; color: #92400e; }
.status.window { background: #e0e7ff; color: #3730a3; }
.tag.force { background: #fee2e2; color: #991b1b; font-size: 10px; padding: 1px 6px; border-radius: 4px; }

.ops { white-space: nowrap; }
.ops a, .linkbtn {
    color: var(--primary); background: none; border: 0;
    padding: 0 6px 0 0; font: inherit; font-size: 12px; cursor: pointer;
}
.ops a:hover, .linkbtn:hover { text-decoration: underline; }
.linkbtn.danger { color: var(--red); }
.inline { display: inline; }

/* ---------- 接口说明 ---------- */
.guide pre {
    background: #0f172a; color: #e2e8f0;
    padding: 14px 16px; border-radius: 8px;
    overflow-x: auto; font-size: 12px; line-height: 1.7;
}
.guide code { font-family: ui-monospace, Menlo, Consolas, monospace; }
.guide > p:not(.hint) code { background: var(--bg); padding: 1px 5px; border-radius: 4px; }

/* ---------- 数据概览 ---------- */
.overview { margin-bottom: 20px; }
.tiny { font-size: 12px; font-weight: 400; margin-left: 8px; }
.overview h3 { font-size: 14px; margin: 22px 0 10px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 900px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat-box {
    background: #fff; border: 1px solid var(--line);
    border-left: 4px solid var(--primary);
    border-radius: 10px; padding: 14px 16px;
}
.stat-box.blue { border-left-color: #2563eb; }
.stat-box.green { border-left-color: #16a34a; }
.stat-box.purple { border-left-color: #7c3aed; }
.stat-box.amber { border-left-color: #d97706; }
.stat-num { font-size: 26px; font-weight: 700; line-height: 1.2; }
.stat-label { color: var(--muted); font-size: 12px; margin-top: 2px; }
.stat-sub { font-size: 11px; color: #9ca3af; margin-top: 6px; }
table.mini th, table.mini td { padding: 7px 10px; }
.online-dot {
    display: inline-block; width: 7px; height: 7px;
    border-radius: 50%; background: #16a34a; margin-right: 6px;
}
.trend {
    display: grid; grid-template-columns: repeat(7, 1fr);
    gap: 10px; height: 122px;
}
.trend-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
.bars {
    display: flex; align-items: flex-end; justify-content: center;
    gap: 3px; height: 80px; width: 100%;
}
.bar { width: 14px; min-height: 2px; border-radius: 3px 3px 0 0; }
.bar.launch { background: #3b82f6; }
.bar.download { background: #22c55e; }
.trend-label { font-size: 11px; color: var(--muted); margin-top: 6px; }
.trend-num { font-size: 10px; color: #9ca3af; }
.legend { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 2px; }
.legend.launch { background: #3b82f6; }
.legend.download { background: #22c55e; }
