:root {
    --bg: #f4f7fb;
    --panel: #ffffff;
    --panel-soft: #f8fafc;
    --sidebar: #061b3a;
    --sidebar-2: #082957;
    --primary: #1768ff;
    --primary-dark: #0c4ed7;
    --text: #111827;
    --muted: #6b7280;
    --line: #e5eaf2;
    --success: #10b981;
    --warning: #f97316;
    --danger: #ef4444;
    --purple: #7c3aed;
    --shadow: 0 12px 32px rgba(15, 23, 42, .07);
    --radius: 18px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
code { background: #eef2ff; padding: 2px 6px; border-radius: 6px; }

.app-shell { min-height: 100vh; display: flex; }
.sidebar {
    width: 252px;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    color: #d7e4f8;
    background: linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    box-shadow: 8px 0 28px rgba(2, 16, 38, .12);
}
.brand { display: flex; align-items: center; gap: 12px; font-size: 20px; font-weight: 800; color: white; padding: 4px 10px 26px; }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(145deg, #1f86ff, #0c57e7); box-shadow: 0 10px 24px rgba(23,104,255,.35); font-size: 24px; }
.side-nav { display: grid; gap: 8px; }
.side-link { height: 48px; display: flex; align-items: center; gap: 13px; padding: 0 14px; border-radius: 12px; color: #b9cae3; transition: .18s ease; }
.side-link:hover { color: white; background: rgba(255,255,255,.08); }
.side-link.active { color: white; background: linear-gradient(135deg, #1e74ff, #1357ed); box-shadow: 0 10px 20px rgba(23,104,255,.28); }
.side-link svg { width: 21px; height: 21px; flex: 0 0 auto; }
.sidebar-art { margin-top: auto; text-align: center; padding: 26px 10px 4px; color: #8db8f8; position: relative; }
.art-orbit { width: 105px; height: 105px; border: 1px solid rgba(58,143,255,.5); border-radius: 50%; margin: 0 auto -80px; transform: rotate(-18deg); box-shadow: 0 0 30px rgba(27,112,245,.2) inset; }
.art-shield { margin: 0 auto 18px; width: 72px; height: 72px; border-radius: 24px; background: linear-gradient(145deg,#1e79ff,#083d98); display: grid; place-items: center; font-size: 32px; color: white; box-shadow: 0 16px 26px rgba(0,0,0,.25); position: relative; }
.sidebar-art small { display: block; opacity: .85; }

.main-wrap { width: calc(100% - 252px); margin-left: 252px; min-height: 100vh; display: flex; flex-direction: column; }
.topbar { height: 82px; margin: 18px 24px 0; background: rgba(255,255,255,.94); border: 1px solid rgba(229,234,242,.9); border-radius: 16px; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; box-shadow: var(--shadow); position: sticky; top: 10px; z-index: 25; backdrop-filter: blur(12px); }
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar h1 { font-size: 19px; margin: 0; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: white; font-weight: 800; background: linear-gradient(145deg,#4f91ff,#1357ed); }
.admin-name { color: #374151; }
.content { padding: 22px 24px 8px; flex: 1; }
.footer { text-align: center; color: #94a3b8; padding: 16px 24px 24px; }
.mobile-menu { display: none; }
.sidebar-mask { display: none; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 20px; }
.stat-card { background: var(--panel); border: 1px solid rgba(229,234,242,.9); border-radius: var(--radius); padding: 20px; display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow); min-height: 120px; }
.stat-icon { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; font-size: 25px; font-weight: 800; }
.stat-icon.blue { background: #e8f1ff; color: var(--primary); }
.stat-icon.green { background: #e5f8f1; color: var(--success); }
.stat-icon.purple { background: #f0eafe; color: var(--purple); }
.stat-icon.orange { background: #fff0e8; color: var(--warning); }
.stat-meta { min-width: 0; }
.stat-label { color: var(--muted); margin-bottom: 4px; }
.stat-value { font-size: 30px; line-height: 1; font-weight: 800; letter-spacing: -.5px; }

.panel { background: var(--panel); border: 1px solid rgba(229,234,242,.9); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; overflow: hidden; }
.panel-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 22px 24px 14px; }
.panel-title { margin: 0; font-size: 19px; }
.panel-subtitle { color: var(--muted); margin-top: 5px; }
.panel-body { padding: 16px 24px 24px; }
.panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar-spacer { flex: 1; }
.search { position: relative; min-width: 250px; }
.search input { padding-left: 38px; }
.search::before { content: "⌕"; position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: #94a3b8; font-size: 20px; }

.btn { border: 1px solid transparent; border-radius: 10px; min-height: 40px; padding: 9px 15px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-weight: 700; transition: .16s ease; background: white; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { color: white; background: linear-gradient(135deg,#2478ff,#155ce9); box-shadow: 0 8px 18px rgba(23,104,255,.22); }
.btn-primary:hover { background: linear-gradient(135deg,#1668ef,#0e4fd3); }
.btn-success { color: white; background: var(--success); }
.btn-danger { color: white; background: var(--danger); }
.btn-warning { color: white; background: var(--warning); }
.btn-light { border-color: var(--line); color: #374151; }
.btn-outline { border-color: #bcd1ff; color: var(--primary); background: #fff; }
.btn-sm { min-height: 34px; padding: 6px 11px; border-radius: 9px; font-size: 13px; }
.btn-block { width: 100%; }
.icon-btn { border: 0; background: transparent; width: 40px; height: 40px; border-radius: 10px; }
.icon-btn:hover { background: #f1f5f9; }

.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { text-align: left; padding: 15px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: #f8fafc; color: #374151; font-weight: 800; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfdff; }
.cell-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.product-name { font-weight: 800; }
.subtext { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.badge { display: inline-flex; align-items: center; min-height: 28px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.badge-success { color: #047857; background: #dff8ee; }
.badge-warning { color: #c2410c; background: #fff0e7; }
.badge-danger { color: #b91c1c; background: #fee2e2; }
.badge-muted { color: #64748b; background: #edf2f7; }
.badge-blue { color: #1d4ed8; background: #e7efff; }

.form-grid { display: grid; gap: 16px; }
.form-grid.single { max-width: 720px; margin-inline: auto; }
.form-row { display: grid; gap: 16px; }
.form-row.two { grid-template-columns: 1fr 1fr; }
.form-row.three { grid-template-columns: repeat(3, 1fr); }
.form-group { display: grid; gap: 8px; }
.form-group label { font-weight: 800; color: #374151; }
.form-group small { color: var(--muted); }
input, select, textarea {
    width: 100%;
    border: 1px solid #d7dee9;
    border-radius: 10px;
    background: white;
    color: var(--text);
    min-height: 42px;
    padding: 10px 12px;
    outline: none;
    transition: .15s ease;
}
textarea { min-height: 118px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #78a8ff; box-shadow: 0 0 0 3px rgba(23,104,255,.1); }
.input-inline { display: flex; gap: 10px; align-items: center; }
.checkbox { display: flex; align-items: center; gap: 8px; }
.checkbox input { width: 18px; min-height: 18px; }

.modal { position: fixed; inset: 0; z-index: 80; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal.open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(2,10,23,.48); backdrop-filter: blur(4px); }
.modal-card { position: relative; width: min(620px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; background: white; border-radius: 18px; box-shadow: 0 26px 80px rgba(2,10,23,.28); }
.modal-header { padding: 20px 22px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { margin: 0; }
.modal-body { padding: 22px; }
.modal-footer { padding: 16px 22px 22px; display: flex; justify-content: flex-end; gap: 10px; }

.alert { padding: 13px 15px; border-radius: 11px; margin-bottom: 15px; border: 1px solid; }
.alert-success { color: #05603f; background: #ecfdf5; border-color: #bbf7d0; }
.alert-danger { color: #991b1b; background: #fef2f2; border-color: #fecaca; }
.alert-warning { color: #9a3412; background: #fff7ed; border-color: #fed7aa; }
.alert-info { color: #1e40af; background: #eff6ff; border-color: #bfdbfe; }
.muted { color: var(--muted); }
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty strong { display: block; color: #334155; font-size: 17px; margin-bottom: 5px; }

.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 15% 15%, #e8f1ff, transparent 30%), linear-gradient(135deg,#f8fbff,#edf3fb); }
.auth-card, .install-card { width: min(460px, 100%); background: rgba(255,255,255,.96); border: 1px solid rgba(229,234,242,.9); border-radius: 22px; box-shadow: 0 28px 70px rgba(15,23,42,.13); padding: 30px; }
.install-card { width: min(760px, 100%); }
.auth-logo { width: 58px; height: 58px; border-radius: 17px; display: grid; place-items: center; margin-bottom: 18px; color: white; font-size: 30px; background: linear-gradient(145deg,#1e79ff,#0e54db); box-shadow: 0 14px 28px rgba(23,104,255,.28); }
.auth-card h1, .install-card h1 { margin: 0 0 6px; }
.requirement-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 20px; }
.requirement { border-radius: 999px; padding: 7px 10px; font-size: 12px; font-weight: 800; }
.requirement.ok { background: #e6f8f0; color: #047857; }
.requirement.bad { background: #fee2e2; color: #b91c1c; }

.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.quick-card { border: 1px solid var(--line); border-radius: 14px; padding: 16px; background: #fbfdff; transition: .16s ease; }
.quick-card:hover { transform: translateY(-2px); border-color: #bdd2ff; box-shadow: 0 10px 22px rgba(15,23,42,.06); }
.quick-card strong { display: block; margin-bottom: 5px; }

.code-box { background: #07182f; color: #d9eaff; border-radius: 14px; padding: 16px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-word; max-height: 420px; overflow: auto; }
.copy-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }

.pagination { display: flex; gap: 7px; justify-content: center; align-items: center; margin-top: 18px; }
.page-link { min-width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 9px; display: grid; place-items: center; background: white; }
.page-link.active { color: white; background: var(--primary); border-color: var(--primary); }
.page-gap { color: var(--muted); }

.kpi-line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.progress { height: 8px; background: #edf2f7; border-radius: 99px; overflow: hidden; margin-top: 8px; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg,#1f72ff,#55a0ff); }

@media (max-width: 1100px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .panel-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .sidebar { transform: translateX(-102%); transition: .2s ease; }
    .sidebar.open { transform: translateX(0); }
    .sidebar-mask { position: fixed; inset: 0; z-index: 35; background: rgba(2,10,23,.46); }
    .sidebar-mask.open { display: block; }
    .main-wrap { width: 100%; margin-left: 0; }
    .mobile-menu { display: inline-grid; place-items: center; }
    .topbar { margin: 10px 12px 0; height: 68px; padding-inline: 13px; }
    .content { padding: 14px 12px 4px; }
    .admin-name { display: none; }
    .topbar-right .btn { display: none; }
    .stats-grid { gap: 12px; }
    .stat-card { padding: 15px; min-height: 100px; }
    .stat-icon { width: 48px; height: 48px; }
    .stat-value { font-size: 25px; }
    .panel-header { padding: 18px 16px 10px; }
    .panel-body { padding: 14px 16px 18px; }
}
@media (max-width: 620px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .stat-card { display: block; }
    .stat-icon { margin-bottom: 10px; }
    .form-row.two, .form-row.three { grid-template-columns: 1fr; }
    .quick-grid { grid-template-columns: 1fr; }
    .search { min-width: 100%; }
    .toolbar > .btn, .toolbar > select { width: 100%; }
    .topbar h1 { font-size: 17px; }
    .auth-card, .install-card { padding: 22px; }
}


/* MODAL_CLOSE_BUTTON_FIX_V1 */
/* 弹窗右上角关闭按钮 */
.modal-header .icon-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    flex: 0 0 36px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 50%;

    background: transparent;
    color: #64748b;
    text-decoration: none;

    font-size: 22px;
    font-weight: 400;
    line-height: 1;

    cursor: pointer;
    transition:
        background-color .15s ease,
        color .15s ease,
        transform .15s ease;
}

.modal-header .icon-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
    transform: none;
}

.modal-header .icon-btn:focus-visible {
    outline: 2px solid #2478ff;
    outline-offset: 2px;
}

.modal-header .icon-btn:active {
    background: #e2e8f0;
}
