/* 全局样式 (Style toàn cục admin) */
*{box-sizing:border-box}
body{margin:0;font-family:system-ui,-apple-system,sans-serif;background:#f1f5f9;color:#1e293b;font-size:14px}
.app{display:flex;min-height:100vh}
.sidebar{width:240px;background:#0f172a;color:#cbd5e1;padding:20px 0;position:sticky;top:0;height:100vh;overflow-y:auto}
.sidebar::-webkit-scrollbar{width:6px}
.sidebar::-webkit-scrollbar-thumb{background:#334155;border-radius:3px}
.sidebar .logo{font-size:18px;font-weight:700;color:#fff;padding:0 24px 20px;border-bottom:1px solid #1e293b;margin-bottom:12px}
.sidebar nav a{display:block;padding:10px 24px;color:#cbd5e1;text-decoration:none;font-size:13.5px;border-left:3px solid transparent;transition:.15s}
.sidebar nav a:hover{background:#1e293b;color:#fff}
.sidebar nav a.active{background:#1e293b;color:#3b82f6;border-left-color:#3b82f6}
.sidebar nav a.logout{margin-top:20px;color:#ef4444;border-top:1px solid #1e293b}
.nav-group{padding:16px 24px 6px;font-size:10px;color:#64748b;text-transform:uppercase;letter-spacing:1px;font-weight:700}
.content{flex:1;display:flex;flex-direction:column;min-width:0}
.topbar{background:#fff;padding:14px 28px;border-bottom:1px solid #e2e8f0;display:flex;justify-content:space-between;align-items:center;position:sticky;top:0;z-index:10}
.topbar h1{margin:0;font-size:20px;font-weight:600}
.topbar .user{font-size:13px;color:#64748b}
.topbar .role{background:#3b82f6;color:#fff;padding:2px 8px;border-radius:4px;font-size:11px;margin-left:6px}
.main-inner{padding:24px;flex:1}
.card{background:#fff;border-radius:10px;padding:20px;box-shadow:0 1px 3px rgba(0,0,0,.05);margin-bottom:20px}
.card h2{margin:0 0 16px;font-size:16px;font-weight:600}
.grid{display:grid;gap:16px}
.grid-3{grid-template-columns:repeat(auto-fit,minmax(180px,1fr))}
.stat{background:#fff;padding:20px;border-radius:10px;border-left:4px solid #3b82f6;transition:.2s}
.stat:hover{transform:translateY(-2px);box-shadow:0 4px 12px rgba(0,0,0,.08)}
.stat .n{font-size:26px;font-weight:700;color:#1e293b;line-height:1.1}
.stat .l{font-size:12px;color:#64748b;margin-top:6px}
table{width:100%;border-collapse:collapse;background:#fff;border-radius:10px;overflow:hidden}
th,td{padding:10px 14px;text-align:left;border-bottom:1px solid #e2e8f0;font-size:13px}
th{background:#f8fafc;font-weight:600;color:#475569;font-size:12px;text-transform:uppercase;letter-spacing:.5px}
tr:hover{background:#f8fafc}
.btn{display:inline-block;padding:8px 16px;background:#3b82f6;color:#fff;border:0;border-radius:6px;text-decoration:none;font-size:13px;cursor:pointer;font-weight:500;transition:.15s}
.btn:hover{background:#2563eb;transform:translateY(-1px)}
.btn-danger{background:#ef4444}
.btn-danger:hover{background:#dc2626}
.btn-success{background:#10b981}
.btn-success:hover{background:#059669}
.btn-sm{padding:4px 10px;font-size:12px}
input[type=text],input[type=email],input[type=password],input[type=url],input[type=number],input[type=date],input[type=datetime-local],input[type=search],input:not([type]),select,textarea{width:100%;padding:9px 12px;border:1px solid #cbd5e1;border-radius:6px;font-size:13.5px;font-family:inherit;transition:.15s}
input:focus,select:focus,textarea:focus{outline:none;border-color:#3b82f6;box-shadow:0 0 0 3px rgba(59,130,246,.1)}
textarea{resize:vertical;min-height:80px}
label{display:block;margin:12px 0 5px;font-size:12.5px;font-weight:500;color:#475569}
label small{color:#94a3b8;font-weight:normal}
.form-row{display:grid;grid-template-columns:1fr 1fr;gap:16px}
.toolbar{display:flex;justify-content:space-between;align-items:center;margin-bottom:20px;flex-wrap:wrap;gap:10px}
.badge{display:inline-block;padding:2px 8px;border-radius:4px;font-size:11px;font-weight:600}
.badge-green{background:#dcfce7;color:#166534}
.badge-red{background:#fee2e2;color:#991b1b}
.alert{padding:12px 16px;border-radius:6px;margin-bottom:16px;font-size:14px}
.alert-success{background:#dcfce7;color:#166534;border-left:4px solid #10b981}
.alert-error{background:#fee2e2;color:#991b1b;border-left:4px solid #ef4444}
.tabs{display:flex;gap:4px;border-bottom:2px solid #e2e8f0;margin-bottom:20px;overflow-x:auto}
.tabs a{padding:10px 16px;text-decoration:none;color:#64748b;border-bottom:2px solid transparent;margin-bottom:-2px;font-size:13.5px;white-space:nowrap}
.tabs a:hover{color:#3b82f6}
.tabs a.active{color:#3b82f6;border-color:#3b82f6;font-weight:500}
code{background:#f1f5f9;padding:2px 6px;border-radius:3px;font-size:12px;color:#e11d48}
.pulse{animation:pulse 1.5s infinite}
@keyframes pulse{0%,100%{opacity:1}50%{opacity:
0.3}}
@media (max-width:768px){
  .sidebar{position:fixed;transform:translateX(-100%);z-index:100;transition:transform .3s}
  .sidebar.open{transform:translateX(0)}
  .form-row{grid-template-columns:1fr}
  .main-inner{padding:16px}
}

/* ===================================== */
/* 顶部更新徽章 */
/* ===================================== */
.update-badge {
  display: inline-block;
  padding: 6px 12px;
  background: linear-gradient(135deg, #ffc107, #ff9800);
  color: #fff;
  border-radius: 20px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  margin-left: 16px;
  box-shadow: 0 2px 8px rgba(255,152,0,0.4);
  animation: badgePulse 2s infinite;
  transition: transform 0.2s;
}

.update-badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255,152,0,0.6);
}

.update-badge.critical {
  background: linear-gradient(135deg, #dc3545, #c82333);
  box-shadow: 0 2px 8px rgba(220,53,69,0.5);
}

@keyframes badgePulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.75; }
}

/* ===================================== */
/* 
弹出式更新通知 */
/* ===================================== */
.update-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 380px;
  background: linear-gradient(135deg, #ffffff 0%, #fffbf0 100%);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2), 0 0 0 1px rgba(255,193,7,0.3);
  padding: 20px;
  display: flex;
  gap: 14px;
  z-index: 9999;
  border-left: 5px solid #ffc107;
  transform: translateX(120%);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.update-toast.show {
  transform: translateX(0);
}

.update-toast.critical {
  background: linear-gradient(135deg, #ffffff 0%, #ffebee 100%);
  border-left-color: #dc3545;
  box-shadow: 0 10px 40px rgba(220,53,69,0.3), 0 0 0 1px rgba(220,53,69,0.3);
  animation: criticalPulse 2s infinite;
}

@keyframes criticalPulse {
  0%, 100% { box-shadow: 0 10px 40px rgba(220,53,69,0.3), 0 0 0 1px rgba(220,53,69,0.3); }
  50%      { box-shadow: 0 10px 50px rgba(220,53,69,0.6), 0 0 0 3px rgba(220,53,69,0.4); }
}

/* 通知图标 */
.toast-icon {
  font-size: 36px;
  line-height: 1;
  animation: iconWiggle 1s ease infinite;
  flex-shrink: 0;
}

@keyframes iconWiggle {
  0%, 100% { transform: rotate(0deg); }
  25%      { transform: rotate(-10deg); }
  75%      { transform: rotate(10deg); }
}

/* 通知内容 */
.toast-body {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-weight: 700;
  font-size: 16px;
  color: #333;
  margin-bottom: 4px;
}

.update-toast.critical .toast-title {
  color: #dc3545;
}

.toast-version {
  font-size: 13px;
  color: #ff9800;
  font-weight: 600;
  margin-bottom: 8px;
}

.update-toast.critical .toast-version {
  color: #dc3545;
}

.toast-message {
  font-size: 13px;
  color: #666;
  line-height: 1.5;
  margin-bottom: 12px;
  word-wrap: break-word;
}

/* 操作按钮区 */
.toast-actions {
  display: flex;
  gap: 8px;
}

.toast-btn {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid #ddd;
  background: #f5f5f5;
  color: #555;
  text-decoration: none;
  transition: all 0.2s;
  font-family: inherit;
  display: inline-block;
}

.toast-btn:hover {
  background: #e9e9e9;
  transform: translateY(-1px);
  color: #333;
}

.toast-btn-primary {
  background: linear-gradient(135deg, #ffc107, #ff9800);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
}

.update-toast.critical .toast-btn-primary {
  background: linear-gradient(135deg, #dc3545, #c82333);
}

.toast-btn-primary:hover {
  background: linear-gradient(135deg, #ffb300, #fb8c00);
  color: #fff;
  box-shadow: 0 4px 12px rgba(255,152,0,0.4);
}

.update-toast.critical .toast-btn-primary:hover {
  background: linear-gradient(135deg, #c82333, #a71d2a);
  box-shadow: 0 4px 12px rgba(220,53,69,0.5);
}

/* 关闭按钮 */
.toast-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  font-size: 22px;
  color: #999;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  line-height: 1;
  transition: color 0.2s;
}

.toast-close:hover {
  color: #333;
}

/* 移动端响应式 */
@media (max-width: 480px) {
  .update-toast {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
  }
}