/* VideoMix 云授权 — 管理后台样式 */
:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --success: #16a34a;
  --warning: #d97706;
  --bg: #f5f5f7;
  --card: #ffffff;
  --border: #e5e7eb;
  --text: #1f2937;
  --text-muted: #6b7280;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Microsoft YaHei", Roboto, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.5;
}
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ===== 登录页 ===== */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-card {
  background: var(--card); padding: 40px; border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2); width: 100%; max-width: 380px;
}
.login-card h1 { font-size: 22px; margin-bottom: 6px; }
.login-card .sub { color: var(--text-muted); font-size: 13px; margin-bottom: 24px; }
.login-card input {
  width: 100%; padding: 11px 14px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; margin-bottom: 14px; outline: none;
  transition: border-color .15s;
}
.login-card input:focus { border-color: var(--primary); }
.login-card .btn-login {
  width: 100%; padding: 12px; background: var(--primary); color: #fff;
  border: none; border-radius: 8px; font-size: 15px; font-weight: 500;
}
.login-card .btn-login:hover { background: var(--primary-hover); }
.login-error { color: var(--danger); font-size: 13px; margin-bottom: 12px; min-height: 18px; }

/* ===== 布局 ===== */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 200px; background: #1e293b; color: #cbd5e1; padding: 20px 0;
  display: flex; flex-direction: column; flex-shrink: 0;
}
.sidebar .brand { padding: 0 20px 20px; font-size: 16px; font-weight: 600; color: #fff; }
.sidebar .brand small { display: block; font-size: 11px; color: #94a3b8; font-weight: 400; margin-top: 2px; }
.sidebar nav { flex: 1; }
.sidebar nav a {
  display: block; padding: 11px 20px; color: #cbd5e1; text-decoration: none;
  font-size: 14px; transition: all .15s;
}
.sidebar nav a:hover { background: #334155; color: #fff; }
.sidebar nav a.active { background: var(--primary); color: #fff; }
.sidebar .user-box { padding: 14px 20px; border-top: 1px solid #334155; font-size: 12px; }
.sidebar .user-box .name { color: #fff; margin-bottom: 4px; }
.sidebar .user-box .btn-logout {
  background: transparent; border: none; color: #94a3b8; padding: 0; font-size: 12px;
}
.sidebar .user-box .btn-logout:hover { color: #fff; }

.main { flex: 1; padding: 28px 32px; overflow-y: auto; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.page-header h2 { font-size: 20px; font-weight: 600; }

/* ===== 卡片 / 统计 ===== */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--card); padding: 20px; border-radius: 10px; box-shadow: var(--shadow); }
.stat-card .label { color: var(--text-muted); font-size: 13px; margin-bottom: 8px; }
.stat-card .value { font-size: 28px; font-weight: 700; }
.stat-card.green .value { color: var(--success); }
.stat-card.red .value { color: var(--danger); }
.stat-card.blue .value { color: var(--primary); }

/* ===== 表格 ===== */
.card { background: var(--card); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; }
.card-body { padding: 16px 20px; }
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.toolbar input, .toolbar select {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 13px; outline: none;
}
.toolbar input { flex: 1; min-width: 180px; }
.toolbar input:focus, .toolbar select:focus { border-color: var(--primary); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 11px 12px; background: #f9fafb; color: var(--text-muted);
     font-weight: 500; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbfc; }
.key-code { font-family: "Consolas", "Monaco", monospace; font-weight: 600; color: var(--primary); }
.mono { font-family: "Consolas", "Monaco", monospace; font-size: 12px; }

/* ===== 标签 ===== */
.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.badge.active { background: #dcfce7; color: var(--success); }
.badge.disabled { background: #fee2e2; color: var(--danger); }
.badge.expired { background: #fef3c7; color: var(--warning); }
.badge.plan-pro { background: #ede9fe; color: #7c3aed; }
.badge.plan-standard { background: #e0e7ff; color: var(--primary); }
.badge.plan-trial { background: #fef3c7; color: var(--warning); }

/* ===== 按钮 ===== */
.btn { padding: 7px 14px; border: 1px solid var(--border); background: #fff; border-radius: 6px;
       font-size: 13px; transition: all .15s; }
.btn:hover { background: #f3f4f6; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-link { background: transparent; border: none; color: var(--primary); padding: 2px 6px; font-size: 13px; }
.btn-link.danger { color: var(--danger); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ===== 分页 ===== */
.pagination { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; font-size: 13px; color: var(--text-muted); }
.pagination .pages button { padding: 5px 11px; margin: 0 2px; border: 1px solid var(--border); background: #fff; border-radius: 4px; }
.pagination .pages button.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== 模态框 ===== */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: none;
              align-items: center; justify-content: center; z-index: 100; }
.modal-mask.show { display: flex; }
.modal { background: #fff; border-radius: 12px; padding: 24px; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; }
.modal h3 { font-size: 17px; margin-bottom: 18px; }
.modal .field { margin-bottom: 14px; }
.modal .field label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 5px; }
.modal .field input, .modal .field select, .modal .field textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; outline: none;
}
.modal .field input:focus, .modal .field select:focus, .modal .field textarea:focus { border-color: var(--primary); }
.modal .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.modal .hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.toast { position: fixed; top: 20px; right: 20px; padding: 12px 20px; border-radius: 8px;
         color: #fff; font-size: 14px; z-index: 200; opacity: 0; transition: opacity .3s; }
.toast.show { opacity: 1; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* 详情页 */
.detail-section { margin-bottom: 24px; }
.detail-section h3 { font-size: 15px; margin-bottom: 12px; color: var(--text); }
.info-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 24px; }
.info-grid .item .k { font-size: 12px; color: var(--text-muted); margin-bottom: 3px; }
.info-grid .item .v { font-size: 14px; }
.empty { text-align: center; padding: 40px; color: var(--text-muted); font-size: 14px; }
.tag-count { display: inline-block; margin-left: 6px; background: #e5e7eb; color: var(--text-muted);
             border-radius: 10px; padding: 1px 8px; font-size: 11px; }
