:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #182135;
  --text-2: #475569;
  --muted: #8a95a8;
  --border: #e5e9f2;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eef3ff;
  --success: #0f9d58;
  --success-soft: #e9f7ef;
  --warning: #c2740b;
  --warning-soft: #fdf3e2;
  --danger: #dc2626;
  --danger-soft: #fdeceb;
  --gray-soft: #f1f4f9;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 6px 24px rgba(16, 24, 40, .07);
  --shadow-lg: 0 18px 48px rgba(16, 24, 40, .16);
  --sidebar-w: 236px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
::selection { background: #cfe0ff; }

/* ============ 布局 ============ */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: linear-gradient(178deg, #152340 0%, #0d1729 100%);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 26px 20px 20px;
  color: #fff;
}
.brand-text b { display: block; font-size: 17px; letter-spacing: 1.5px; font-weight: 700; }
.brand-text span { font-size: 11px; color: #7c8db0; letter-spacing: 1.4px; }

.nav { padding: 8px 12px; flex: 1; overflow-y: auto; }
.nav-title {
  font-size: 11px; letter-spacing: 1.6px; color: #5d6d8c;
  padding: 14px 10px 8px; text-transform: uppercase;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 9px; cursor: pointer;
  color: #b6c2d6; font-size: 14px; margin-bottom: 3px;
  transition: background .18s, color .18s;
  user-select: none;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(37, 99, 235, .95), rgba(59, 130, 246, .7));
  color: #fff; box-shadow: 0 8px 18px rgba(37, 99, 235, .28);
}
.nav-item .ico { width: 18px; text-align: center; font-size: 15px; opacity: .95; }
.nav-item .count {
  margin-left: auto; background: rgba(255, 255, 255, .16);
  border-radius: 20px; padding: 0 7px; font-size: 11px; line-height: 18px;
}

.sidebar-foot {
  padding: 14px 16px 18px; border-top: 1px solid rgba(255, 255, 255, .07);
  font-size: 12px; color: #6f7f9c;
}
.user-chip { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255, 255, 255, .12); color: #fff;
  display: grid; place-items: center; font-size: 13px; font-weight: 600;
  flex: 0 0 34px;
}
.user-chip .u-name { color: #e6edf9; font-size: 13px; font-weight: 600; line-height: 1.2; }
.user-chip .u-role { font-size: 11px; color: #7c8db0; }
.side-links { display: flex; gap: 14px; }
.side-links button {
  background: none; border: 0; color: #94a4c0; font-size: 12px;
  cursor: pointer; padding: 0; font-family: inherit;
}
.side-links button:hover { color: #fff; }

.main {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  /* 侧栏与内容区之间的分隔线：顶部白条和下方浅灰底上都能看见 */
  border-left: 1px solid rgba(13, 23, 41, .16);
}

.topbar {
  height: 64px; background: rgba(255, 255, 255, .85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 26px; position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 17px; }
.topbar .sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.content { padding: 22px 26px 48px; flex: 1; }

/* ============ 卡片 ============ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-head {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-head h2 { font-size: 15px; }
.card-body { padding: 18px 20px; }

.stat-grid {
  display: grid; gap: 16px; margin-bottom: 18px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat::after {
  content: ""; position: absolute; right: -30px; top: -30px;
  width: 90px; height: 90px; border-radius: 50%;
  background: var(--primary-soft); opacity: .7;
}
.stat .label { font-size: 13px; color: var(--text-2); }
.stat .value { font-size: 28px; font-weight: 700; letter-spacing: -.5px; margin-top: 4px; }
.stat .value small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.stat.warn .value { color: var(--warning); }
.stat.ok .value { color: var(--success); }
.stat.bad .value { color: var(--danger); }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 9px;
  border: 1px solid var(--border); background: #fff; color: var(--text-2);
  font-size: 13px; font-family: inherit; cursor: pointer;
  transition: all .16s; white-space: nowrap; font-weight: 500;
}
.btn:hover { border-color: #c8d2e4; color: var(--text); background: #fbfcfe; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(37, 99, 235, .22); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: #0b8049; color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--gray-soft); border-color: transparent; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn-link {
  background: none; border: 0; color: var(--primary); cursor: pointer;
  font-size: 13px; padding: 2px 4px; font-family: inherit;
}
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: var(--danger); }

/* ============ 表单 ============ */
.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 13px; color: var(--text-2);
  margin-bottom: 6px; font-weight: 500;
}
.field label .req { color: var(--danger); margin-left: 2px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }

.input, select.input, textarea.input {
  width: 100%; height: 38px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 9px;
  background: #fff; color: var(--text); font-size: 14px;
  font-family: inherit; outline: none; transition: border .16s, box-shadow .16s;
}
textarea.input { height: auto; padding: 9px 12px; resize: vertical; min-height: 74px; line-height: 1.6; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.input::placeholder { color: #b3bccb; }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%238a95a8' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar .input { height: 36px; width: 220px; }
.toolbar .spacer { flex: 1; }

/* ============ 表格 ============ */
.table-wrap { overflow-x: auto; }
table.tb { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tb th {
  text-align: left; font-weight: 600; color: var(--text-2);
  background: var(--surface-2); font-size: 12.5px;
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.tb td { padding: 13px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tb tbody tr:hover { background: #fafbfe; }
table.tb tbody tr:last-child td { border-bottom: 0; }
table.tb .actions { display: flex; gap: 2px; flex-wrap: wrap; }
.td-strong { font-weight: 600; color: var(--text); }
.td-sub { font-size: 12px; color: var(--muted); }

/* ============ 状态标签 ============ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 20px; font-size: 12px;
  line-height: 19px; font-weight: 500; white-space: nowrap;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.pending { background: var(--warning-soft); color: var(--warning); }
.badge.approved { background: var(--success-soft); color: var(--success); }
.badge.rejected { background: var(--danger-soft); color: var(--danger); }
.badge.withdrawn { background: var(--gray-soft); color: var(--muted); }
.badge.on { background: var(--success-soft); color: var(--success); }
.badge.off { background: var(--gray-soft); color: var(--muted); }
.badge.img { background: var(--primary-soft); color: var(--primary); }
.badge.vid { background: #f3ecff; color: #7c3aed; }

/* ============ 标签页 ============ */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 8px; flex-wrap: wrap; }
.tab {
  padding: 12px 14px; font-size: 13.5px; color: var(--text-2);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
  display: flex; align-items: center; gap: 6px; font-weight: 500;
}
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab .n {
  background: var(--gray-soft); color: var(--text-2);
  border-radius: 20px; padding: 0 6px; font-size: 11.5px; line-height: 17px;
}
.tab.active .n { background: var(--primary-soft); color: var(--primary); }

/* ============ 分页 ============ */
.pager { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-top: 1px solid var(--border); }
.pager .info { font-size: 12.5px; color: var(--muted); }
.pager .pages { display: flex; gap: 6px; }
.pager button {
  min-width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; color: var(--text-2); cursor: pointer; font-size: 13px; font-family: inherit;
}
.pager button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pager button.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pager button:disabled { opacity: .45; cursor: not-allowed; }

/* ============ 空状态 / 加载 ============ */
.empty { padding: 52px 20px; text-align: center; color: var(--muted); }
.empty .ico { font-size: 30px; opacity: .5; margin-bottom: 8px; }
.empty p { margin: 0; font-size: 13.5px; }
.loading { padding: 40px; text-align: center; color: var(--muted); font-size: 13px; }
.spinner {
  width: 18px; height: 18px; border: 2px solid #dbe3f0; border-top-color: var(--primary);
  border-radius: 50%; display: inline-block; animation: spin .7s linear infinite;
  vertical-align: -4px; margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ 大屏卡片 ============ */
.screen-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.screen-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; background: #fff; box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s, border-color .2s;
  position: relative; overflow: hidden;
}
.screen-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: #d3ddf0; }
.screen-card .sc-top { display: flex; align-items: flex-start; gap: 12px; }
.screen-card .sc-icon {
  width: 42px; height: 42px; border-radius: 10px; flex: 0 0 42px;
  background: linear-gradient(135deg, #e8f0ff, #dbe7ff);
  display: grid; place-items: center; font-size: 19px; color: var(--primary);
}
.screen-card .sc-name { font-size: 15px; font-weight: 600; word-break: break-all; }
.screen-card .sc-loc { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.screen-card .sc-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 16px; padding-top: 13px; border-top: 1px dashed var(--border);
}
.screen-card .sc-meta { font-size: 12px; color: var(--muted); }

/* ============ 上传区 ============ */
.uploader {
  border: 1.5px dashed #cdd8ea; border-radius: var(--radius);
  background: var(--surface-2); padding: 26px 18px; text-align: center;
  cursor: pointer; transition: all .18s;
}
.uploader:hover, .uploader.drag { border-color: var(--primary); background: var(--primary-soft); }
.uploader .up-ico { font-size: 26px; color: var(--primary); }
.uploader .up-title { font-size: 13.5px; margin-top: 6px; color: var(--text-2); }
.uploader .up-title b { color: var(--primary); }
.uploader .up-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.preview-box {
  margin-top: 12px; border: 1px solid var(--border); border-radius: 10px;
  padding: 10px; display: flex; gap: 12px; align-items: center; background: #fff;
}
.preview-box img, .preview-box video {
  width: 108px; height: 68px; object-fit: cover; border-radius: 7px; background: #0b1220;
}
.preview-box .pv-info { min-width: 0; flex: 1; }
.preview-box .pv-name { font-size: 13px; font-weight: 500; word-break: break-all; }
.preview-box .pv-size { font-size: 12px; color: var(--muted); }

/* 多文件预览网格（多张图片 / 单个视频） */
.pv-grid { margin-top: 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; }
.pv-item {
  position: relative; border: 1px solid var(--border); border-radius: 10px;
  padding: 8px; background: #fff; min-width: 0;
}
.pv-item img, .pv-item video {
  width: 100%; height: 84px; object-fit: cover; border-radius: 7px;
  background: #0b1220; display: block;
}
.pv-item .pv-name { font-size: 12px; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-item .pv-size { font-size: 11.5px; color: var(--muted); }
.pv-remove {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%;
  border: 0; background: rgba(15, 23, 42, .72); color: #fff; font-size: 13px; line-height: 1;
  cursor: pointer; display: grid; place-items: center; padding: 0;
}
.pv-remove:hover { background: #b91c1c; }
.pv-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; font-size: 12.5px; color: var(--muted); }

/* ============ 弹窗 ============ */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .48);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 60px 16px 30px; z-index: 100; overflow-y: auto;
  animation: fade .16s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 520px;
  box-shadow: var(--shadow-lg); animation: pop .18s ease;
  margin-bottom: 40px;
}
@keyframes pop { from { opacity: 0; transform: translateY(-8px) scale(.99); } to { opacity: 1; transform: none; } }
.modal.wide { max-width: 720px; }
.modal-head {
  padding: 17px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-head h3 { font-size: 15.5px; }
.modal-close {
  background: none; border: 0; font-size: 20px; line-height: 1;
  color: var(--muted); cursor: pointer; padding: 0 4px;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px; max-height: 66vh; overflow-y: auto; }
.modal-foot {
  padding: 14px 20px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px; background: var(--surface-2);
  border-radius: 0 0 14px 14px;
}

/* ============ 提示 ============ */
#toast-wrap { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 999; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: #1e293b; color: #fff; padding: 9px 16px; border-radius: 9px;
  font-size: 13.5px; box-shadow: var(--shadow); animation: drop .2s ease;
  max-width: 80vw; display: flex; align-items: center; gap: 8px;
}
.toast.err { background: #b91c1c; }
.toast.ok { background: #10794a; }
@keyframes drop { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

/* ============ 详情列表 ============ */
.detail-grid { display: grid; grid-template-columns: 104px 1fr; gap: 10px 14px; font-size: 13.5px; }
.detail-grid dt { color: var(--muted); }
.detail-grid dd { margin: 0; color: var(--text); word-break: break-word; }
.media-box { margin-top: 16px; border-radius: 10px; overflow: hidden; background: #0b1220; }
.media-box img, .media-box video { width: 100%; max-height: 380px; object-fit: contain; display: block; }
.media-box.compact img, .media-box.compact video { max-height: 240px; }
.media-empty { margin-top: 16px; padding: 30px; text-align: center; color: #94a3b8; border-radius: 10px; background: #0b1220; }

/* 缩略图上的张数角标 */
.thumb-wrap { position: relative; display: inline-block; flex: none; line-height: 0; }
.thumb-count {
  position: absolute; right: -5px; bottom: -5px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; background: rgba(15, 23, 42, .86); color: #fff; font-size: 10.5px;
  line-height: 17px; text-align: center; box-shadow: 0 0 0 2px #fff;
}

/* 多图轮播 */
.gallery { margin-top: 16px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #0b1220; }
.gal-main { background: #0b1220; }
.gal-main img { width: 100%; max-height: 300px; object-fit: contain; display: block; }
.gal-strip { display: flex; gap: 8px; padding: 10px; overflow-x: auto; background: #111a2b; }
.gal-thumb {
  flex: none; padding: 0; border: 2px solid transparent; border-radius: 7px;
  background: none; cursor: pointer; line-height: 0; opacity: .72; transition: opacity .15s, border-color .15s;
}
.gal-thumb img { width: 62px; height: 42px; object-fit: cover; border-radius: 5px; display: block; }
.gal-thumb:hover { opacity: 1; }
.gal-thumb.active { border-color: #4f8ef7; opacity: 1; }
.gal-tip { padding: 0 10px 10px; font-size: 12px; color: #94a3b8; background: #111a2b; }
.remark-box {
  margin-top: 14px; padding: 12px 14px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border); font-size: 13px;
}
.remark-box b { display: block; color: var(--text-2); font-size: 12px; margin-bottom: 4px; font-weight: 600; }
.alert {
  padding: 11px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 16px;
  background: var(--warning-soft); color: #8a5308; border: 1px solid #f6e0ba;
}
.alert.info { background: var(--primary-soft); color: #1e40af; border-color: #d5e2ff; }

/* ============ 响应式 ============ */
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 60; transform: translateX(-100%); transition: transform .22s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .layout { display: block; }
  .main { border-left: 0; }
  .content { padding: 16px 14px 40px; }
  .topbar { padding: 0 14px; }
  .form-row { grid-template-columns: 1fr; }
  .menu-btn { display: inline-flex !important; }
}
.menu-btn { display: none; }
