/* ==========================================================
   E21官网 CMS · 后台样式
   ========================================================== */
:root {
    --red: #e60012;
    --red-dark: #c1000f;
    --ink: #111318;
    --side: #191c22;
    --side-hover: #242832;
    --text: #2b2f36;
    --muted: #848b98;
    --line: #e8eaee;
    --bg: #f5f6f8;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(17,19,24,.06);
    --sidebar-w: 216px;
    --topbar-h: 62px;
}

* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.6 "PingFang SC", "Microsoft YaHei", "Segoe UI", Arial, sans-serif; color: var(--text); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; border: 0; }
a { color: inherit; text-decoration: none; transition: color .18s; }
a:hover { color: var(--red); }
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
code { font-family: Menlo, Consolas, monospace; font-size: 12px; background: var(--bg); padding: 2px 6px; border-radius: 4px; }
.muted { color: var(--muted); }

/* ---------------- 布局 ---------------- */
.admin { background: var(--bg); }

.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
    background: var(--side); color: rgba(255,255,255,.72);
    display: flex; flex-direction: column; z-index: 50;
    transition: transform .25s;
}
.sidebar__brand {
    height: var(--topbar-h); display: flex; align-items: center; gap: 10px;
    padding: 0 20px; border-bottom: 1px solid rgba(255,255,255,.07); flex: none;
}
.sidebar__brand img { height: 20px; filter: brightness(0) invert(1); }
.sidebar__brand span { font-size: 14px; font-weight: 600; color: #fff; }
.sidebar__nav { flex: 1; padding: 14px 12px; overflow-y: auto; }
.sidebar__link {
    display: flex; align-items: center; gap: 11px; padding: 11px 13px;
    border-radius: 8px; font-size: 14px; margin-bottom: 3px; position: relative;
}
.sidebar__link:hover { background: var(--side-hover); color: #fff; }
.sidebar__link.is-active { background: var(--red); color: #fff; font-weight: 600; }
.sidebar__link svg { flex: none; opacity: .92; }
.sidebar__badge {
    margin-left: auto; background: var(--red); color: #fff; font-size: 11px; font-style: normal;
    min-width: 18px; height: 18px; border-radius: 9px; display: flex; align-items: center;
    justify-content: center; padding: 0 5px; font-weight: 600;
}
.sidebar__link.is-active .sidebar__badge { background: rgba(255,255,255,.28); }
.sidebar__foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.07); flex: none; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
    height: var(--topbar-h); background: #fff; border-bottom: 1px solid var(--line);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 26px; position: sticky; top: 0; z-index: 40;
}
.topbar__left { display: flex; align-items: center; gap: 14px; }
.topbar__title { font-size: 17px; font-weight: 600; }
.topbar__toggle { display: none; width: 36px; height: 36px; border: 0; background: transparent; cursor: pointer; flex-direction: column; gap: 4px; align-items: center; justify-content: center; }
.topbar__toggle span { width: 18px; height: 2px; background: var(--ink); border-radius: 2px; }
.topbar__user { display: flex; align-items: center; gap: 9px; font-size: 14px; }
.avatar {
    width: 32px; height: 32px; border-radius: 50%; background: var(--red); color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600;
}
.content { padding: 26px; flex: 1; }

.sidebar-mask { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 45; }
.sidebar-mask.is-open { display: block; }

/* ---------------- 面板 ---------------- */
.panel { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 22px; overflow: hidden; }
.panel--full { width: 100%; }
.panel__head {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 18px 22px; border-bottom: 1px solid var(--line);
}
.panel__title { font-size: 16px; font-weight: 600; }
.panel__more { font-size: 13px; color: var(--muted); }
.panel__body { padding: 22px; }
.panel__body--flush { padding: 0; }
.panel__body--actions { border-top: 1px solid var(--line); display: flex; align-items: center; gap: 14px; }
.panel__empty { padding: 44px; text-align: center; color: var(--muted); font-size: 14px; }

.panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.panel-grid > .panel { margin: 0 0 22px; }
.panel--full { grid-column: 1 / -1; }
@media (max-width: 1100px) { .panel-grid { grid-template-columns: 1fr; } }

/* ---------------- 统计卡 ---------------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 22px; }
.stat-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.stat-card--accent { background: linear-gradient(120deg, var(--red), #ff4d5e); color: #fff; }
.stat-card--accent .stat-card__label, .stat-card--accent .stat-card__foot a { color: rgba(255,255,255,.86); }
.stat-card__label { font-size: 13px; color: var(--muted); }
.stat-card__value { display: block; font-size: 30px; font-weight: 700; margin: 8px 0 10px; letter-spacing: -.5px; }
.stat-card__foot { font-size: 12px; }
.stat-card__foot a { color: var(--muted); }
@media (max-width: 900px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }

/* ---------------- 图表 ---------------- */
.chart { display: flex; align-items: flex-end; gap: 10px; height: 190px; padding-top: 20px; }
.chart__col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.chart__value { font-size: 12px; color: var(--muted); font-weight: 600; }
.chart__bar { width: 100%; max-width: 44px; background: linear-gradient(180deg, var(--red), #ff7a86); border-radius: 5px 5px 0 0; min-height: 4px; transition: height .3s; }
.chart__label { font-size: 11px; color: var(--muted); }

/* ---------------- 表 ---------------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 13px 16px; text-align: left; vertical-align: middle; }
.table th { background: #fafbfc; font-size: 12.5px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { border-bottom: 1px solid #f2f3f5; }
.table tbody tr:hover { background: #fafbfc; }
.table tbody tr:last-child td { border-bottom: 0; }
.table__actions { white-space: nowrap; }
.table__actions > * { margin-right: 4px; }
.row--unread { background: #fffaf9; }
.row--unread td:first-child::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--red); margin-right: 6px; vertical-align: middle; }

.thumb { width: 46px; height: 34px; object-fit: cover; border-radius: 5px; background: var(--bg); }
.thumb--square { width: 44px; height: 44px; }
.thumb--wide { width: 96px; height: 46px; }

.status { font-size: 12px; padding: 3px 9px; border-radius: 4px; font-weight: 600; white-space: nowrap; }
.status--on { background: #eaf8ef; color: #0a7a36; }
.status--off { background: #f2f3f5; color: var(--muted); }

.flags { display: flex; gap: 4px; }
.flag { font-size: 11px; background: #eef2ff; color: #2b5ce0; padding: 2px 6px; border-radius: 3px; font-weight: 600; }
.flag--hot { background: #fdecec; color: var(--red); }
.flag--new { background: #e9f4ff; color: #1f7ae0; }

/* ---------------- 按钮 ---------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    padding: 9px 18px; border-radius: 6px; border: 1px solid transparent;
    font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
    transition: all .18s; background: transparent; font-family: inherit;
}
.btn--primary { background: var(--red); color: #fff; }
.btn--primary:hover { background: var(--red-dark); color: #fff; }
.btn--outline { border-color: var(--line); color: var(--text); background: #fff; }
.btn--outline:hover { border-color: var(--red); color: var(--red); }
.btn--ghost { border-color: var(--line); color: var(--text); background: #fff; }
.btn--ghost:hover { border-color: var(--red); color: var(--red); }
.btn--danger { background: #fff; border-color: #f3c9c9; color: #c0392b; }
.btn--danger:hover { background: #fdecec; border-color: #e9a8a8; color: #b00; }
.btn--sm { padding: 8px 15px; font-size: 13px; }
.btn--xs { padding: 5px 11px; font-size: 12.5px; border-radius: 5px; }
.btn--block { width: 100%; padding: 11px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.inline-form { display: inline-block; }

/* ---------------- 表单 ---------------- */
.form__row { margin-bottom: 18px; }
.form__row--2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form__row--3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.form__label { display: block; margin-bottom: 7px; font-size: 13.5px; font-weight: 500; }
.form__label i { color: var(--red); font-style: normal; }
.form__input, .form__textarea, select.form__input {
    width: 100%; padding: 10px 13px; border: 1px solid var(--line); border-radius: 6px;
    font-size: 14px; font-family: inherit; outline: none; background: #fff;
    transition: border-color .18s; color: var(--text);
}
.form__input:focus, .form__textarea:focus, select.form__input:focus { border-color: var(--red); }
.form__input[type="file"] { padding: 8px 12px; background: var(--bg); }
.form__textarea { resize: vertical; line-height: 1.7; }
.form__textarea--code { font-family: Menlo, Consolas, monospace; font-size: 13px; }
.form__hint { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.form__actions { display: flex; gap: 10px; padding-top: 8px; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 20px; }

.check-group { display: flex; flex-wrap: wrap; gap: 20px; padding-top: 8px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar .form__input { width: auto; min-width: 180px; }
.toolbar select.form__input { min-width: 140px; }

.preview { display: inline-block; padding: 6px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; background: #fff; }
.preview img { max-height: 130px; width: auto; border-radius: 5px; }
.preview--sm img { max-height: 54px; }

/* ---------------- 提示 ---------------- */
.alert { padding: 12px 18px; border-radius: 8px; font-size: 14px; margin-bottom: 20px; }
.alert--success { background: #eaf8ef; color: #0a7a36; border: 1px solid #c5ecd4; }
.alert--error { background: #fdecec; color: #b00; border: 1px solid #f6cfcf; }

/* ---------------- 标签页 ---------------- */
.tabs { display: flex; gap: 6px; }
.tab { padding: 8px 18px; border-radius: 20px; font-size: 14px; background: var(--bg); }
.tab:hover { color: var(--red); }
.tab.is-active { background: var(--red); color: #fff; font-weight: 600; }

/* ---------------- 详情列表 ---------------- */
.detail-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px 30px; }
.detail-list dt { font-size: 12.5px; color: var(--muted); margin-bottom: 3px; }
.detail-list dd { font-size: 15px; font-weight: 500; }
.message-content { margin-top: 24px; padding: 20px; background: var(--bg); border-radius: 8px; font-size: 15px; line-height: 1.9; }

/* ---------------- 迷你列表 ---------------- */
.mini-list__item { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 22px; border-bottom: 1px solid #f2f3f5; }
.mini-list__item:last-child { border-bottom: 0; }
.mini-list__title { font-size: 14px; font-weight: 500; }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--red); margin-left: 6px; vertical-align: middle; }
.mini-list__meta { display: block; margin-top: 3px; font-size: 12px; color: var(--muted); }
.mini-list__extra { font-size: 13px; color: var(--muted); white-space: nowrap; }

/* ---------------- 分页 ---------------- */
.pager { display: flex; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.pager__item {
    min-width: 34px; height: 34px; padding: 0 11px; border-radius: 6px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--line); font-size: 13px; background: #fff;
}
.pager__item:hover { border-color: var(--red); color: var(--red); }
.pager__item.is-current { background: var(--red); border-color: var(--red); color: #fff; font-weight: 600; }

/* ---------------- 设置页 ---------------- */
.settings .panel { margin-bottom: 20px; }
.settings__submit { position: sticky; bottom: 0; background: rgba(245,246,248,.92); backdrop-filter: blur(8px); padding: 16px 0; }

/* ---------------- 登录页 ---------------- */
.login-body {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #1a1d24 0%, #2c313b 60%, #3d2a2c 100%); padding: 24px;
}
.login { width: 100%; max-width: 400px; }
.login__brand { text-align: center; margin-bottom: 26px; }
.login__brand img { height: 30px; margin: 0 auto 14px; filter: brightness(0) invert(1); }
.login__brand h1 { font-size: 22px; color: #fff; font-weight: 600; }
.login__brand p { font-size: 13px; color: rgba(255,255,255,.55); margin-top: 5px; }
.login__card { background: #fff; border-radius: 14px; padding: 32px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login__tip { margin-top: 18px; font-size: 12.5px; color: var(--muted); text-align: center; line-height: 1.8; }
.login__back { display: block; text-align: center; margin-top: 20px; font-size: 13px; color: rgba(255,255,255,.55); }
.login__back:hover { color: #fff; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.is-open { transform: translateX(0); }
    .main { margin-left: 0; }
    .topbar__toggle { display: flex; }
    .content { padding: 18px; }
    .form__row--2, .form__row--3 { grid-template-columns: 1fr; }
    .detail-list { grid-template-columns: 1fr; }
    .table { font-size: 13px; }
    .table th, .table td { padding: 10px 12px; }
}
