/* 布丁云验证码平台 - 公共样式 */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --text-2: #64748b;
  --border: #e2e8f0;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 4px 16px rgba(15, 23, 42, .05);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
}
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* 布局 */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: #0f172a; color: #cbd5e1; flex-shrink: 0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { padding: 20px 18px; font-size: 17px; font-weight: 700; color: #fff; display: flex; align-items: center; gap: 10px; }
.sidebar .brand .dot { width: 10px; height: 10px; border-radius: 50%; background: #38bdf8; box-shadow: 0 0 8px #38bdf8; }
.sidebar .nav { flex: 1; padding: 8px 10px; overflow-y: auto; }
.sidebar .nav a {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; margin: 2px 0;
  border-radius: 8px; color: #cbd5e1; font-size: 14px; transition: .15s;
}
.sidebar .nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar .nav a.active { background: var(--primary); color: #fff; }
.sidebar .nav .sec { padding: 14px 12px 6px; font-size: 11px; color: #64748b; text-transform: uppercase; letter-spacing: .08em; }
.sidebar .foot { padding: 14px 18px; font-size: 12px; color: #64748b; border-top: 1px solid rgba(255,255,255,.06); }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 56px; background: var(--card); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 10;
}
.topbar .title { font-size: 16px; font-weight: 600; }
.topbar .user { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); }
.content { padding: 24px; }

/* 卡片 */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; }
.card .card-hd { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card .card-hd h3 { font-size: 15px; font-weight: 600; }
.card .card-bd { padding: 20px; }
.card .card-bd.pad0 { padding: 0; }

/* 表格 */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
th { color: var(--text-2); font-weight: 500; background: #f8fafc; white-space: nowrap; }
tr:hover td { background: #f8fafc; }

/* 表单 */
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; font-family: inherit; background: #fff; outline: none; transition: .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--text-2); }
.form-inline { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 8px;
  border: 1px solid transparent; font-size: 13px; font-weight: 500; transition: .15s; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: #fff; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: #fef2f2; border-color: #fecaca; color: var(--danger); }
.btn-danger:hover { background: #fee2e2; }
.btn-success { background: #f0fdf4; border-color: #bbf7d0; color: var(--success); }
.btn-success:hover { background: #dcfce7; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* 标签 */
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; }
.tag-ok { background: #dcfce7; color: #15803d; }
.tag-off { background: #fee2e2; color: #b91c1c; }
.tag-warn { background: #fef3c7; color: #b45309; }
.tag-info { background: #dbeafe; color: #1d4ed8; }
.tag-gray { background: #f1f5f9; color: #64748b; }

/* 统计卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 18px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.stat-card .label { font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.stat-card .value { font-size: 26px; font-weight: 700; }
.stat-card .sub { font-size: 12px; color: var(--text-2); margin-top: 4px; }
.stat-card.blue .value { color: var(--primary); }
.stat-card.green .value { color: var(--success); }
.stat-card.red .value { color: var(--danger); }
.stat-card.orange .value { color: var(--warning); }

/* 图表 */
.chart { width: 100%; height: 320px; }
.chart-sm { width: 100%; height: 260px; }

/* 弹层 */
.toast-wrap { position: fixed; top: 18px; right: 18px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  padding: 11px 16px; border-radius: 8px; color: #fff; font-size: 13px; box-shadow: var(--shadow);
  animation: slideIn .25s ease; max-width: 360px;
}
.toast.ok { background: var(--success); }
.toast.err { background: var(--danger); }
.toast.info { background: var(--primary); }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* 登录页 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%); padding: 20px; }
.login-box { width: 400px; background: #fff; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.3); padding: 40px 36px; }
.login-box .logo { font-size: 22px; font-weight: 800; text-align: center; margin-bottom: 8px; display: flex; align-items: center; justify-content: center; gap: 10px; }
.login-box .logo .dot { width: 12px; height: 12px; border-radius: 50%; background: #38bdf8; box-shadow: 0 0 12px #38bdf8; }
.logo img { width: 28px; height: 28px; border-radius: 8px; object-fit: cover; box-shadow: 0 2px 8px rgba(14,165,233,.35); }
.login-box .logo img { width: 38px; height: 38px; border-radius: 10px; }
.sidebar .brand img { width: 26px; height: 26px; border-radius: 8px; object-fit: cover; }
.login-box .sub { text-align: center; color: var(--text-2); font-size: 13px; margin-bottom: 28px; }
.login-box .btn { width: 100%; justify-content: center; padding: 11px; font-size: 14px; }

/* 验证码调试容器 */
.captcha-stage { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 10px; }
.captcha-img { border: 1px solid var(--border); border-radius: 8px; max-width: 100%; }
.captcha-input { max-width: 280px; }
.code-block {
  background: #0f172a; color: #e2e8f0; border-radius: 8px; padding: 16px 18px;
  font-family: "JetBrains Mono", Consolas, "Courier New", monospace; font-size: 12.5px;
  overflow-x: auto; line-height: 1.6; white-space: pre; max-height: 420px; overflow-y: auto;
}
.code-block .c-key { color: #93c5fd; }
.code-block .c-str { color: #86efac; }
.code-block .c-num { color: #fdba74; }
.empty { text-align: center; color: var(--text-2); padding: 40px 0; font-size: 13px; }

/* 分页 */
.pager { display: flex; align-items: center; gap: 10px; padding: 12px 16px; font-size: 13px; color: var(--text-2); }

/* 开关 */
.switch { position: relative; display: inline-block; width: 42px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: #cbd5e1; border-radius: 999px; transition: .2s; }
.switch .slider:before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider:before { transform: translateX(18px); }

@media (max-width: 900px) {
  .sidebar { width: 60px; }
  .sidebar .brand span, .sidebar .nav a span, .sidebar .nav .sec, .sidebar .foot { display: none; }
  .content { padding: 14px; }
}
