/* ==========================================================================
   阿尔特新材料 · 后台管理样式（深色侧栏 + 浅色内容区 + 科技青点缀）
   ========================================================================== */
:root {
  --bg: #f2f6fa;
  --surface: #ffffff;
  --ink: #14263a;
  --muted: #64788c;
  --accent: #0f93cf;
  --accent-dark: #0c76a8;
  --accent-soft: #e0f1fa;
  --line: #dbe5ee;
  --dark: #0e2a47;
  --radius: 12px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif; background: var(--bg); color: var(--ink); font-size: 14.5px; line-height: 1.65; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
img { max-width: 100%; }

.admin-shell { display: flex; min-height: 100vh; }

/* ---------- 侧栏 ---------- */
.admin-side {
  width: 224px; background: var(--dark); color: #b9cbdd; flex-shrink: 0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.side-brand { display: flex; gap: 12px; align-items: center; padding: 22px 20px; border-bottom: 1px solid #1d3c5f; }
.brand-mark { width: 40px; height: 40px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; border-radius: 10px; font-size: 17px; flex-shrink: 0; }
.side-brand b { color: #fff; display: block; font-size: 15.5px; letter-spacing: 1px; }
.side-brand i { font-style: normal; font-size: 11.5px; color: #7f97ad; }
.side-nav { flex: 1; padding: 14px 12px; display: flex; flex-direction: column; gap: 3px; }
.side-nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 10px;
  color: #a7bcd0; font-size: 14.5px; transition: .18s; position: relative;
}
.side-nav a span { width: 20px; text-align: center; opacity: .85; }
.side-nav a:hover { background: #143454; color: #fff; }
.side-nav a.on { background: var(--accent); color: #fff; }
.badge { margin-left: auto; background: #d64524; color: #fff; font-size: 11px; border-radius: 999px; padding: 1px 8px; }
.side-foot { padding: 16px 20px; border-top: 1px solid #1d3c5f; display: flex; justify-content: space-between; font-size: 12.5px; }
.side-foot a:hover { color: #74cdec; }

/* ---------- 主区 ---------- */
.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-topbar {
  background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px; padding: 0 28px; height: 62px;
  position: sticky; top: 0; z-index: 20;
}
.admin-topbar h1 { font-size: 18px; font-weight: 600; letter-spacing: 1px; }
.side-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: 15px; }
.topbar-user { margin-left: auto; font-size: 13.5px; color: var(--muted); }
.topbar-user b { color: var(--ink); }
.admin-content { padding: 26px 28px 60px; min-width: 0; overflow-x: hidden; }

/* ---------- 仪表盘 ---------- */
.stat-cards { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; transition: .2s; display: block;
}
.stat-card:hover { box-shadow: 0 8px 24px rgba(29,31,38,.08); transform: translateY(-2px); }
.stat-card b { display: block; font-size: 30px; font-weight: 700; color: var(--ink); font-family: Georgia, serif; }
.stat-card.warn b { color: var(--accent); }
.stat-card.warn.has { border-color: #74cdec; background: #f2f7fb; }
.stat-card span { font-size: 12.5px; color: var(--muted); letter-spacing: 1px; }
.panel-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px; align-items: start; }
.panel-grid > .panel { min-width: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.panel .table { display: table; width: 100%; }
.panel.narrow { max-width: 420px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; border-bottom: 1px solid var(--line); }
.panel-head h3 { font-size: 15.5px; letter-spacing: 1px; }
.panel-head a { font-size: 13px; color: var(--accent); }
.panel-title { font-size: 15.5px; letter-spacing: 1px; margin: 26px 0 14px; padding-left: 12px; border-left: 4px solid var(--accent); }
.panel-title:first-child { margin-top: 0; }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; background: #eff5fa; color: #7f97ad; font-weight: 600; padding: 11px 14px; border-bottom: 1px solid var(--line); letter-spacing: 1px; white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid #e9f0f7; vertical-align: middle; }
.table tr:hover td { background: #f7fafc; }
.table tr.unread td { background: #f2f7fb; }
.table .clip { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table a:hover { color: var(--accent); }
.mini-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; display: block; background: #e9f0f7; }
.mini-thumb.empty { display: grid; place-items: center; color: #a7bcd0; }
.tag { display: inline-block; font-size: 11.5px; padding: 2px 10px; border-radius: 999px; background: #e9f0f7; color: #7f97ad; }
.tag.ok { background: #e2f0e3; color: #2c6e31; }
.tag.hot { background: #e0f1fa; color: #0c76a8; }
.msg-content { max-width: 420px; white-space: normal; font-size: 13px; }
.msg-content b { color: #7f97ad; font-weight: 600; }
.msg-files { max-width: 200px; white-space: normal; font-size: 12.5px; }
.msg-file { color: var(--accent-dark); display: inline-block; padding: 2px 0; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.msg-file:hover { text-decoration: underline; }
.empty { text-align: center; color: var(--muted); padding: 26px 0 !important; }

/* ---------- 工具栏 / 按钮 / 表单 ---------- */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.filter-inline { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-inline input, .filter-inline select {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font-size: 13.5px; background: #fff; outline: none;
}
.btn {
  display: inline-block; border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 8px; padding: 9px 18px; font-size: 13.5px; cursor: pointer; transition: .18s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); color: #fff; }
.btn-sm { padding: 6px 13px; font-size: 12.5px; }
.btn.danger { color: #b3372a; border-color: #eccfca; }
.btn.danger:hover { background: #b3372a; border-color: #b3372a; color: #fff; }
.inline-form { display: inline-block; margin-left: 6px; }
.flash { padding: 10px 16px; border-radius: 10px; font-size: 13.5px; margin-bottom: 16px; }
.flash.ok { background: #e8f3e8; color: #2c6e31; border: 1px solid #cde5cf; }
.flash.error { background: #f9e9e7; color: #a23b2e; border: 1px solid #efd2ce; }

.form-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 28px; max-width: 980px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 22px; }
.form-item { margin-bottom: 16px; }
.form-item.span2 { grid-column: span 2; }
.form-item label { display: block; font-size: 13px; color: #7f97ad; margin-bottom: 6px; }
.form-item input, .form-item select, .form-item textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 13px;
  font-size: 14px; font-family: inherit; background: #fff; outline: none; transition: .18s; resize: vertical;
}
.form-item input:focus, .form-item select:focus, .form-item textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(176,92,40,.1); }
.check-row { display: flex; gap: 26px; align-items: flex-end; padding-bottom: 16px; }
.check-row label, .check-line { display: flex !important; align-items: center; gap: 8px; font-size: 14px; color: var(--ink) !important; cursor: pointer; }
.check-row input, .check-line input { width: auto; }
.upload-row { display: flex; gap: 10px; align-items: center; }
.upload-btn { cursor: pointer; }
.form-hint { font-size: 12.5px; color: var(--muted); margin: 8px 0 6px; }
.form-preview { margin-top: 10px; width: 120px; border-radius: 8px; border: 1px solid var(--line); }
.form-actions { margin-top: 22px; display: flex; gap: 12px; }
.gallery-box { display: flex; flex-wrap: wrap; gap: 12px; padding: 12px; border: 1px dashed var(--line); border-radius: 10px; background: #f7fafc; }
.gallery-list { display: flex; flex-wrap: wrap; gap: 12px; }
.gallery-card {
  position: relative; width: 108px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; overflow: hidden; padding-bottom: 20px;
}
.gallery-card img { width: 100%; height: 84px; object-fit: cover; display: block; }
.gallery-card .g-name {
  position: absolute; left: 0; right: 0; bottom: 0; font-size: 10px; color: #7f97ad;
  padding: 2px 5px; background: #eaf1f8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gallery-card .g-del {
  position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border: 0; border-radius: 50%;
  background: rgba(179, 55, 42, .9); color: #fff; cursor: pointer; font-size: 13px; line-height: 1;
}
.gallery-card .g-move {
  position: absolute; top: 34px; width: 22px; height: 22px; border: 1px solid var(--line); border-radius: 50%;
  background: rgba(255,255,255,.92); cursor: pointer; font-size: 13px; line-height: 1; color: #444;
}
.gallery-card .g-left { left: 4px; }
.gallery-card .g-right { right: 4px; }
.gallery-add {
  width: 108px; height: 104px; border: 1px dashed #b9cbdd; border-radius: 10px; cursor: pointer;
  display: grid; place-items: center; color: var(--accent); font-size: 13px; background: #fff;
}
.cell-input { width: 100% !important; padding: 6px 9px !important; font-size: 13px !important; }
.cell-input.num { width: 64px !important; }
.cell-file { font-size: 12px; margin-right: 8px; }

/* ---------- 分页 ---------- */
.pager.admin { display: flex; gap: 6px; margin-top: 20px; }
.pager.admin a, .pager.admin b { min-width: 34px; height: 34px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 0 9px; font-size: 13px; }
.pager.admin b.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- 登录页 ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(circle at 70% 20%, rgba(176,92,40,.12), transparent 50%), var(--bg); }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 40px 42px; width: 380px; box-shadow: 0 20px 50px rgba(29,31,38,.1); }
.login-card .brand-mark { width: 52px; height: 52px; font-size: 22px; margin-bottom: 16px; }
.login-card h1 { font-size: 19px; margin-bottom: 22px; letter-spacing: 1px; }
.login-card label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
.login-card input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 11px 13px; font-size: 14px; outline: none; }
.login-card input:focus { border-color: var(--accent); }
.login-card .btn { width: 100%; margin-top: 22px; padding: 12px; }
.login-tip { font-size: 12px; color: var(--muted); margin-top: 16px; text-align: center; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .admin-side { position: fixed; z-index: 50; left: -224px; transition: .25s; }
  .admin-side.open { left: 0; }
  .side-toggle { display: block; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .panel-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-item.span2 { grid-column: span 1; }
  .table { display: block; overflow-x: auto; }
}

/* ---------- 品牌 Logo 图 ---------- */
.brand-logo { height: 34px; width: auto; display: block; flex-shrink: 0; }
.login-card .brand-logo { height: 46px; margin: 0 auto 6px; }
