* { margin:0; padding:0; box-sizing:border-box; }
:root {
  --primary:#2563eb;
  --primary-strong:#1d4ed8;
  --primary-soft:#eff6ff;
  --teal:#0f766e;
  --success:#16a34a;
  --warning:#d97706;
  --danger:#dc2626;
  --info:#2563eb;
  --text:#111827;
  --text-secondary:#4b5563;
  --text-light:#8a94a6;
  --border:#dfe6ef;
  --border-soft:#edf2f7;
  --bg:#f3f6fa;
  --surface:#fff;
  --surface-muted:#f8fafc;
  --sidebar:#071426;
  --sidebar-2:#0b2038;
  --white:#fff;
  --sidebar-width:240px;
  --header-height:64px;
  --radius:8px;
  --radius-lg:12px;
  --shadow:0 12px 32px rgba(15,23,42,.08);
  --shadow-soft:0 6px 18px rgba(15,23,42,.06);
  --ring:0 0 0 3px rgba(37,99,235,.16);
}
html { -webkit-text-size-adjust:100%; }
body { font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",Roboto,sans-serif; color:var(--text); background:var(--bg); font-size:14px; line-height:1.55; min-height:100vh; letter-spacing:0; }
button,input,select,textarea { font:inherit; }
button { cursor:pointer; }
svg { display:block; width:1em; height:1em; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }

/* Login */
.login-page { display:flex; align-items:center; justify-content:center; min-height:100vh; padding:24px; background:radial-gradient(circle at top left,rgba(37,99,235,.16),transparent 34%), linear-gradient(135deg,#071426 0%,#0d2f4f 52%,#0f766e 100%); }
.login-card { background:rgba(255,255,255,.96); border:1px solid rgba(255,255,255,.6); border-radius:16px; padding:38px; width:420px; max-width:100%; box-shadow:0 28px 80px rgba(2,6,23,.28); }
.login-brand { display:flex; align-items:center; justify-content:center; gap:12px; margin-bottom:30px; }
.login-card h1 { font-size:25px; color:var(--text); line-height:1.1; }
.login-card .subtitle { color:var(--text-light); margin-top:4px; font-size:13px; }
.form-group { margin-bottom:18px; }
.form-group label { display:block; font-weight:650; margin-bottom:7px; font-size:13px; color:#263244; }
.form-group input,.form-group select,.form-group textarea { width:100%; min-height:42px; padding:0 12px; border:1px solid var(--border); border-radius:var(--radius); font-size:14px; transition:border-color .2s, box-shadow .2s, background .2s; outline:none; background:#fff; color:var(--text); }
.form-group input:focus,.form-group select:focus,.form-group textarea:focus { border-color:var(--primary); box-shadow:var(--ring); }
.form-group textarea { height:auto; min-height:96px; padding:10px 12px; resize:vertical; }
.login-error { background:#fef2f2; border:1px solid #fecaca; border-radius:var(--radius); padding:10px 14px; color:var(--danger); margin-bottom:16px; font-size:13px; display:none; }

/* Buttons */
.btn { display:inline-flex; align-items:center; justify-content:center; gap:7px; min-height:40px; padding:0 18px; border:1px solid transparent; border-radius:var(--radius); font-size:14px; font-weight:650; cursor:pointer; transition:background .2s,border-color .2s,color .2s,box-shadow .2s,transform .2s; text-decoration:none; white-space:nowrap; }
.btn:hover { transform:translateY(-1px); }
.btn:focus-visible,.menu-item:focus-visible,.topbar-logout:focus-visible,.feature-tile:focus-visible,.search-result-item:focus-visible { outline:none; box-shadow:var(--ring); }
.btn:disabled { opacity:.55; cursor:not-allowed; transform:none; }
.btn-primary { background:var(--primary); color:#fff; box-shadow:0 8px 18px rgba(37,99,235,.18); }
.btn-primary:hover { background:var(--primary-strong); }
.btn-success { background:var(--success); color:#fff; }
.btn-success:hover { background:#15803d; }
.btn-warning { background:var(--warning); color:#fff; }
.btn-warning:hover { background:#b45309; }
.btn-danger { background:var(--danger); color:#fff; }
.btn-danger:hover { background:#b91c1c; }
.btn-outline { background:#fff; border-color:var(--border); color:#344054; }
.btn-outline:hover { border-color:#b9c7d8; color:var(--primary); background:#f8fbff; }
.btn-block { width:100%; }
.btn-sm { min-height:34px; padding:0 12px; font-size:12px; }

/* Layout */
.admin-layout { display:flex; min-height:100vh; }
.sidebar { width:var(--sidebar-width); background:linear-gradient(180deg,var(--sidebar) 0%,var(--sidebar-2) 100%); color:#fff; position:fixed; top:0; left:0; bottom:0; display:flex; flex-direction:column; z-index:80; box-shadow:12px 0 32px rgba(2,6,23,.16); }
.sidebar-logo { min-height:76px; display:flex; align-items:center; padding:0 20px; font-size:17px; font-weight:800; border-bottom:1px solid rgba(255,255,255,.08); gap:12px; }
.sidebar-logo-mark { width:34px; height:34px; border-radius:10px; background:linear-gradient(135deg,#22c7dd,#2563eb); color:#fff; display:inline-flex; align-items:center; justify-content:center; font-size:17px; font-weight:800; flex-shrink:0; box-shadow:0 10px 24px rgba(34,199,221,.26); }
.sidebar-logo-text { line-height:1.1; }
.sidebar-logo-text small { color:#a7b7cb; font-size:12px; font-weight:600; }
.sidebar-menu { flex:1; overflow-y:auto; padding:12px 10px; }
.menu-item { width:100%; min-height:46px; display:flex; align-items:center; gap:12px; padding:0 12px; color:#b9c7d8; background:transparent; border:0; border-radius:var(--radius); font-size:14px; font-weight:650; text-align:left; transition:background .2s,color .2s,transform .2s; }
.menu-item:hover { color:#fff; background:rgba(255,255,255,.08); }
.menu-item.active { color:#fff; background:linear-gradient(135deg,rgba(37,99,235,.98),rgba(15,118,110,.9)); box-shadow:0 10px 22px rgba(37,99,235,.22); }
.menu-icon { width:22px; height:22px; display:inline-flex; align-items:center; justify-content:center; flex-shrink:0; }
.menu-icon svg { width:19px; height:19px; }
.sidebar-footer { padding:16px 20px 18px; border-top:1px solid rgba(255,255,255,.08); font-size:13px; color:#9fb0c3; }
.sidebar-footer strong { color:#fff; display:block; margin-bottom:2px; }
.main-content { margin-left:var(--sidebar-width); flex:1; min-height:100vh; min-width:0; }
.topbar { height:var(--header-height); background:rgba(255,255,255,.92); backdrop-filter:blur(14px); display:flex; align-items:center; padding:0 24px; border-bottom:1px solid rgba(223,230,239,.78); position:sticky; top:0; z-index:50; }
.topbar-title { font-size:17px; font-weight:750; color:#172033; }
.topbar-actions { margin-left:auto; display:flex; align-items:center; gap:14px; font-size:13px; color:var(--text-secondary); }
.topbar-user { min-height:30px; display:inline-flex; align-items:center; padding:0 10px; border-radius:999px; background:#f1f5f9; color:#344054; }
.topbar-logout { min-height:34px; padding:0 12px; border:1px solid #fee2e2; border-radius:var(--radius); background:#fff; color:var(--danger); font-weight:650; transition:background .2s,border-color .2s; }
.topbar-logout:hover { background:#fef2f2; border-color:#fecaca; }
.page-content { padding:24px; }

/* Stats */
.stats-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(190px,1fr)); gap:16px; margin-bottom:24px; }
.stat-card { background:var(--surface); border:1px solid var(--border-soft); border-radius:var(--radius-lg); padding:18px 20px; box-shadow:var(--shadow-soft); position:relative; overflow:hidden; min-height:108px; }
.stat-card::before { content:""; position:absolute; inset:0 auto 0 0; width:4px; background:#cbd5e1; }
.stat-card-info::before { background:var(--info); }
.stat-card-success::before { background:var(--success); }
.stat-card-warning::before { background:var(--warning); }
.stat-card-danger::before { background:var(--danger); }
.stat-card .label { font-size:13px; color:var(--text-secondary); font-weight:650; }
.stat-card .value { font-size:30px; font-weight:800; margin-top:4px; letter-spacing:0; font-variant-numeric:tabular-nums; }
.stat-card .value.success { color:var(--success); }
.stat-card .value.danger { color:var(--danger); }
.stat-card .value.warning { color:var(--warning); }
.stat-card .value.info { color:var(--info); }
.stat-foot { margin-top:6px; color:var(--text-light); font-size:12px; }

/* Card & Table */
.card { background:var(--surface); border:1px solid var(--border-soft); border-radius:var(--radius-lg); box-shadow:var(--shadow-soft); margin-bottom:24px; }
.card-header { padding:16px 20px; border-bottom:1px solid var(--border-soft); display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px; }
.card-header h3 { font-size:16px; font-weight:750; color:#172033; }
.card-caption { color:var(--text-light); font-size:13px; }
.card-body { padding:20px; overflow-x:auto; }
.toolbar-actions,.filter-bar { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.filter-bar { margin-bottom:16px; }
.filter-control { min-height:36px; padding:0 12px; border:1px solid var(--border); border-radius:var(--radius); font-size:13px; background:#fff; color:var(--text); outline:none; transition:border-color .2s,box-shadow .2s; }
.filter-control:focus { border-color:var(--primary); box-shadow:var(--ring); }
.badge { display:inline-flex; align-items:center; justify-content:center; min-width:18px; height:18px; padding:0 6px; margin-left:4px; border-radius:999px; font-size:11px; font-weight:800; line-height:1; }
.badge-danger { background:#fee2e2; color:#991b1b; }
table { width:100%; border-collapse:separate; border-spacing:0; }
table th,table td { padding:13px 12px; text-align:left; border-bottom:1px solid var(--border-soft); font-size:13px; vertical-align:middle; }
table th { background:#f8fafc; font-weight:750; color:#526071; white-space:nowrap; position:sticky; top:0; z-index:1; }
table tr:hover td { background:#f8fbff; }
table tr:last-child td { border-bottom:0; }

/* Tags */
.tag { display:inline-flex; align-items:center; justify-content:center; min-height:24px; padding:2px 10px; border-radius:999px; font-size:12px; font-weight:700; }
.tag-success { background:#dcfce7; color:#166534; }
.tag-danger { background:#fee2e2; color:#991b1b; }
.tag-warning { background:#fef3c7; color:#92400e; }
.tag-default { background:#eef2f7; color:#526071; }

/* Modal */
.modal-overlay { display:none; position:fixed; top:0; left:0; right:0; bottom:0; background:rgba(15,23,42,.52); z-index:1000; align-items:center; justify-content:center; padding:20px; }
.modal-overlay.active { display:flex; }
.modal { background:#fff; border-radius:14px; width:640px; max-width:90vw; max-height:85vh; display:flex; flex-direction:column; box-shadow:0 28px 90px rgba(2,6,23,.28); border:1px solid rgba(255,255,255,.4); }
.modal-sm { width:420px; }
.modal-header { padding:16px 20px; border-bottom:1px solid var(--border-soft); display:flex; align-items:center; justify-content:space-between; }
.modal-header h3 { font-size:16px; color:#172033; }
.modal-close,.btn-close { width:36px; height:36px; display:flex; align-items:center; justify-content:center; border:none; background:#f8fafc; cursor:pointer; font-size:20px; color:var(--text-secondary); border-radius:var(--radius); }
.modal-close:hover,.btn-close:hover { background:#eef2f7; }
.modal-body { padding:20px; overflow-y:auto; flex:1; }
.modal-footer { padding:14px 20px; border-top:1px solid var(--border-soft); display:flex; justify-content:flex-end; gap:8px; }
.form-row { display:grid; grid-template-columns:1fr 1fr; gap:16px; }

/* Empty & Loading */
.empty-state { text-align:center; padding:56px 20px; color:var(--text-light); }
.empty-state .icon { width:48px; height:48px; margin:0 auto 14px; border-radius:14px; background:#eef2f7; position:relative; }
.empty-icon::before { content:""; position:absolute; left:13px; top:17px; width:22px; height:14px; border:2px solid #94a3b8; border-radius:3px; }
.error-icon { background:#fef2f2 !important; }
.error-icon::before,.error-icon::after { content:""; position:absolute; left:23px; top:12px; width:2px; height:24px; background:#dc2626; border-radius:99px; }
.error-icon::after { transform:rotate(90deg); }
.loading { display:flex; align-items:center; justify-content:center; padding:60px; }
.spinner { width:34px; height:34px; border:3px solid #dbe4ef; border-top-color:var(--primary); border-radius:50%; animation:spin .7s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }

/* Toast */
.toast-container { position:fixed; top:20px; right:20px; z-index:2000; display:flex; flex-direction:column; gap:8px; }
.toast { padding:12px 18px; border-radius:var(--radius); color:#fff; font-size:14px; font-weight:650; box-shadow:var(--shadow); animation:slideIn .24s ease; }
.toast-success { background:var(--success); }
.toast-error { background:var(--danger); }
.toast-warning { background:var(--warning); color:#fff; }
.toast-info { background:var(--info); }
@keyframes slideIn { from { transform:translateX(18px); opacity:0; } to { transform:translateX(0); opacity:1; } }

/* Dashboard */
.dashboard-shell { display:flex; flex-direction:column; gap:24px; }
.dashboard-top { display:flex; flex-direction:column; gap:14px; }
.dashboard-hero { background:linear-gradient(135deg,#fff 0%,#f8fbff 58%,#effaf8 100%); border:1px solid #e3ebf5; border-radius:16px; padding:22px; box-shadow:var(--shadow); display:grid; grid-template-columns:minmax(0,1fr) minmax(320px,42%); gap:20px; align-items:end; }
.dashboard-hero-copy h2 { font-size:24px; margin:8px 0 8px; color:#0f172a; line-height:1.25; letter-spacing:0; }
.dashboard-hero-copy p { color:var(--text-secondary); font-size:14px; max-width:680px; }
.dashboard-kicker { display:inline-flex; align-items:center; min-height:26px; padding:0 10px; border-radius:999px; background:#eaf3ff; color:var(--primary); font-size:12px; font-weight:750; }
.hero-insights { display:flex; flex-wrap:wrap; gap:10px; margin-top:16px; }
.hero-insights div { min-width:106px; padding:10px 12px; border:1px solid #e3ebf5; border-radius:var(--radius); background:rgba(255,255,255,.72); }
.hero-insights span { display:block; color:#0f172a; font-size:20px; font-weight:850; font-variant-numeric:tabular-nums; }
.hero-insights small { display:block; color:var(--text-light); font-size:12px; margin-top:1px; }
.dashboard-search { display:flex; gap:10px; align-items:center; position:relative; }
.dashboard-search-icon { position:absolute; left:13px; color:#7b8797; pointer-events:none; }
.dashboard-search-icon svg { width:18px; height:18px; }
.dashboard-search input { flex:1; height:44px; min-width:0; border:1px solid #cfdae8; border-radius:var(--radius); padding:0 14px 0 40px; font-size:14px; outline:none; background:#fff; color:var(--text); transition:border-color .2s,box-shadow .2s; }
.dashboard-search input:focus { border-color:var(--primary); box-shadow:var(--ring); }
.dashboard-search-results { display:none; background:#fff; border:1px solid #e3ebf5; border-radius:var(--radius-lg); box-shadow:var(--shadow); overflow:hidden; }
.search-result-list { display:flex; flex-direction:column; }
.search-result-item { border:none; background:#fff; display:flex; gap:12px; align-items:flex-start; padding:14px 16px; text-align:left; cursor:pointer; border-bottom:1px solid #f0f4f8; transition:background .2s; }
.search-result-item:hover { background:#f8fbff; }
.search-result-item:last-child { border-bottom:none; }
.search-result-tag { display:inline-flex; align-items:center; justify-content:center; min-width:42px; height:24px; padding:0 10px; border-radius:999px; background:#eaf3ff; color:var(--primary); font-size:12px; font-weight:750; flex-shrink:0; }
.search-result-main { display:flex; flex-direction:column; min-width:0; }
.search-result-title { font-size:14px; font-weight:750; color:#172033; }
.search-result-desc { font-size:12px; color:var(--text-light); margin-top:4px; }
.search-empty { padding:18px; text-align:center; color:var(--text-light); }
.dashboard-stats { margin-top:0; }
.dashboard-card { overflow:hidden; }
.feature-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; }
.feature-tile { border:1px solid var(--border-soft); background:#fff; border-radius:var(--radius-lg); padding:16px; display:flex; align-items:center; gap:14px; box-shadow:0 2px 10px rgba(15,23,42,.035); cursor:pointer; text-align:left; transition:transform .18s ease,box-shadow .18s ease,border-color .18s ease; position:relative; min-height:88px; }
.feature-tile:hover { transform:translateY(-2px); box-shadow:0 12px 26px rgba(15,23,42,.08); border-color:#d8e3f0; }
.feature-icon { width:46px; height:46px; border-radius:var(--radius); display:inline-flex; align-items:center; justify-content:center; color:#fff; font-size:22px; font-weight:700; flex-shrink:0; box-shadow:0 10px 18px rgba(15,23,42,.1); }
.feature-icon svg { width:23px; height:23px; }
.feature-body { display:flex; flex-direction:column; min-width:0; }
.feature-title { font-size:15px; font-weight:800; color:#172033; }
.feature-desc { font-size:12px; color:var(--text-light); margin-top:4px; line-height:1.35; }
.feature-blue .feature-icon { background:linear-gradient(135deg,#3b82f6,#2563eb); }
.feature-teal .feature-icon { background:linear-gradient(135deg,#14b8a6,#0f766e); }
.feature-orange .feature-icon { background:linear-gradient(135deg,#f59e0b,#d97706); }
.feature-green .feature-icon { background:linear-gradient(135deg,#22c55e,#16a34a); }
.feature-indigo .feature-icon { background:linear-gradient(135deg,#6366f1,#4338ca); }
.feature-rose .feature-icon { background:linear-gradient(135deg,#fb7185,#e11d48); }
.feature-cyan .feature-icon { background:linear-gradient(135deg,#06b6d4,#0891b2); }
.feature-slate .feature-icon { background:linear-gradient(135deg,#64748b,#334155); }
.dashboard-grid-2 { display:grid; grid-template-columns:minmax(0,1.35fr) minmax(320px,.95fr); gap:24px; }
.mini-metrics { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
.mini-metric { background:#f8fafc; border:1px solid #e7edf5; border-radius:var(--radius); padding:14px; }
.mini-metric .label { font-size:12px; color:var(--text-light); font-weight:650; }
.mini-metric .value { font-size:22px; font-weight:800; margin-top:6px; font-variant-numeric:tabular-nums; }
.mini-metric .value.success { color:var(--success); }
.mini-metric .value.danger { color:var(--danger); }
.section-caption { font-size:13px; font-weight:750; color:#172033; margin-bottom:10px; }
.single-profit-list { display:flex; flex-direction:column; gap:10px; }
.single-profit-item { display:flex; align-items:center; justify-content:space-between; gap:12px; background:#fff; border:1px solid #e7edf5; border-radius:var(--radius); padding:12px 14px; cursor:pointer; transition:background .2s,border-color .2s; }
.single-profit-item:hover { background:#f8fbff; border-color:#d8e3f0; }
.single-profit-title { font-size:14px; font-weight:750; color:#172033; }
.single-profit-desc { font-size:12px; color:var(--text-light); margin-top:4px; }
.single-profit-value { font-size:14px; font-weight:800; white-space:nowrap; font-variant-numeric:tabular-nums; }
.profit-positive { color:var(--success); }
.profit-negative { color:var(--danger); }

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

/* Responsive */
@media (max-width:1024px) {
  .dashboard-hero { grid-template-columns:1fr; align-items:start; }
  .feature-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .dashboard-grid-2 { grid-template-columns:1fr; }
}
@media (max-width:768px) {
  :root { --header-height:58px; }
  .sidebar { transform:translateX(-100%); transition:transform .2s ease; }
  .sidebar.open { transform:translateX(0); }
  .main-content { margin-left:0; }
  .page-content { padding:16px; }
  .topbar { padding:0 16px; }
  .topbar-user { display:none; }
  .stats-grid { grid-template-columns:1fr 1fr; gap:12px; }
  .form-row { grid-template-columns:1fr; }
  .mini-metrics { grid-template-columns:1fr; }
  .dashboard-search { flex-direction:column; align-items:stretch; }
  .dashboard-search-icon { top:13px; }
  .dashboard-hero { padding:18px; }
  .dashboard-hero-copy h2 { font-size:21px; }
  .hero-insights div { flex:1; min-width:96px; }
  .modal { max-width:calc(100vw - 24px); }
}
@media (max-width:520px) {
  .stats-grid,.feature-grid { grid-template-columns:1fr; }
  .card-header { align-items:flex-start; }
  .login-card { padding:28px 22px; }
}

/* Pagination */
.pagination { display:flex; align-items:center; gap:8px; margin-top:16px; flex-wrap:wrap; }
.page-info { font-size:13px; color:var(--text-secondary); margin-right:8px; }
