/* ===== 基础 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: "Microsoft YaHei", "PingFang SC", -apple-system, sans-serif;
    font-size: 13px;
    color: #2b2f36;
    background: #f2f4f8;
}
a { color: #2563eb; text-decoration: none; }
button { font-family: inherit; }

/* ===== 前台首页 ===== */
.home-body {
    min-height: 100vh;
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 45%, #3b82f6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 16px;
}
.home-wrap { width: 900px; max-width: 100%; }
.home-head { text-align: center; color: #fff; margin-bottom: 34px; }
.home-head h1 { font-size: 30px; font-weight: 700; letter-spacing: 2px; }
.home-head .sub { margin-top: 12px; font-size: 13px; opacity: .85; }
.home-head .sub b { font-weight: 600; }
.home-links { margin-top: 14px; }
.tag-agent {
    display: inline-block; background: rgba(255,255,255,.18); color: #fff;
    padding: 4px 14px; border-radius: 20px; font-size: 12px;
}
.home-link { color: #fff; font-size: 13px; opacity: .9; border-bottom: 1px solid rgba(255,255,255,.5); }

.home-card {
    background: #fff; border-radius: 14px; padding: 34px;
    display: flex; gap: 40px;
    box-shadow: 0 22px 60px rgba(0,0,0,.25);
}
.gen-left { flex: 1; }
.gen-right { width: 260px; text-align: center; }

.gen-left textarea {
    width: 100%; padding: 12px 14px; border: 1px solid #d8dee9; border-radius: 8px;
    font-size: 14px; line-height: 1.7; resize: vertical; outline: none;
    transition: border .2s;
}
.gen-left textarea:focus { border-color: #2563eb; }
.gen-meta { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12px; color: #8a93a3; }
.type-badge { padding: 2px 10px; border-radius: 10px; font-size: 12px; }
.badge-text { background: #eef2ff; color: #4f46e5; }
.badge-url { background: #ecfdf5; color: #059669; }

.gen-size { margin: 16px 0 20px; font-size: 13px; color: #4b5563; }
.gen-size label { margin-right: 14px; cursor: pointer; }
.gen-size input { vertical-align: -2px; margin-right: 3px; }

.btn-primary {
    width: 100%; padding: 12px; border: 0; border-radius: 8px; cursor: pointer;
    background: linear-gradient(135deg, #2563eb, #4f46e5); color: #fff;
    font-size: 15px; font-weight: 600; letter-spacing: 4px;
    transition: opacity .2s;
}
.btn-primary:hover { opacity: .9; }
.gen-msg { margin-top: 10px; color: #dc2626; font-size: 12px; min-height: 18px; }

.qr-stage {
    width: 260px; height: 260px; border: 1px dashed #cbd5e1; border-radius: 10px;
    display: flex; align-items: center; justify-content: center; margin: 0 auto;
    background: #fafbfd;
}
.qr-stage img { max-width: 100%; max-height: 100%; }
.qr-empty { color: #b6c0cf; font-size: 13px; }
.btn-ghost {
    margin-top: 16px; padding: 9px 26px; border: 1px solid #cbd5e1; border-radius: 8px;
    background: #fff; color: #475569; cursor: pointer; font-size: 13px;
}
.btn-ghost:hover { border-color: #2563eb; color: #2563eb; }

/* ===== 后台面板布局 ===== */
.panel-body { display: flex; min-height: 100vh; }
.sidebar {
    width: 190px; background: #1c2536; color: #cfd6e4; flex-shrink: 0;
    display: flex; flex-direction: column;
}
.side-logo {
    padding: 22px 20px 18px; font-size: 16px; font-weight: 700; color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.side-logo span { display: block; margin-top: 5px; font-size: 11px; font-weight: 400; color: #7f8ba3; letter-spacing: 2px; }
.side-nav { flex: 1; padding: 12px 0; }
.side-nav a {
    display: block; padding: 11px 22px; color: #aeb8cc; font-size: 13px;
    border-left: 3px solid transparent; transition: all .15s;
}
.side-nav a:hover { color: #fff; background: rgba(255,255,255,.05); }
.side-nav a.active { color: #fff; background: rgba(37,99,235,.18); border-left-color: #2563eb; }
.side-foot { padding: 14px 22px; border-top: 1px solid rgba(255,255,255,.08); }
.side-foot a { color: #8a93a3; font-size: 12px; }
.side-foot a:hover { color: #fff; }

.panel-main { flex: 1; padding: 24px 30px; min-width: 0; }
.panel-topbar { margin-bottom: 22px; }
.panel-topbar h1 { font-size: 19px; font-weight: 600; }

/* 统计卡片 */
.stat-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.stat-card {
    flex: 1; min-width: 180px; background: #fff; border-radius: 10px; padding: 20px 22px;
    box-shadow: 0 1px 4px rgba(30,40,60,.06);
}
.stat-card .num { font-size: 26px; font-weight: 700; color: #1e293b; }
.stat-card .lbl { margin-top: 6px; font-size: 12px; color: #8a93a3; }
.stat-card.c1 .num { color: #2563eb; }
.stat-card.c2 .num { color: #059669; }
.stat-card.c3 .num { color: #d97706; }

/* 卡片容器 / 表格 */
.card {
    background: #fff; border-radius: 10px; padding: 20px 22px;
    box-shadow: 0 1px 4px rgba(30,40,60,.06); margin-bottom: 22px;
}
.card h3 { font-size: 14px; font-weight: 600; margin-bottom: 14px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th, table.tbl td { padding: 9px 10px; text-align: left; border-bottom: 1px solid #eef1f6; }
table.tbl th { color: #6b7688; font-weight: 600; background: #f8fafc; white-space: nowrap; }
table.tbl tr:hover td { background: #f8faff; }
.cell-content { max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: middle; }

.mini-tag { padding: 1px 9px; border-radius: 9px; font-size: 11px; display: inline-block; }
.tag-on { background: #ecfdf5; color: #059669; }
.tag-off { background: #fef2f2; color: #dc2626; }
.tag-url { background: #eff6ff; color: #2563eb; }
.tag-text { background: #f5f3ff; color: #7c3aed; }

/* 表单 */
.form-inline { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.form-inline input, .form-inline select {
    padding: 7px 10px; border: 1px solid #d8dee9; border-radius: 6px; font-size: 13px; outline: none;
}
.form-inline input:focus, .form-inline select:focus { border-color: #2563eb; }
.btn {
    padding: 7px 18px; border: 0; border-radius: 6px; cursor: pointer;
    background: #2563eb; color: #fff; font-size: 13px;
}
.btn:hover { opacity: .88; }
.btn-danger { background: #dc2626; }
.btn-dim { background: #64748b; }
.btn-mini { padding: 3px 10px; border: 0; border-radius: 5px; cursor: pointer; background: #eef2ff; color: #4f46e5; font-size: 12px; }
.btn-mini.red { background: #fef2f2; color: #dc2626; }
.btn-mini.gray { background: #f1f5f9; color: #475569; }

/* 图表（近7天） */
.bars { display: flex; align-items: flex-end; gap: 14px; height: 130px; padding-top: 10px; }
.bar-col { flex: 1; text-align: center; }
.bar {
    width: 60%; margin: 0 auto; background: linear-gradient(180deg, #3b82f6, #2563eb);
    border-radius: 4px 4px 0 0; min-height: 3px; position: relative;
}
.bar-num { font-size: 11px; color: #475569; margin-bottom: 4px; }
.bar-date { margin-top: 6px; font-size: 11px; color: #8a93a3; }

/* 分页 */
.pager { margin-top: 14px; font-size: 12px; color: #8a93a3; }
.pg {
    display: inline-block; padding: 3px 9px; margin-left: 4px; border-radius: 4px;
    border: 1px solid #e2e8f0; color: #475569;
}
.pg.cur { background: #2563eb; border-color: #2563eb; color: #fff; }

/* 模态 */
.modal-mask {
    position: fixed; inset: 0; background: rgba(15,23,42,.55);
    display: flex; align-items: center; justify-content: center; z-index: 99;
}
.modal-box { background: #fff; border-radius: 10px; width: 320px; overflow: hidden; }
.modal-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px; border-bottom: 1px solid #eef1f6; font-size: 13px;
}
.modal-body { padding: 18px; text-align: center; }
.modal-text { margin-top: 12px; font-size: 12px; color: #64748b; word-break: break-all; max-height: 90px; overflow: auto; }

/* 登录页 */
.login-body {
    min-height: 100vh; background: linear-gradient(135deg, #1e3a8a, #312e81);
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-card {
    background: #fff; border-radius: 12px; padding: 38px 36px; width: 340px;
    box-shadow: 0 20px 55px rgba(0,0,0,.3);
}
.login-card h2 { font-size: 18px; text-align: center; margin-bottom: 6px; }
.login-card .login-sub { text-align: center; color: #8a93a3; font-size: 12px; margin-bottom: 26px; }
.login-card label { display: block; font-size: 12px; color: #64748b; margin: 14px 0 6px; }
.login-card input {
    width: 100%; padding: 10px 12px; border: 1px solid #d8dee9; border-radius: 7px;
    font-size: 14px; outline: none;
}
.login-card input:focus { border-color: #2563eb; }
.login-card .btn { width: 100%; padding: 11px; margin-top: 24px; font-size: 14px; }
.login-err { margin-top: 12px; color: #dc2626; font-size: 12px; text-align: center; min-height: 16px; }

@media (max-width: 760px) {
    .home-card { flex-direction: column; }
    .gen-right { width: 100%; }
    .qr-stage { width: 220px; height: 220px; }
    .panel-body { flex-direction: column; }
    .sidebar { width: 100%; }
    .cell-content { max-width: 160px; }
}
