:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #6f7890;
  --line: #e4e8f1;
  --brand: #3659d9;
  --brand-dark: #2543ba;
  --brand-soft: #eef2ff;
  --danger: #d93f4c;
  --success: #1e9b63;
  --warning: #e9982d;
  --shadow: 0 18px 48px rgba(30, 47, 86, 0.09);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 1080px;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.boot { display: grid; min-height: 100vh; place-items: center; color: var(--muted); }

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  background: #fff;
}
.login-brand {
  position: relative;
  overflow: hidden;
  padding: 72px;
  color: #fff;
  background: linear-gradient(145deg, #172d8c, #3f66e7 64%, #6b85eb);
}
.login-brand::before, .login-brand::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.14);
}
.login-brand::before { width: 520px; height: 520px; right: -170px; top: -190px; }
.login-brand::after { width: 340px; height: 340px; left: -110px; bottom: -130px; }
.logo-mark {
  display: inline-grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 14px;
  background: rgba(255,255,255,.16);
  font-weight: 800;
  font-size: 24px;
}
.login-brand h1 { margin: 150px 0 20px; font-size: 44px; letter-spacing: 2px; }
.login-brand p { width: 480px; max-width: 90%; color: rgba(255,255,255,.76); line-height: 1.9; font-size: 17px; }
.login-wrap { display: grid; place-items: center; padding: 60px; }
.login-card { width: 390px; }
.login-card h2 { margin: 0 0 10px; font-size: 30px; }
.login-card .hint { margin: 0 0 38px; color: var(--muted); }

.field { display: grid; gap: 9px; margin-bottom: 20px; }
.field label { font-size: 14px; font-weight: 650; }
.input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  outline: none;
  padding: 12px 13px;
  transition: border-color .2s, box-shadow .2s;
}
.input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(54,89,217,.1); }
textarea { resize: vertical; min-height: 110px; }
.btn {
  border: 0;
  border-radius: 10px;
  padding: 11px 18px;
  background: #edf0f6;
  color: var(--ink);
  font-weight: 650;
}
.btn:hover { filter: brightness(.98); }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { color: var(--danger); background: #fff0f1; }
.btn.small { padding: 7px 10px; border-radius: 8px; font-size: 12px; white-space: nowrap; }
.btn.full { width: 100%; padding: 13px; }
.btn:disabled { cursor: not-allowed; opacity: .55; }

.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 236px;
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  background: #14213e;
  color: #fff;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 27px; font-size: 18px; font-weight: 750; }
.brand .logo-mark { width: 37px; height: 37px; border-radius: 10px; font-size: 18px; background: #4f70e8; }
.nav { display: grid; gap: 5px; }
.nav button {
  border: 0;
  border-radius: 9px;
  padding: 12px 14px;
  text-align: left;
  color: #aeb9d2;
  background: transparent;
}
.nav button:hover, .nav button.active { color: #fff; background: rgba(255,255,255,.09); }
.nav button.active { box-shadow: inset 3px 0 #7190ff; }
.sidebar-foot { margin-top: auto; padding: 16px 10px 0; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-foot strong { display: block; font-size: 14px; }
.sidebar-foot span { display: block; margin-top: 5px; color: #95a3c1; font-size: 12px; }
.sidebar-foot button { margin-top: 14px; border: 0; padding: 0; background: none; color: #b7c2da; }

.main { grid-column: 2; min-width: 0; }
.topbar {
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 34px;
  background: rgba(255,255,255,.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.topbar h1 { margin: 0; font-size: 20px; }
.topbar .status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(30,155,99,.12); }
.content { padding: 30px 34px 50px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 22px; }
.page-head h2 { margin: 0 0 7px; font-size: 24px; }
.page-head p { margin: 0; color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.stat-card, .panel {
  background: var(--panel);
  border: 1px solid rgba(228,232,241,.8);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.stat-card { padding: 22px; }
.stat-card .label { color: var(--muted); font-size: 14px; }
.stat-card .value { margin-top: 12px; font-size: 31px; font-weight: 760; }
.stat-card .note { margin-top: 9px; color: #9aa2b5; font-size: 12px; }
.panel { margin-top: 20px; padding: 22px; }
.panel h3 { margin: 0 0 18px; font-size: 17px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; }
.toolbar .input { width: 280px; }
.toolbar select { width: 160px; }
.toolbar .grow { flex: 1; }

table { width: 100%; border-collapse: collapse; }
th { padding: 12px; color: var(--muted); font-size: 13px; font-weight: 650; text-align: left; border-bottom: 1px solid var(--line); }
td { padding: 14px 12px; font-size: 14px; border-bottom: 1px solid #eef1f6; }
tr:last-child td { border-bottom: 0; }
.empty { padding: 55px 20px; text-align: center; color: var(--muted); }
.badge { display: inline-flex; border-radius: 999px; padding: 5px 9px; font-size: 12px; background: #eef1f6; color: #586175; }
.badge.published { background: #e9f8f1; color: #188755; }
.badge.pending_review { background: #fff6e8; color: #b56b0c; }
.badge.rejected, .badge.processing_failed { background: #fff0f1; color: #c33340; }
.badge.draft { background: #eef2ff; color: #3d59c4; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.actions { display: flex; align-items: center; gap: 6px; }

.upload-box { border: 1px dashed #b9c4df; border-radius: 12px; padding: 24px; background: #f9fbff; }
.file-list { display: grid; gap: 8px; margin-top: 14px; }
.file-row { display: flex; justify-content: space-between; gap: 16px; padding: 10px 12px; background: #fff; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.upload-status { margin-top: 16px; padding: 13px 15px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-dark); font-size: 13px; }
.upload-status[hidden] { display: none; }
.material-description { margin: 0; color: var(--ink); line-height: 1.8; white-space: pre-wrap; }
.material-meta { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 18px; color: var(--muted); font-size: 13px; }
.preview-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.preview-card { display: grid; gap: 9px; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); text-decoration: none; background: #fff; }
.preview-card img, .preview-card video { width: 100%; height: 210px; object-fit: contain; border-radius: 8px; background: #f2f4f8; }
.preview-card strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.preview-card span { color: var(--muted); font-size: 12px; }
.preview-placeholder, .file-icon { display: grid; height: 210px; place-items: center; border-radius: 8px; background: #f2f4f8; color: var(--muted); }
.file-icon { color: var(--brand); font-size: 23px; font-weight: 800; }
.notice { padding: 13px 15px; border-radius: 10px; background: #fff8e9; color: #936018; font-size: 13px; line-height: 1.6; }
.notice.ok { background: #eaf8f2; color: #187e52; }
.notice.error { background: #fff0f1; color: #b42d3a; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.staff-edit-actions { display: flex; gap: 10px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.staff-edit-actions[hidden] { display: none; }

.toast {
  position: fixed;
  z-index: 20;
  right: 25px;
  bottom: 25px;
  max-width: 390px;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  border-radius: 10px;
  padding: 13px 17px;
  background: #172033;
  color: #fff;
  box-shadow: var(--shadow);
  transition: .2s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #b82f3c; }
.loading { opacity: .55; pointer-events: none; }

@media (max-width: 1200px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
}
