:root {
    --brand: #2b6ef2;
    --brand-deep: #1e40af;
    --side: #1d2432;
    --side-2: #151b26;
    --line: #e7ecf4;
    --muted: #8a94a6;
    --ink: #1f2937;
    --bg: #f3f6fb;
    --ok: #16a34a;
    --warn: #d97706;
    --danger: #dc2626;
    --radius: 12px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body.admin-body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
    font-size: 14px;
}
a { color: var(--brand); text-decoration: none; }
img { max-width: 100%; }
button, input, select, textarea { font-family: inherit; }

.admin-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 232px;
    background: linear-gradient(180deg, var(--side), var(--side-2));
    color: #c9d2e3;
    display: flex;
    flex-direction: column;
    z-index: 50;
    transition: transform .25s;
    overflow-y: auto;
}

.admin-brand {
    padding: 20px 20px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,.07);
}

.admin-brand .logo-dot {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, #4f8dfd, #7c3aed);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    font-size: 15px;
    flex-shrink: 0;
}

.admin-brand strong {
    display: block;
    color: #fff;
    font-size: 16px;
    letter-spacing: .5px;
}

.admin-brand small { color: #8d9bb2; font-size: 11px; }

.admin-nav { padding: 12px 10px 24px; }
.admin-nav .group {
    margin: 16px 10px 7px;
    font-size: 11px;
    color: #6c7a92;
    letter-spacing: 1px;
}
.admin-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 9px;
    color: #b9c4d8;
    font-size: 13.5px;
    margin-bottom: 3px;
    transition: .18s;
}
.admin-nav a .ico { width: 18px; text-align: center; opacity: .8; }
.admin-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.admin-nav a.on {
    background: linear-gradient(135deg, #2b6ef2, #4f46e5);
    color: #fff;
    box-shadow: 0 6px 16px rgba(43, 110, 242, .3);
}

.admin-main {
    margin-left: 232px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.admin-topbar {
    height: 58px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 22px;
    position: sticky;
    top: 0;
    z-index: 30;
}

.menu-toggle {
    display: none;
    border: 0;
    background: #eef3fc;
    color: #3b4a63;
    width: 36px;
    height: 36px;
    border-radius: 9px;
    font-size: 17px;
}

.admin-topbar .page-title { font-size: 16px; font-weight: 600; flex: 1; }
.admin-topbar .top-actions { display: flex; align-items: center; gap: 14px; font-size: 13px; color: #64748b; }
.admin-topbar .top-actions a { color: #64748b; }
.admin-topbar .top-actions a:hover { color: var(--brand); }
.admin-topbar .who { color: #334155; font-weight: 500; }

.admin-content { padding: 20px 22px 40px; }

.flash {
    margin-bottom: 16px;
    padding: 12px 15px;
    border-radius: 10px;
    font-size: 13px;
    border: 1px solid transparent;
}
.flash.error { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.flash.success { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }

.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 18px;
    border: 1px solid var(--line);
    position: relative;
    overflow: hidden;
}
.stat-card .label { color: var(--muted); font-size: 12.5px; }
.stat-card .value { margin-top: 8px; font-size: 25px; font-weight: 700; color: #0f172a; }
.stat-card .hint { margin-top: 6px; font-size: 11.5px; color: #94a3b8; }
.stat-card::after {
    content: "";
    position: absolute;
    width: 70px; height: 70px;
    right: -24px; bottom: -30px;
    border-radius: 50%;
    background: #eef4ff;
}
.stat-card:nth-child(2)::after { background: #fff7ed; }
.stat-card:nth-child(3)::after { background: #f0fdf4; }
.stat-card:nth-child(4)::after { background: #fdf2f8; }

.panel-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 18px;
    overflow: hidden;
}
.panel-card .panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 18px;
    border-bottom: 1px solid var(--line);
}
.panel-card .panel-head h2 { margin: 0; font-size: 15px; }
.panel-card .panel-body { padding: 16px 18px; }

.table-wrap { overflow-x: auto; }
table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    white-space: nowrap;
}
table.data th {
    text-align: left;
    padding: 11px 12px;
    background: #f8fafd;
    color: #64748b;
    font-weight: 500;
    border-bottom: 1px solid var(--line);
    font-size: 12px;
}
table.data td {
    padding: 12px;
    border-bottom: 1px solid #f1f4f9;
    color: #334155;
    vertical-align: middle;
}
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: #fafcff; }
table.data .muted { color: #94a3b8; font-size: 12px; }
table.data .money { color: #dc2626; font-weight: 600; }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    line-height: 1.6;
}
.badge.warn { background: #fff7e6; color: #b45309; }
.badge.info { background: #eef4ff; color: #1d4ed8; }
.badge.ok { background: #ecfdf3; color: #16794c; }
.badge.muted { background: #f1f3f7; color: #64748b; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    padding: 0 14px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 13px;
    cursor: pointer;
    background: #fff;
    color: #475569;
    border-color: #dbe3ef;
    transition: .15s;
}
.btn:hover { border-color: #b9c8e2; color: var(--brand); }
.btn.primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    border: 0;
    box-shadow: 0 6px 14px rgba(37, 99, 235, .25);
}
.btn.primary:hover { color: #fff; filter: brightness(1.04); }
.btn.ok { background: #16a34a; color: #fff; border: 0; }
.btn.danger { background: #fff; color: #dc2626; border-color: #fecaca; }
.btn.mini { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 6px; }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; }

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.form-group label { display: block; margin-bottom: 6px; font-size: 12.5px; color: #64748b; }
.form-group input[type=text], .form-group input[type=password], .form-group input[type=number],
.form-group input[type=file], .form-group select, .form-group textarea {
    width: 100%;
    height: 38px;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    padding: 0 11px;
    font-size: 13.5px;
    background: #fbfcfe;
    outline: none;
    transition: .15s;
}
.form-group textarea { height: auto; min-height: 90px; padding: 9px 11px; resize: vertical; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--brand);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(43, 110, 242, .1);
}
.form-group .hint { margin-top: 5px; font-size: 11.5px; color: #94a3b8; }
.form-actions { margin-top: 18px; display: flex; gap: 10px; }

.filter-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.filter-bar input, .filter-bar select {
    height: 36px;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    padding: 0 11px;
    font-size: 13px;
    background: #fbfcfe;
    outline: none;
    min-width: 150px;
}
.filter-bar input:focus, .filter-bar select:focus { border-color: var(--brand); background: #fff; }

.pager { display: flex; gap: 6px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.pager a, .pager span {
    min-width: 32px;
    height: 32px;
    padding: 0 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    border: 1px solid #dbe3ef;
    background: #fff;
    font-size: 12px;
    color: #475569;
}
.pager .current { background: var(--brand); border-color: var(--brand); color: #fff; }

.empty-state { padding: 46px 20px; text-align: center; color: #94a3b8; font-size: 13px; }

.section-title { font-size: 15px; margin: 22px 0 12px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form input[type=text], .inline-form input[type=number], .inline-form input[type=file], .inline-form select {
    height: 34px;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    padding: 0 10px;
    font-size: 13px;
    background: #fbfcfe;
}

.thumb { width: 92px; height: 50px; object-fit: cover; border-radius: 7px; border: 1px solid var(--line); }
.banner-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.banner-item { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: #fbfcff; }
.banner-item img { width: 100%; height: 100px; object-fit: cover; border-radius: 8px; margin-bottom: 9px; }
.banner-item .meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12px; color: #64748b; }
.banner-item form { margin-top: 8px; }

/* login */
.admin-login-body {
    min-height: 100vh;
    background: radial-gradient(1200px 600px at 20% 10%, #1e3a8a 0%, #0f172a 55%, #020617 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}
.login-card {
    width: 100%;
    max-width: 380px;
    background: #fff;
    border-radius: 18px;
    padding: 34px 30px 28px;
    box-shadow: 0 30px 80px rgba(2, 6, 23, .55);
}
.login-card .brand {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 8px;
}
.login-card .brand .logo-dot {
    width: 40px; height: 40px; border-radius: 11px;
    background: linear-gradient(135deg, #3b82f6, #6d28d9);
    color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.login-card h1 { margin: 0; font-size: 20px; }
.login-card .sub { margin: 2px 0 22px; color: #94a3b8; font-size: 12.5px; }
.login-card .field { margin-bottom: 14px; }
.login-card label { display: block; font-size: 12.5px; color: #64748b; margin-bottom: 6px; }
.login-card input[type=text], .login-card input[type=password] {
    width: 100%; height: 44px; border: 1px solid #dbe3ef; border-radius: 10px;
    padding: 0 12px; font-size: 14px; background: #f8fafd; outline: none;
}
.login-card input:focus { border-color: #2b6ef2; background: #fff; box-shadow: 0 0 0 3px rgba(43,110,242,.12); }
.captcha-row { display: flex; gap: 10px; align-items: center; }
.captcha-row input { flex: 1; }
.captcha-row img { height: 42px; width: 132px; border-radius: 8px; border: 1px solid #dbe3ef; cursor: pointer; }
.login-card button {
    width: 100%; height: 46px; border: 0; border-radius: 10px; margin-top: 8px;
    background: linear-gradient(135deg, #3b82f6, #2563eb); color: #fff; font-size: 15px; font-weight: 600;
    box-shadow: 0 10px 22px rgba(37,99,235,.3); cursor: pointer;
}
.login-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; border-radius: 9px; padding: 10px 12px; font-size: 13px; margin-bottom: 14px; }
.login-foot { text-align: center; color: #94a3b8; font-size: 11.5px; margin-top: 20px; }

@media (max-width: 980px) {
    .cards { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
    .admin-sidebar { transform: translateX(-100%); box-shadow: 20px 0 50px rgba(0,0,0,.2); }
    .admin-sidebar.open { transform: translateX(0); }
    .admin-main { margin-left: 0; }
    .menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
    .admin-content { padding: 14px; }
    .admin-topbar { padding: 0 14px; }
    .form-grid { grid-template-columns: 1fr; }
    .cards { gap: 12px; }
    .stat-card .value { font-size: 21px; }
}
