:root {
    --brand-primary: #2563eb; 
    --brand-dark: #1d4ed8;
    --brand-light: #dbeafe;
    
    --bg-base: #f5f7fb;
    --bg-panel: #ffffff;
    --border-color: #dbe3ee;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 10px;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.02), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 12px 24px rgba(15, 23, 42, 0.06);
    --shadow-glow: none; 
}

* { margin:0; padding:0; box-sizing:border-box; }
body {
    min-height:100vh;
    background: var(--bg-base);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-primary);
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

h1 { 
    font-size:24px; font-weight:700; margin:0; letter-spacing:0; color:var(--text-primary);
}
h2 { font-size:18px; font-weight:600; margin:0 0 24px; color:var(--text-primary); display:flex; align-items:center; gap:8px;}

.admin-shell {
    min-height:100vh;
    display:grid;
    grid-template-columns:260px minmax(0, 1fr);
}

.admin-sidebar {
    position:sticky;
    top:0;
    height:100vh;
    overflow-y:auto;
    background:#ffffff;
    border-right:1px solid var(--border-color);
    padding:18px 14px 24px;
}

.brand-block {
    display:flex;
    align-items:center;
    gap:12px;
    padding:8px 8px 18px;
    margin-bottom:12px;
    border-bottom:1px solid var(--border-color);
}

.brand-mark {
    width:38px;
    height:38px;
    border-radius:8px;
    display:flex;
    align-items:center;
    justify-content:center;
    background:#0f172a;
    color:#ffffff;
    font-size:13px;
    font-weight:800;
}

.brand-title {
    font-size:15px;
    line-height:1.3;
    font-weight:700;
}

.brand-subtitle {
    margin-top:2px;
    font-size:12px;
    color:var(--text-secondary);
}

.admin-main {
    min-width:0;
    padding:28px 32px 44px;
}

.admin-topbar {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:24px;
    margin-bottom:18px;
}

.page-kicker {
    margin-bottom:6px;
    color:var(--text-secondary);
    font-size:12px;
    font-weight:700;
}

.top-actions {
    display:flex;
    align-items:center;
    gap:8px;
    flex-wrap:wrap;
}

.zone-picker {
    min-height:34px;
    display:flex;
    align-items:center;
    gap:8px;
    padding:4px 8px;
    border:1px solid var(--border-color);
    border-radius:var(--radius-sm);
    background:var(--bg-panel);
    color:var(--text-secondary);
    font-size:12px;
}
.zone-picker select {
    width:138px;
    min-width:120px;
    height:28px;
    padding:2px 8px;
    font-size:13px;
}
.zone-picker small {
    min-width:42px;
    color:var(--text-secondary);
    white-space:nowrap;
}

.content-area {
    min-width:0;
}

.status-bar {
    display:flex; gap:24px; padding: 12px 16px; margin-bottom:18px;
    background: var(--bg-panel); border: 1px solid var(--border-color);
    border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
    font-size:13px; color:var(--text-secondary);
    flex-wrap:wrap;
}
.status-bar .item { display: flex; align-items: center; gap: 6px; }
.status-bar .item b { color:var(--text-primary); font-weight:600; font-size:14px;}
.status-bar .online { color:#10b981; font-weight:600; }
.status-bar .offline { color:#ef4444; font-weight:600;}

.nav { 
    display:flex;
    flex-direction:column;
    gap:18px;
}
.nav-group { display:flex; flex-direction:column; gap:3px; }
.nav-group-title {
    padding:0 10px 4px;
    font-size:12px;
    font-weight:700;
    color:#94a3b8;
}
.nav-btn {
    width:100%;
    min-height:34px;
    display:flex;
    align-items:center;
    padding:8px 10px;
    background:transparent;
    border:none;
    border-radius: var(--radius-sm);
    color:#475569;
    font-size:13px;
    font-weight:500;
    cursor:pointer;
    text-align:left;
    text-decoration:none;
    line-height:1.35;
    transition:background .16s ease, color .16s ease, box-shadow .16s ease;
}
.nav-btn:hover { color:var(--brand-primary); background:#eff6ff; }
.nav-btn.active { 
    background:#eff6ff;
    color:var(--brand-primary);
    box-shadow:inset 3px 0 0 var(--brand-primary);
    font-weight: 600;
}
.nav-danger { color:#b91c1c; }
.nav-link::after {
    content:'';
    width:6px;
    height:6px;
    margin-left:auto;
    border-top:1.5px solid currentColor;
    border-right:1.5px solid currentColor;
    transform:rotate(45deg);
}

.panel { 
    display:none; animation: slideUp 0.24s ease; 
    background: var(--bg-panel); border: 1px solid var(--border-color);
    border-radius: var(--radius-lg); padding: 24px;
    box-shadow: var(--shadow-md);
    min-width:0;
    overflow-x:auto;
}
.panel.show { display:block; }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.kpi-grid {
    display:grid;
    grid-template-columns:repeat(4, minmax(0, 1fr));
    gap:14px;
    margin-bottom:18px;
}

.kpi-card {
    background:#ffffff;
    border:1px solid var(--border-color);
    border-radius:var(--radius-md);
    padding:18px 18px 16px;
    box-shadow:var(--shadow-sm);
}

.kpi-label {
    margin-bottom:10px;
    color:var(--text-secondary);
    font-size:13px;
    font-weight:600;
}

.kpi-value {
    color:var(--text-primary);
    font-size:30px;
    line-height:1;
    font-weight:800;
}

.dashboard-grid {
    display:grid;
    grid-template-columns:minmax(280px, .85fr) minmax(320px, 1.15fr);
    gap:18px;
}

.ops-card {
    background:#ffffff;
    border:1px solid var(--border-color);
    border-radius:var(--radius-md);
    padding:18px;
}

.ops-card h3 {
    margin:0 0 14px;
    font-size:15px;
    font-weight:700;
}

.status-list {
    display:grid;
    gap:10px;
    font-size:13px;
}

.status-list div {
    display:flex;
    justify-content:space-between;
    gap:16px;
    padding-bottom:10px;
    border-bottom:1px solid #eef2f7;
}

.status-list div:last-child { border-bottom:none; padding-bottom:0; }
.status-list span { color:var(--text-secondary); }
.status-list b { color:var(--text-primary); font-weight:700; text-align:right; }

.recent-logins {
    max-height:240px;
    overflow-y:auto;
    font-size:13px;
    line-height:1.8;
}

.row { display:flex; gap:16px; align-items:center; margin-bottom:20px; flex-wrap:wrap; }
.row label { font-size:13px; font-weight:600; color:var(--text-secondary); min-width:80px; }
input[type="text"], input[type="password"], input[type="number"], select, textarea {
    padding:10px 14px; border-radius:8px; border:1px solid #cbd5e1;
    background:#fafafa; color:var(--text-primary); font-size:14px; outline:none;
    transition:all .2s ease; font-family:inherit;
}
input:focus, select:focus, textarea:focus { 
    border-color:var(--brand-primary); 
    background:#ffffff;
    box-shadow: 0 0 0 3px var(--brand-light); 
}
textarea { resize:vertical; min-height:80px; width:100%; max-width:600px; }
select { cursor:pointer; }

.btn {
    padding:10px 20px; border:1px solid transparent; border-radius:8px;
    font-size:13px; font-weight:600; cursor:pointer; transition:all .2s ease;
    display: inline-flex; align-items: center; justify-content: center;
}
.btn:active { transform: scale(0.96); }
.btn-blue { background: var(--brand-primary); color:#ffffff; box-shadow: none; } 
.btn-blue:hover { background:var(--brand-dark); }
.btn-green { background:#ffffff; border-color:#cbd5e1; color:var(--text-primary); box-shadow: var(--shadow-sm); }
.btn-green:hover { background: #f8fafc; border-color:var(--brand-primary); color:var(--brand-primary); }
.btn-orange { background:#ffffff; border-color:#cbd5e1; color:var(--text-primary); box-shadow: var(--shadow-sm); }
.btn-orange:hover { background: #f8fafc; border-color:#f59e0b; color:#d97706; }
.btn-red { background:#fef2f2; border-color:#fecaca; color:#ef4444; }
.btn-red:hover { background: #fee2e2; border-color:#f87171; }
.btn-sm { padding:6px 14px; font-size:12px; }
.admin-template-hint {
    flex:1 1 260px;
    min-width:220px;
    color:var(--text-secondary);
    font-size:12px;
    line-height:1.5;
}

table { width:100%; border-collapse:separate; border-spacing: 0; margin-top:16px; font-size:13px; }
th { text-align:left; padding:14px 16px; background:#f8fafc; color:var(--text-secondary); font-weight:600; border-bottom:1px solid var(--border-color); border-top:1px solid var(--border-color); }
th:first-child { border-left:1px solid var(--border-color); border-top-left-radius: 8px; }
th:last-child { border-right:1px solid var(--border-color); border-top-right-radius: 8px; }
td { padding:16px; border-bottom:1px solid var(--border-color); color:var(--text-primary); }
tr:hover td { background:#f8fafc; color: var(--text-primary); }

.tag { display:inline-block; padding:4px 10px; border-radius:20px; font-size:12px; font-weight:600; border: 1px solid transparent; }
.tag-green { background:#ecfdf5; color:#059669; border-color:#a7f3d0; }
.tag-gray { background:#f1f5f9; color:#475569; border-color:#cbd5e1; }
.tag-red { background:#fef2f2; color:#dc2626; border-color:#fecaca; }
.tag-blue { background:var(--brand-light); color:var(--brand-dark); border-color:#c7d2fe; }

.admin-permission-editor {
    margin-top:14px;
    border:1px solid var(--border-color);
    border-radius:8px;
    background:#f8fafc;
    padding:14px;
}
.admin-permission-head {
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:12px;
    margin-bottom:12px;
}
.admin-permission-head b {
    display:block;
    font-size:14px;
    color:var(--text-primary);
    margin-bottom:2px;
}
.admin-permission-head span {
    font-size:12px;
    color:var(--text-secondary);
}
.permission-group { margin-top:12px; }
.permission-group:first-child { margin-top:0; }
.permission-group-title {
    font-size:12px;
    font-weight:700;
    color:var(--text-secondary);
    margin-bottom:8px;
}
.permission-grid {
    display:grid;
    grid-template-columns:repeat(auto-fill,minmax(210px,1fr));
    gap:8px;
}
.permission-module-card {
    border:1px solid #c7d2fe;
    border-radius:8px;
    background:#ffffff;
    margin-bottom:10px;
    overflow:hidden;
}
.permission-module-head {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    padding:12px;
    background:#eef2ff;
    border-bottom:1px solid #c7d2fe;
}
.permission-module-parent {
    display:flex;
    align-items:flex-start;
    gap:9px;
    cursor:pointer;
}
.permission-module-parent input { margin-top:3px; }
.permission-module-parent b {
    display:block;
    font-size:14px;
    color:#1e1b4b;
}
.permission-module-parent small {
    display:block;
    margin-top:2px;
    color:#4f46e5;
    font-size:12px;
    line-height:1.35;
}
.permission-module-actions {
    display:flex;
    gap:8px;
    flex-wrap:wrap;
    justify-content:flex-end;
}
.permission-module-actions .btn:disabled {
    opacity:.55;
    cursor:not-allowed;
}
.permission-sub-grid {
    display:grid;
    grid-template-columns:repeat(auto-fill,minmax(220px,1fr));
    gap:8px;
    padding:10px;
}
.permission-sub-grid .permission-check {
    min-height:60px;
    background:#fbfdff;
}
.permission-check {
    display:flex;
    align-items:flex-start;
    gap:8px;
    min-height:52px;
    padding:10px;
    border:1px solid #dbe4ef;
    border-radius:8px;
    background:#fff;
    cursor:pointer;
}
.permission-check input { margin-top:3px; }
.permission-check b {
    display:block;
    font-size:13px;
    color:var(--text-primary);
}
.permission-check small {
    display:block;
    margin-top:2px;
    line-height:1.35;
    color:var(--text-secondary);
    font-size:11px;
}
.permission-check:has(input:checked) {
    border-color:#a5b4fc;
    background:#eef2ff;
}

.msg { padding:14px 16px; border-radius:8px; font-size:13px; font-weight:500; margin-top:16px; display:none; }
.msg.ok { display:block; background:#ecfdf5; color:#059669; border: 1px solid #34d399; }
.msg.err { display:block; background:#fef2f2; color:#dc2626; border: 1px solid #f87171; }

.stat { display:inline-block; margin-right:24px; font-size:13px; color:var(--text-secondary); background:#f1f5f9; padding:6px 12px; border-radius:20px; }
.stat b { color:var(--brand-dark); font-weight:600; }

.skin-attr-toolbar {
    display:flex;
    align-items:center;
    gap:10px;
    flex-wrap:wrap;
    margin-bottom:16px;
    padding:14px;
    background:#f8fafc;
    border:1px solid var(--border-color);
    border-radius:8px;
}
.skin-attr-toolbar input[type="text"] { width:280px; max-width:100%; }
.skin-attr-check {
    display:inline-flex;
    align-items:center;
    gap:6px;
    color:var(--text-secondary);
    font-size:13px;
    font-weight:600;
}
.skin-attr-info {
    margin-left:auto;
    color:var(--text-secondary);
    font-size:12px;
}
.skin-attr-layout {
    display:grid;
    grid-template-columns:minmax(520px, 1fr) 360px;
    gap:18px;
    align-items:start;
}
.skin-attr-list {
    min-width:0;
    max-height:620px;
    overflow:auto;
    border:1px solid var(--border-color);
    border-radius:8px;
    background:#ffffff;
}
.skin-attr-table { margin:0; }
.skin-attr-table thead { position:sticky; top:0; z-index:1; }
.skin-attr-row-selected td { background:#eff6ff !important; }
.skin-attr-muted { color:var(--text-secondary); font-size:12px; }
.skin-attr-editor {
    border:1px solid var(--border-color);
    border-radius:8px;
    padding:16px;
    background:#ffffff;
}
.skin-attr-editor h3 {
    margin:0 0 14px;
    font-size:15px;
    font-weight:700;
}
.skin-attr-form-grid {
    display:grid;
    grid-template-columns:1fr;
    gap:10px;
}
.skin-attr-form-grid label {
    display:grid;
    gap:5px;
    color:var(--text-secondary);
    font-size:12px;
    font-weight:700;
}
.skin-attr-form-grid input,
.skin-attr-form-grid select { width:100%; font-size:13px; }
.skin-attr-clone { margin-top:12px; }
.skin-attr-preview {
    margin-top:12px;
    padding:12px;
    min-height:44px;
    border-radius:8px;
    background:#f1f5f9;
    color:var(--text-primary);
    font-size:13px;
    line-height:1.6;
}
.skin-attr-actions { margin-top:12px; margin-bottom:0; gap:8px; }

.modal-overlay {
    position:fixed; top:0; left:0; right:0; bottom:0; background:rgba(15, 23, 42, 0.3);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    display:none; justify-content:center; align-items:flex-start; padding:80px 20px; z-index:100; overflow-y:auto;
}
.modal-overlay.show { display:flex; animation: slideUp 0.3s ease; }
.modal {
    background:var(--bg-panel); border:1px solid var(--border-color); border-radius:24px;
    padding:32px; width:100%; max-width:680px; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    border-top: 6px solid var(--brand-primary);
}
/* 登录遮罩 */
.login-overlay {
    position:fixed;top:0;left:0;right:0;bottom:0;z-index:9999;
    background:linear-gradient(135deg,#f1f5f9 0%,#e0e7ff 100%);
    display:flex;align-items:center;justify-content:center;
}
.login-overlay.hidden { display:none; }
.login-box {
    background:var(--bg-panel);border-radius:24px;padding:48px 40px;width:100%;max-width:400px;
    box-shadow:0 25px 50px rgba(0,0,0,0.1);border-top:6px solid var(--brand-primary);text-align:center;
}
.login-box h2 { justify-content:center;margin-bottom:32px; }
.login-box input { width:100%;margin-bottom:16px;font-size:15px; }
.login-box .btn { width:100%;padding:12px;font-size:15px; }

@media (max-width: 1180px) {
    .admin-shell { grid-template-columns:220px minmax(0, 1fr); }
    .admin-main { padding:22px 22px 36px; }
    .kpi-grid { grid-template-columns:repeat(2, minmax(0, 1fr)); }
    .dashboard-grid { grid-template-columns:1fr; }
    .skin-attr-layout { grid-template-columns:1fr; }
    .skin-attr-list { max-height:520px; }
}

@media (max-width: 820px) {
    .admin-shell { display:block; }
    .admin-sidebar {
        position:relative;
        height:auto;
        max-height:none;
        border-right:none;
        border-bottom:1px solid var(--border-color);
    }
    .nav {
        display:grid;
        grid-template-columns:repeat(2, minmax(0, 1fr));
        gap:12px;
    }
    .admin-topbar {
        align-items:flex-start;
        flex-direction:column;
    }
    .top-actions { width:100%; }
    .top-actions .btn { flex:1; }
    .zone-picker { width:100%; }
    .zone-picker select { flex:1; width:auto; }
    .status-bar { gap:12px; }
    .panel { padding:18px; }
}

@media (max-width: 560px) {
    .admin-main { padding:18px 14px 30px; }
    .nav { grid-template-columns:1fr; }
    .kpi-grid { grid-template-columns:1fr; }
    .row { align-items:stretch; }
    .row label { min-width:100%; }
    input[type="text"], input[type="password"], input[type="number"], select, textarea {
        max-width:100%;
    }
}
