:root {
  --bg-dark: #0a0e27;
  --bg-card: rgba(15, 23, 42, 0.8);
  --bg-card-solid: #0f172a;
  --border-glow: rgba(56, 189, 248, 0.15);
  --accent-blue: #38bdf8;
  --accent-cyan: #22d3ee;
  --accent-purple: #a78bfa;
  --accent-pink: #f472b6;
  --accent-green: #4ade80;
  --accent-orange: #fb923c;
  --accent-red: #f87171;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --gradient-blue: linear-gradient(135deg, #38bdf8 0%, #818cf8 100%);
  --gradient-cyan: linear-gradient(135deg, #22d3ee 0%, #38bdf8 100%);
  --gradient-purple: linear-gradient(135deg, #a78bfa 0%, #c084fc 100%);
  --gradient-dark: linear-gradient(180deg, #0a0e27 0%, #1e293b 100%);
  --shadow-glow: 0 0 20px rgba(56, 189, 248, 0.1);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; background: var(--bg-dark); color: var(--text-primary); font-size: 14px; }

/* ========== Layout ========== */
.admin-layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: 240px; background: linear-gradient(180deg, #0f172a 0%, #020617 100%);
  color: #fff; flex-shrink: 0; display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
  border-right: 1px solid rgba(56, 189, 248, 0.08);
}
.sidebar-logo {
  padding: 20px; text-align: center; font-size: 16px; font-weight: 700;
  border-bottom: 1px solid rgba(56, 189, 248, 0.1);
  background: rgba(56, 189, 248, 0.05);
  letter-spacing: 2px; display: flex; align-items: center; justify-content: center; gap: 10px;
}
.logo-icon {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--accent-cyan);
  text-shadow: 0 0 10px rgba(34,211,238,.5);
}
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(56,189,248,.2); border-radius: 3px; }

.nav-group-title {
  padding: 16px 24px 8px; font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 2px; font-weight: 500;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 20px; margin: 2px 10px; border-radius: 8px;
  color: var(--text-secondary); text-decoration: none; cursor: pointer;
  transition: all .25s ease; font-size: 13.5px; position: relative;
}
.nav-item:hover { color: #fff; background: rgba(56, 189, 248, 0.08); }
.nav-item.active {
  color: #fff; background: rgba(56, 189, 248, 0.15);
  box-shadow: inset 3px 0 0 var(--accent-blue), 0 0 12px rgba(56,189,248,.1);
}
.nav-item .nav-icon { font-size: 16px; width: 20px; text-align: center; }
.nav-item .nav-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent-cyan);
  position: absolute; right: 16px; opacity: 0; transition: opacity .2s;
}
.nav-item:hover .nav-dot { opacity: 1; }

.sidebar-footer {
  padding: 12px 20px; border-top: 1px solid rgba(56,189,248,.08);
}
.sidebar-version { font-size: 10px; color: var(--text-muted); margin-bottom: 8px; letter-spacing: 1px; }
.sidebar-footer a {
  color: var(--text-muted); text-decoration: none; cursor: pointer;
  font-size: 13px; display: flex; align-items: center; gap: 6px;
  transition: color .2s;
}
.sidebar-footer a:hover { color: var(--accent-cyan); }

/* Main Content */
.main-content { margin-left: 240px; flex: 1; min-height: 100vh; background: var(--bg-dark); }
.page-header {
  background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(12px);
  padding: 18px 28px; border-bottom: 1px solid var(--border-glow);
  display: flex; align-items: center; justify-content: space-between;
}
.page-header h2 { font-size: 17px; font-weight: 600; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.page-header h2::before { content: ''; width: 4px; height: 18px; background: var(--gradient-blue); border-radius: 2px; }
.page-body { padding: 24px 28px; }

/* ========== Stat Cards ========== */
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border-glow);
  border-radius: 12px; padding: 20px; position: relative; overflow: hidden;
  transition: all .3s ease; display: flex; align-items: center; gap: 16px;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  border-radius: 12px 12px 0 0;
}
.stat-card:nth-child(1)::before { background: var(--gradient-blue); }
.stat-card:nth-child(2)::before { background: var(--gradient-cyan); }
.stat-card:nth-child(3)::before { background: linear-gradient(90deg, #4ade80, #22d3ee); }
.stat-card:nth-child(4)::before { background: var(--gradient-purple); }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-glow); border-color: rgba(56,189,248,.3); }
.stat-card .card-icon { flex-shrink: 0; }
.stat-card .card-info { flex: 1; min-width: 0; }
.stat-card .label { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; letter-spacing: 0.5px; }
.stat-card .value { font-size: 28px; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat-card .sub-label { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.stat-card .value.blue { color: var(--accent-blue); }
.stat-card .value.green { color: var(--accent-green); }
.stat-card .value.orange { color: var(--accent-orange); }
.stat-card .value.red { color: var(--accent-red); }
.stat-card .value.cyan { color: var(--accent-cyan); }
.stat-card .value.purple { color: var(--accent-purple); }
.icon-circle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 12px; font-size: 18px; font-weight: 700;
}
.icon-circle.blue { background: rgba(56,189,248,.12); color: var(--accent-blue); border: 1px solid rgba(56,189,248,.2); }
.icon-circle.cyan { background: rgba(34,211,238,.12); color: var(--accent-cyan); border: 1px solid rgba(34,211,238,.2); }
.icon-circle.green { background: rgba(74,222,128,.12); color: var(--accent-green); border: 1px solid rgba(74,222,128,.2); }
.icon-circle.purple { background: rgba(167,139,250,.12); color: var(--accent-purple); border: 1px solid rgba(167,139,250,.2); }
.icon-circle.orange { background: rgba(251,146,60,.12); color: var(--accent-orange); border: 1px solid rgba(251,146,60,.2); }
.icon-circle.red { background: rgba(248,113,113,.12); color: var(--accent-red); border: 1px solid rgba(248,113,113,.2); }

/* ========== Card ========== */
.card {
  background: var(--bg-card); border: 1px solid var(--border-glow);
  border-radius: 12px; padding: 20px 24px; margin-bottom: 20px;
  transition: border-color .3s;
}
.card:hover { border-color: rgba(56,189,248,.25); }
.card-title {
  font-size: 15px; font-weight: 600; color: var(--text-primary);
  margin-bottom: 16px; display: flex; align-items: center; gap: 8px;
}
.card-title::before { content: ''; width: 3px; height: 14px; background: var(--accent-blue); border-radius: 2px; }

/* ========== Table ========== */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 12px; text-align: left; border-bottom: 1px solid rgba(56,189,248,.06); font-size: 13px; }
th {
  background: rgba(56,189,248,.04); font-weight: 600; color: var(--text-secondary);
  white-space: nowrap; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px;
}
tr { transition: background .2s; }
tr:hover td { background: rgba(56,189,248,.04); }
td { color: var(--text-secondary); }
td img { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border-glow); }
.table-wrap { overflow-x: auto; }

/* ========== Buttons ========== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  padding: 6px 16px; border: 1px solid var(--border-glow); border-radius: 6px;
  background: rgba(15,23,42,.6); color: var(--text-secondary); cursor: pointer;
  font-size: 13px; transition: all .25s; line-height: 1.5; font-family: inherit;
}
.btn:hover { border-color: var(--accent-blue); color: var(--accent-cyan); background: rgba(56,189,248,.08); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-sm { padding: 3px 10px; font-size: 12px; }
.btn-primary { background: var(--gradient-blue); color: #fff; border-color: transparent; font-weight: 500; }
.btn-primary:hover { box-shadow: 0 0 16px rgba(56,189,248,.3); color: #fff; }
.btn-danger { background: rgba(248,113,113,.15); color: var(--accent-red); border-color: rgba(248,113,113,.3); }
.btn-danger:hover { background: rgba(248,113,113,.25); box-shadow: 0 0 16px rgba(248,113,113,.2); }
.btn-warning { background: rgba(251,146,60,.15); color: var(--accent-orange); border-color: rgba(251,146,60,.3); }
.btn-warning:hover { background: rgba(251,146,60,.25); box-shadow: 0 0 16px rgba(251,146,60,.2); }
.btn-success { background: rgba(74,222,128,.15); color: var(--accent-green); border-color: rgba(74,222,128,.3); }
.btn-success:hover { background: rgba(74,222,128,.25); box-shadow: 0 0 16px rgba(74,222,128,.2); }
.btn-cancel { background: transparent; border-color: var(--border-glow); }
.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }

/* ========== Badges ========== */
.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.badge-success { background: rgba(74,222,128,.12); color: var(--accent-green); border: 1px solid rgba(74,222,128,.25); }
.badge-danger { background: rgba(248,113,113,.12); color: var(--accent-red); border: 1px solid rgba(248,113,113,.25); }
.badge-warning { background: rgba(251,146,60,.12); color: var(--accent-orange); border: 1px solid rgba(251,146,60,.25); }
.badge-default { background: rgba(100,116,139,.1); color: var(--text-muted); border: 1px solid rgba(100,116,139,.2); }

/* ========== Forms ========== */
.form-row { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.form-group input, .form-group select, .form-group textarea {
  padding: 8px 14px; border: 1px solid var(--border-glow); border-radius: 6px;
  font-size: 13px; outline: none; background: rgba(15,23,42,.4);
  color: var(--text-primary); transition: all .25s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--accent-blue); box-shadow: 0 0 0 3px rgba(56,189,248,.15);
}
input, select, textarea { font-family: inherit; }

/* ========== Pagination ========== */
.pagination { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border-glow); }
.pagination-info { color: var(--text-muted); font-size: 13px; }
.pagination-btns { display: flex; gap: 4px; }
.page-ellipsis { padding: 2px 8px; color: var(--text-muted); }

/* ========== Tabs ========== */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--border-glow); padding-bottom: 0; }
.tab {
  padding: 10px 20px; cursor: pointer; color: var(--text-muted); font-size: 13px;
  border: 1px solid transparent; border-bottom: none; border-radius: 8px 8px 0 0;
  transition: all .25s; background: transparent;
}
.tab:hover { color: var(--accent-cyan); background: rgba(56,189,248,.06); }
.tab.active { color: var(--accent-cyan); background: rgba(56,189,248,.1); border-color: rgba(56,189,248,.2); font-weight: 600; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ========== Modal ========== */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(4px); z-index: 1000; display: flex; align-items: center; justify-content: center; animation: fadeIn .2s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-card-solid); border: 1px solid var(--border-glow);
  border-radius: 16px; width: 480px; max-width: 90vw; max-height: 80vh;
  overflow-y: auto; box-shadow: 0 8px 32px rgba(0,0,0,.4), var(--shadow-glow);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid var(--border-glow); }
.modal-header h3 { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-muted); padding: 0 4px; line-height: 1; }
.modal-close:hover { color: var(--accent-red); }
.modal-body { padding: 24px; }
.modal-footer { padding: 12px 24px; border-top: 1px solid var(--border-glow); display: flex; justify-content: flex-end; gap: 8px; }

/* ========== Bar Chart ========== */
.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding: 0 4px; }
.bar-item { flex: 1; display: flex; flex-direction: column; align-items: center; min-width: 0; }
.bar-item .bar {
  width: 100%; max-width: 40px; border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, var(--accent-blue) 0%, var(--accent-cyan) 100%);
  transition: height .5s cubic-bezier(.4,0,.2,1); box-shadow: 0 0 8px rgba(56,189,248,.3);
}
.bar-item .bar-label { font-size: 10px; color: var(--text-muted); margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.bar-item .bar-value { font-size: 11px; color: var(--accent-cyan); margin-bottom: 2px; font-weight: 500; }

/* ========== Login ========== */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg-dark); position: relative; overflow: hidden; }
.login-page::before, .login-page::after {
  content: ''; position: absolute; border-radius: 50%; opacity: .06;
  animation: float 8s ease-in-out infinite;
}
.login-page::before { width: 400px; height: 400px; background: var(--accent-blue); top: -100px; right: -100px; }
.login-page::after { width: 300px; height: 300px; background: var(--accent-purple); bottom: -80px; left: -80px; animation-delay: -4s; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-30px); } }
.login-box {
  background: rgba(15,23,42,.85); backdrop-filter: blur(20px);
  border: 1px solid var(--border-glow); border-radius: 20px;
  padding: 44px 40px 36px; width: 400px;
  box-shadow: 0 8px 32px rgba(0,0,0,.3), var(--shadow-glow);
  position: relative; z-index: 1;
}
.login-logo { text-align: center; margin-bottom: 12px; }
.login-logo-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; border-radius: 16px; font-size: 26px;
  background: rgba(34,211,238,.1); border: 1px solid rgba(34,211,238,.2);
  color: var(--accent-cyan); text-shadow: 0 0 16px rgba(34,211,238,.5);
}
.login-box h2 { text-align: center; margin-bottom: 4px; font-size: 22px; font-weight: 700; color: var(--text-primary); letter-spacing: 1px; }
.login-box .subtitle { text-align: center; color: var(--text-muted); margin-bottom: 32px; font-size: 12px; letter-spacing: 2px; }
.login-box .form-group { margin-bottom: 18px; }
.login-box .form-group input {
  width: 100%; padding: 12px 16px; font-size: 14px; letter-spacing: .5px;
  background: rgba(15,23,42,.4); border-color: var(--border-glow);
}
.login-box .btn { width: 100%; padding: 12px; font-size: 15px; font-weight: 600; letter-spacing: 1px; }
.login-hint { text-align: center; color: var(--text-muted); font-size: 11px; margin-top: 20px; letter-spacing: .5px; }

/* ========== Empty & Loading ========== */
.empty-text { text-align: center; color: var(--text-muted); padding: 40px 0; font-size: 14px; }
.loading { text-align: center; padding: 40px; color: var(--accent-blue); }
.loading::after { content: '...'; animation: dots 1.5s infinite; }
@keyframes dots { 0%,20% { content: '.'; } 40% { content: '..'; } 60%,100% { content: '...'; } }

/* ========== Grid ========== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

/* ========== Section ========== */
.section { display: none; }
.section.active { display: block; animation: pageIn .3s ease; }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ========== Config ========== */
.config-form { max-width: 500px; }
.config-form .form-group { margin-bottom: 16px; }
.config-form .form-group input, .config-form .form-group select { width: 200px; }
.config-form .btn { margin-top: 8px; }

/* ========== Trend Row ========== */
.trend-row { display: flex; align-items: center; gap: 20px; padding: 12px 0; border-bottom: 1px solid var(--border-glow); }
.trend-row:last-child { border-bottom: none; }
.trend-date { width: 90px; font-size: 12px; color: var(--text-muted); flex-shrink: 0; }
.trend-bar-wrap { flex: 1; height: 8px; background: rgba(56,189,248,.06); border-radius: 4px; overflow: hidden; }
.trend-bar { height: 100%; border-radius: 4px; background: var(--gradient-blue); transition: width .5s; min-width: 2px; }
.trend-value { width: 60px; text-align: right; font-size: 13px; color: var(--accent-cyan); font-weight: 600; flex-shrink: 0; }

/* ========== Quick Info ========== */
.quick-info {
  display: flex; gap: 12px; margin-bottom: 24px;
}
.quick-tag {
  padding: 6px 14px; border-radius: 20px; font-size: 12px; font-weight: 500;
  border: 1px solid var(--border-glow); background: rgba(15,23,42,.6);
  color: var(--text-secondary); display: flex; align-items: center; gap: 6px;
}
.quick-tag .tag-dot { width: 6px; height: 6px; border-radius: 50%; }
.quick-tag.blue .tag-dot { background: var(--accent-blue); }
.quick-tag.green .tag-dot { background: var(--accent-green); }
.quick-tag.orange .tag-dot { background: var(--accent-orange); }
.quick-tag.red .tag-dot { background: var(--accent-red); }

/* ========== Responsive ========== */
@media (max-width: 1024px) {
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { width: 0; transform: translateX(-100%); }
  .sidebar.open { width: 220px; transform: translateX(0); }
  .main-content { margin-left: 0; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .page-body { padding: 16px; }
}
