/* ============================================================
   极简商城 · 后台样式（与前台同风格）
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --line: #e8e8e8;
    --muted: #8a8a8a;
    --fg: #1a1a1a;
    --bg: #f7f7f7;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--fg);
    font-size: 14px;
    line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
a:hover { opacity: .8; }
.muted { color: var(--muted); font-size: 12px; }

/* ---------------- 顶栏 ---------------- */
.admin-top {
    background: #111;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 52px;
    position: sticky;
    top: 0;
    z-index: 10;
    flex-wrap: wrap;
}
.admin-brand { font-weight: 700; font-size: 15px; }
.admin-nav { display: flex; gap: 16px; font-size: 13px; }
.admin-nav a { color: #d5d5d5; }
.admin-nav a:hover { color: #fff; opacity: 1; }

.admin-body { max-width: 1200px; margin: 0 auto; padding: 20px 16px 60px; }

/* ---------------- 卡片/表格 ---------------- */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}
.card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    text-align: center;
}
.card-num { font-size: 22px; font-weight: 700; }
.card p:last-child { color: var(--muted); font-size: 12px; margin-top: 4px; }

.sec-title { font-size: 17px; margin: 18px 0 12px; }
.bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.bar .sec-title { margin: 14px 0; }

.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    font-size: 13px;
}
.table th, .table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
.table th { background: #fafafa; font-weight: 600; white-space: nowrap; }
.table tr:last-child td { border-bottom: none; }
.td-img img { width: 44px; height: 44px; object-fit: cover; border-radius: 4px; }
.td-ph {
    width: 44px; height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
    background: #ececec; border-radius: 4px; font-weight: 700;
}
.ops form { display: inline; }
.ops button {
    background: none; border: none; color: #2563eb;
    cursor: pointer; font-size: 13px; padding: 0 6px;
}
.ops button.danger { color: #dc2626; }

.tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    background: #eee;
    color: #555;
}
.tag-0 { background: #fffbeb; color: #b45309; }
.tag-1 { background: #f0fdf4; color: #15803d; }
.tag-2 { background: #eff6ff; color: #1d4ed8; }
.tag-3 { background: #f5f3ff; color: #6d28d9; }
.tag-4 { background: #fef2f2; color: #b91c1c; }

/* ---------------- 表单 ---------------- */
.form-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
    max-width: 760px;
}
.form-card h3 { font-size: 15px; margin-bottom: 12px; }
.form-card p { margin-bottom: 6px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: #555; margin-bottom: 6px; }
.field input[type="text"], .field input[type="number"], .field input[type="password"],
.field input[type="url"], .field textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 9px 12px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
}
.field input:focus, .field textarea:focus { border-color: #999; }
.field input[type="file"] { font-size: 13px; margin-bottom: 8px; }
.field input[type="checkbox"] { width: auto; margin-right: 6px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 6px; }
.prev { width: 60px; height: 60px; object-fit: cover; border-radius: 4px; margin-top: 6px; display: inline-block; vertical-align: middle; }

.btn {
    display: inline-block;
    padding: 9px 20px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    font-size: 14px;
    cursor: pointer;
}
.btn-primary { background: #111; color: #fff; border-color: #111; }
.btn-danger { background: #dc2626; color: #fff; border-color: #dc2626; }
.inline-form { display: inline-block; margin-right: 8px; }

.filter { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.filter select, .filter input[type="text"] {
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 13px;
    background: #fff;
}

/* ---------------- 提示 ---------------- */
.notice-ok, .notice-err, .notice-info {
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 14px;
    font-size: 13px;
    border: 1px solid var(--line);
    background: #fff;
}
.notice-ok { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.notice-err { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.notice-info { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }

/* ---------------- 登录页 ---------------- */
.login-body { background: #f2f2f2; min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-box {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 36px 32px;
    width: 340px;
    max-width: 92vw;
    text-align: center;
}
.login-box h1 { font-size: 20px; }
.login-box .sub { color: var(--muted); font-size: 13px; margin: 6px 0 18px; }
.login-box input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 11px 12px;
    margin-bottom: 12px;
    font-size: 14px;
}
.login-box .btn { width: 100%; margin-top: 4px; }
.login-error { color: #b91c1c; font-size: 13px; margin-bottom: 12px; }
.login-box .back { margin-top: 16px; font-size: 13px; color: var(--muted); }
.login-box .back a { color: #2563eb; }

@media (max-width: 640px) {
    .admin-top { height: auto; padding: 10px 12px; gap: 8px; }
    .admin-nav { gap: 10px; }
    .grid2 { grid-template-columns: 1fr; }
    .table { font-size: 12px; }
    .cards { grid-template-columns: repeat(2, 1fr); }
}
