:root {
    --bg: #f3f5f2;
    --surface: #fff;
    --ink: #15231d;
    --muted: #68756f;
    --line: #dbe1dc;
    --line-strong: #c8d0ca;
    --green: #246b4a;
    --green-dark: #184f37;
    --green-soft: #eaf4ee;
    --blue: #2f67c7;
    --blue-soft: #eaf0fb;
    --lime: #b7db2a;
    --orange: #d5753e;
    --red: #b54242;
    --shadow: 0 8px 24px rgba(21, 35, 29, .06);
    --topbar: 68px;
    --sidebar: 244px;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body.admin-shell { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); font-family: "PingFang SC", "Microsoft YaHei", Arial, sans-serif; letter-spacing: 0; }

.admin-topbar { position: fixed; inset: 0 0 auto 0; z-index: 1040; height: var(--topbar); display: flex; align-items: center; justify-content: space-between; padding: 0 22px; background: #13231c; color: #fff; border-bottom: 1px solid rgba(255,255,255,.08); }
.topbar-brand, .brand-link, .topbar-actions { display: flex; align-items: center; }
.brand-link { gap: 10px; color: #fff; text-decoration: none; }
.brand-link:hover { color: #fff; }
.brand-mark { position: relative; width: 30px; height: 30px; display: inline-block; border: 2px solid var(--lime); border-radius: 50%; overflow: hidden; }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; width: 20px; height: 37px; top: -5px; border: 2px solid var(--lime); border-radius: 50%; }
.brand-mark::before { left: -14px; }
.brand-mark::after { right: -14px; }
.brand-mark span::before { content: ""; position: absolute; width: 9px; height: 9px; right: 1px; top: 8px; border: 0 solid var(--lime); border-width: 0 0 2px 2px; transform: rotate(-45deg); }
.brand-name { font-size: 17px; font-weight: 700; }
.brand-divider { width: 1px; height: 17px; background: rgba(255,255,255,.28); }
.brand-product { color: #b9c3bd; font-size: 11px; font-weight: 700; }
.topbar-actions { gap: 18px; }
.service-state { display: flex; align-items: center; gap: 8px; color: #bac6c0; font-size: 12px; }
.state-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 4px rgba(183,219,42,.12); }
.icon-button { width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 1px solid rgba(255,255,255,.14); border-radius: 6px; background: transparent; color: #fff; text-decoration: none; transition: background-color .18s ease, border-color .18s ease; }
.icon-button:hover { color: #fff; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.28); }
.sidebar-toggle { display: none; margin-right: 10px; }

.admin-layout { min-height: 100vh; padding-top: var(--topbar); }
.admin-sidebar { position: fixed; inset: var(--topbar) auto 0 0; z-index: 1030; width: var(--sidebar); display: flex; flex-direction: column; background: #fff; border-right: 1px solid var(--line); overflow-y: auto; }
.sidebar-nav { flex: 1; padding: 18px 12px; }
.nav-section + .nav-section { margin-top: 22px; }
.nav-section-label { padding: 0 10px 7px; color: #95a09a; font-size: 10px; font-weight: 700; text-transform: uppercase; }
.sidebar-link { min-height: 42px; display: flex; align-items: center; gap: 12px; margin: 2px 0; padding: 0 12px; border-left: 3px solid transparent; border-radius: 5px; color: #4e5d56; font-size: 14px; font-weight: 600; text-decoration: none; transition: color .18s ease, background-color .18s ease, border-color .18s ease; }
.sidebar-link i { width: 19px; font-size: 17px; text-align: center; }
.sidebar-link:hover { color: var(--green); background: #f3f7f4; }
.sidebar-link.active { color: var(--green-dark); background: var(--green-soft); border-left-color: var(--green); }
.nav-section-muted .sidebar-link { color: #849089; }
.sidebar-footer { padding: 16px 22px 20px; border-top: 1px solid var(--line); color: #8b9790; font-size: 11px; }
.sidebar-footer span { display: block; }
.footer-kicker { margin-bottom: 3px; color: var(--green); font-size: 9px; font-weight: 800; }
.sidebar-backdrop { display: none; }

.admin-content { min-height: calc(100vh - var(--topbar)); margin-left: var(--sidebar); padding: 28px 32px 42px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-kicker { margin-bottom: 6px; color: var(--blue); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.page-title { margin: 0; color: var(--ink); font-size: 28px; font-weight: 750; line-height: 1.2; }
.page-subtitle { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.page-meta { color: #84908a; font-size: 12px; white-space: nowrap; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow); }
.metric-item { min-width: 0; padding: 19px 20px 18px; border-right: 1px solid var(--line); }
.metric-item:last-child { border-right: 0; }
.metric-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; }
.metric-icon { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; color: var(--green); background: var(--green-soft); font-size: 15px; }
.metric-item.blue .metric-icon { color: var(--blue); background: var(--blue-soft); }
.metric-item.lime .metric-icon { color: #577000; background: #f2f8d9; }
.metric-item.orange .metric-icon { color: var(--orange); background: #f9eee8; }
.metric-value { margin-top: 12px; font-size: 30px; font-weight: 760; line-height: 1; font-variant-numeric: tabular-nums; }
.metric-foot { margin-top: 9px; color: #89948e; font-size: 11px; }
.metric-foot strong { color: var(--ink); font-weight: 700; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .85fr); gap: 18px; margin-top: 18px; }
.data-panel { min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); }
.panel-head { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.panel-title { display: flex; align-items: center; gap: 9px; margin: 0; font-size: 15px; font-weight: 720; }
.panel-title i { color: var(--green); font-size: 16px; }
.panel-note { color: #87928c; font-size: 11px; }
.panel-body { padding: 18px; }

.trend-chart { height: 210px; display: grid; grid-template-columns: repeat(7, minmax(32px, 1fr)); align-items: end; gap: 12px; padding: 12px 4px 0; }
.trend-column { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; min-width: 0; }
.trend-value { min-height: 22px; color: var(--ink); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.trend-track { width: min(38px, 65%); height: 140px; display: flex; align-items: flex-end; background: #f0f3f0; border-radius: 3px 3px 0 0; overflow: hidden; }
.trend-bar { width: 100%; min-height: 4px; background: var(--green); transform-origin: bottom; animation: rise .55s ease-out both; }
.trend-label { margin-top: 9px; color: #7d8983; font-size: 10px; }

.composition-row + .composition-row { margin-top: 18px; }
.composition-label { display: flex; justify-content: space-between; gap: 15px; margin-bottom: 7px; color: var(--muted); font-size: 12px; }
.composition-label strong { color: var(--ink); }
.progress-rail { height: 8px; overflow: hidden; border-radius: 2px; background: #edf0ed; }
.progress-fill { height: 100%; background: var(--green); }
.progress-fill.blue { background: var(--blue); }
.mini-stats { display: grid; grid-template-columns: 1fr 1fr; margin-top: 24px; border-top: 1px solid var(--line); }
.mini-stat { padding: 17px 0 0; }
.mini-stat + .mini-stat { padding-left: 18px; border-left: 1px solid var(--line); }
.mini-stat span { display: block; color: #839089; font-size: 10px; }
.mini-stat strong { display: block; margin-top: 5px; font-size: 20px; font-variant-numeric: tabular-nums; }

.shot-list { display: grid; gap: 14px; }
.shot-row { display: grid; grid-template-columns: 92px minmax(0, 1fr) 44px; align-items: center; gap: 12px; }
.shot-label, .shot-value { font-size: 12px; }
.shot-value { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.shot-rail { height: 7px; overflow: hidden; border-radius: 2px; background: #edf0ed; }
.shot-fill { height: 100%; background: var(--blue); }
.shot-row:nth-child(2) .shot-fill { background: var(--green); }
.shot-row:nth-child(3) .shot-fill { background: var(--orange); }
.shot-row:nth-child(4) .shot-fill { background: var(--lime); }

.table-panel { margin-top: 18px; }
.admin-table { margin: 0; color: var(--ink); font-size: 12px; }
.admin-table > :not(caption) > * > * { padding: 13px 14px; border-bottom-color: #e5e9e6; vertical-align: middle; }
.admin-table thead th { padding-top: 10px; padding-bottom: 10px; color: #7b8881; background: #f8faf8; font-size: 10px; font-weight: 750; text-transform: uppercase; white-space: nowrap; }
.admin-table tbody tr:last-child td { border-bottom: 0; }
.admin-table tbody tr:hover { background: #fafcfb; }
.table-empty { padding: 42px 20px !important; color: #8a958f; text-align: center; }
.user-cell { display: flex; align-items: center; gap: 10px; min-width: 160px; }
.user-avatar { width: 34px; height: 34px; flex: 0 0 34px; display: inline-flex; align-items: center; justify-content: center; overflow: hidden; border: 1px solid var(--line); border-radius: 50%; background: var(--blue-soft); color: var(--blue); font-size: 12px; font-weight: 800; }
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-main { min-width: 0; }
.user-main strong, .user-main span { display: block; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-main strong { font-size: 12px; }
.user-main span { margin-top: 2px; color: #87938d; font-size: 10px; }
.status-badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; border-radius: 4px; font-size: 10px; font-weight: 700; }
.status-badge.vip { color: #596f06; background: #f1f7d6; border: 1px solid #dce8a7; }
.status-badge.normal { color: var(--blue); background: var(--blue-soft); border: 1px solid #cfdbf1; }

.filter-panel { margin-bottom: 18px; padding: 15px 16px; background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); }
.filter-form { display: grid; grid-template-columns: minmax(220px, 380px) auto; align-items: end; gap: 12px; }
.filter-actions { display: flex; gap: 8px; }
.form-label { color: #65736c; font-size: 11px; font-weight: 700; }
.form-control, .form-select { min-height: 40px; border-color: var(--line-strong); border-radius: 5px; color: var(--ink); font-size: 13px; }
.form-control:focus, .form-select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(36,107,74,.12); }
.btn { border-radius: 5px; font-size: 12px; font-weight: 650; }
.btn-primary { --bs-btn-bg: var(--green); --bs-btn-border-color: var(--green); --bs-btn-hover-bg: var(--green-dark); --bs-btn-hover-border-color: var(--green-dark); }
.btn-outline-secondary { --bs-btn-color: #5d6b64; --bs-btn-border-color: var(--line-strong); --bs-btn-hover-bg: #eef2ef; --bs-btn-hover-color: var(--ink); --bs-btn-hover-border-color: var(--line-strong); }
.btn-outline-primary { --bs-btn-color: var(--green); --bs-btn-border-color: #9fc3af; --bs-btn-hover-bg: var(--green); --bs-btn-hover-border-color: var(--green); }
.dropdown-menu { border-color: var(--line); border-radius: 6px; box-shadow: 0 10px 28px rgba(21,35,29,.12); font-size: 12px; }
.dropdown-item { padding: 8px 13px; }
.dropdown-item.danger { color: var(--red); }
.pagination { margin: 16px 0; }
.page-link { color: var(--green); border-color: var(--line); font-size: 12px; }
.page-item.active .page-link { background: var(--green); border-color: var(--green); }
.modal-content { border: 1px solid var(--line); border-radius: 7px; box-shadow: 0 16px 44px rgba(21,35,29,.18); }
.modal-header, .modal-footer { border-color: var(--line); }
.modal-title { font-size: 17px; font-weight: 720; }
.alert { border-radius: 5px; font-size: 13px; }
.flash-stack { margin-bottom: 16px; }

.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 42%) 1fr; background: #f2f5f2; }
.login-brand-panel { position: relative; display: flex; flex-direction: column; justify-content: space-between; padding: 48px; overflow: hidden; color: #fff; background: #14261e; }
.login-brand-panel::after { content: ""; position: absolute; width: 420px; height: 420px; right: -230px; bottom: -190px; border: 80px solid rgba(183,219,42,.11); border-radius: 50%; }
.login-brand-panel .brand-link, .login-message, .login-brand-foot { position: relative; z-index: 1; }
.login-message { max-width: 410px; }
.login-message .page-kicker { color: var(--lime); }
.login-message h1 { margin: 0; font-size: 42px; font-weight: 760; line-height: 1.2; }
.login-message p { margin: 16px 0 0; color: #b9c5bf; font-size: 14px; line-height: 1.8; }
.login-brand-foot { color: #88988f; font-size: 11px; }
.login-form-panel { display: flex; align-items: center; justify-content: center; padding: 40px; }
.login-box { width: min(420px, 100%); }
.login-box h2 { margin: 0; font-size: 27px; font-weight: 750; }
.login-box > p { margin: 8px 0 28px; color: var(--muted); font-size: 13px; }
.login-box .form-label { margin-bottom: 8px; }
.login-box .form-control { min-height: 46px; }
.login-submit { width: 100%; min-height: 46px; margin-top: 10px; }
.login-mobile-brand { display: none; margin-bottom: 30px; }

@keyframes rise { from { transform: scaleY(0); } to { transform: scaleY(1); } }

@media (max-width: 1180px) {
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .metric-item:nth-child(2) { border-right: 0; }
    .metric-item:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
    .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 920px) {
    .sidebar-toggle { display: inline-flex; }
    .admin-sidebar { transform: translateX(-100%); transition: transform .22s ease; box-shadow: 12px 0 30px rgba(21,35,29,.12); }
    .admin-content { margin-left: 0; padding: 24px 20px 36px; }
    .sidebar-backdrop { position: fixed; inset: var(--topbar) 0 0 0; z-index: 1020; border: 0; background: rgba(11,22,17,.4); }
    .sidebar-open .admin-sidebar { transform: translateX(0); }
    .sidebar-open .sidebar-backdrop { display: block; }
    .login-page { grid-template-columns: 1fr; }
    .login-brand-panel { display: none; }
    .login-mobile-brand { display: flex; }
    .login-mobile-brand .brand-name { color: var(--ink); }
    .login-mobile-brand .brand-product { color: var(--muted); }
    .login-mobile-brand .brand-divider { background: var(--line-strong); }
}

@media (max-width: 640px) {
    .admin-topbar { padding: 0 14px; }
    .brand-divider, .brand-product, .service-state { display: none; }
    .admin-content { padding: 20px 14px 32px; }
    .page-header { align-items: flex-start; flex-direction: column; gap: 8px; }
    .page-title { font-size: 24px; }
    .metric-grid { grid-template-columns: 1fr 1fr; }
    .metric-item { padding: 15px; }
    .metric-value { font-size: 25px; }
    .trend-chart { gap: 5px; }
    .trend-track { width: 70%; }
    .filter-form { grid-template-columns: 1fr; }
    .filter-actions .btn { flex: 1; }
    .shot-row { grid-template-columns: 76px minmax(0, 1fr) 34px; gap: 8px; }
    .login-form-panel { padding: 30px 22px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
