/* 全局样式 */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif; background: #f5f6fa; color: #333; }
a { text-decoration: none; color: #0057ff; }
button { cursor: pointer; border: none; border-radius: 6px; padding: 8px 16px; font-size: 14px; transition: 0.2s; }
.btn-primary { background: #0057ff; color: #fff; }
.btn-primary:hover { background: #0044cc; }
.btn-danger { background: #e74c3c; color: #fff; }
.btn-danger:hover { background: #c0392b; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-ghost { background: #fff; border: 1px solid #ddd; color: #555; }
.btn-ghost:hover { background: #f0f0f0; }
input, select { padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; outline: none; }
input:focus, select:focus { border-color: #0057ff; }
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid #eee; font-size: 14px; }
th { background: #f8f9fa; font-weight: 600; color: #555; }
tr:hover { background: #fafbff; }

/* 登录页 */
.login-wrap { max-width: 380px; margin: 120px auto; background: #fff; border-radius: 12px; padding: 40px; box-shadow: 0 4px 24px rgba(0,0,0,0.08); }
.login-wrap h1 { text-align: center; margin-bottom: 30px; color: #0057ff; font-size: 22px; }
.login-wrap .field { margin-bottom: 16px; }
.login-wrap .field label { display: block; margin-bottom: 6px; font-size: 14px; color: #666; }
.login-wrap .field input { width: 100%; }
.login-wrap .btn-row { margin-top: 24px; }
.login-wrap .btn-row button { width: 100%; padding: 10px; font-size: 16px; }
.login-wrap .err { color: #e74c3c; text-align: center; min-height: 20px; font-size: 13px; }
.login-wrap .hint { text-align: center; color: #999; font-size: 12px; margin-top: 16px; }

/* 布局 */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: #1a1a2e; color: #aaa; flex-shrink: 0; display: flex; flex-direction: column; }
.sidebar .logo { padding: 24px 20px; font-size: 18px; color: #fff; font-weight: 600; border-bottom: 1px solid #2a2a3e; }
.sidebar .nav { flex: 1; padding: 12px 0; }
.sidebar .nav a { display: block; padding: 12px 20px; color: #aaa; font-size: 14px; transition: 0.2s; }
.sidebar .nav a:hover, .sidebar .nav a.active { background: #0057ff; color: #fff; }
.sidebar .footer { padding: 16px 20px; border-top: 1px solid #2a2a3e; font-size: 12px; }
.sidebar .footer .logout { color: #e74c3c; cursor: pointer; }
.main { flex: 1; padding: 24px 32px; overflow-y: auto; }
.main h2 { margin-bottom: 20px; font-size: 20px; color: #333; }

/* 卡片 */
.cards { display: flex; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.card { background: #fff; border-radius: 10px; padding: 20px 24px; min-width: 180px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.card .label { font-size: 13px; color: #999; margin-bottom: 8px; }
.card .value { font-size: 28px; font-weight: 700; color: #333; }
.card .value.green { color: #27ae60; }
.card .value.blue { color: #0057ff; }
.card .value.orange { color: #e67e22; }

/* 工具栏 */
.toolbar { display: flex; gap: 12px; margin-bottom: 16px; align-items: center; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.toolbar input, .toolbar select { min-width: 140px; }

/* 模态框 */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: none; align-items: center; justify-content: center; z-index: 999; }
.modal-overlay.show { display: flex; }
.modal { background: #fff; border-radius: 12px; padding: 28px; min-width: 400px; max-width: 500px; box-shadow: 0 8px 32px rgba(0,0,0,0.15); }
.modal h3 { margin-bottom: 20px; font-size: 18px; }
.modal .field { margin-bottom: 14px; }
.modal .field label { display: block; margin-bottom: 6px; font-size: 13px; color: #666; }
.modal .field input { width: 100%; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

/* 复制提示 */
.copy-tip { position: fixed; top: 20px; right: 20px; background: #27ae60; color: #fff; padding: 10px 20px; border-radius: 6px; font-size: 14px; display: none; z-index: 9999; }
.copy-tip.show { display: block; animation: fadeout 2s forwards; }
@keyframes fadeout { 0%,70% { opacity: 1; } 100% { opacity: 0; } }

/* 状态标签 */
.tag { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 12px; }
.tag.success { background: #d4edda; color: #155724; }
.tag.fail { background: #f8d7da; color: #721c24; }
.tag.active { background: #d4edda; color: #155724; }
.tag.inactive { background: #f0f0f0; color: #999; }
.tag.admin { background: #cce5ff; color: #004085; }
.tag.user { background: #e2e3e5; color: #383d41; }

/* 分页 */
.pager { display: flex; gap: 8px; justify-content: center; margin-top: 16px; }
.empty { text-align: center; padding: 40px; color: #999; font-size: 14px; }

/* 内联表单字段（模板编辑器等非模态框场景） */
.field { margin-bottom: 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.field label { font-size: 13px; color: #666; white-space: nowrap; }
.field input, .field select { font-size: 13px; padding: 4px 8px; }
.field input[type="number"] { width: 60px; }
.field input[type="text"] { width: 200px; }
.actions { display: flex; gap: 10px; margin-top: 12px; }
