/* 上海库锞职业技能培训学校 · 后台样式 */

:root {
  --brand: #003090;
  --brand-deep: #00246e;
  --brand-ink: #00173d;
  --ink: #111826;
  --ink-2: #2b3444;
  --muted: #5d6573;
  --line: #e2dcd0;
  --line-strong: #cfc6b6;
  --paper: #fff;
  --cream: #f8f5ef;
  --brass: #8a5f2a;
  --brass-soft: #f0e3cf;
  --ok: #1c7a4a;
  --warn: #9a6a12;
  --danger: #b3372c;
  --radius: 10px;
  --shadow: 0 18px 40px -26px rgba(7, 26, 61, .45);
  --font-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STZhongsong", "SimSun", Georgia, serif;
  --font-sans: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Noto Sans SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--cream); color: var(--ink);
  font-family: var(--font-sans); font-size: 15px; line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- 登录页 ---------- */
.login-page {
  min-height: 100vh; display: grid; place-items: center;
  padding: 32px 20px;
  background:
    radial-gradient(900px 520px at 78% -10%, #ffffff 0%, rgba(255, 255, 255, 0) 60%),
    linear-gradient(180deg, #f8f5ef 0%, #ffffff 100%);
}
.login-card {
  width: min(420px, 100%); background: var(--paper);
  border: 1px solid var(--line); border-radius: 16px;
  padding: 32px 28px 28px; box-shadow: var(--shadow);
}
.login-card__logo { height: 38px; width: auto; }
.login-card h1 { margin: 22px 0 0; font-family: var(--font-serif); font-size: 24px; }
.login-card p.sub { margin: 8px 0 0; color: var(--muted); font-size: 13.5px; }
.login-form { margin-top: 24px; display: grid; gap: 16px; }
.login-card .hint { margin-top: 18px; font-size: 12.5px; color: var(--muted); }
.login-error {
  margin-top: 4px; padding: 10px 12px; border-radius: 8px;
  background: #fdf1ef; border: 1px solid #ecd3ce; color: var(--danger); font-size: 13px;
}
.login-error[hidden] { display: none; }
.login-foot { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }

/* ---------- 通用表单控件 ---------- */
.field { display: grid; gap: 7px; }
.field > label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  background: #fff; border: 1px solid var(--line-strong); border-radius: 8px;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.textarea { min-height: 220px; resize: vertical; line-height: 1.7; }
.input:focus, .select:focus, .textarea:focus {
  outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0, 48, 144, .12);
}
.field__error { font-size: 12px; color: var(--danger); }
.field__error[hidden] { display: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 9px 18px; border-radius: 999px;
  border: 1px solid var(--brand); background: var(--brand); color: #fff;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.btn:hover { background: var(--brand-deep); border-color: var(--brand-deep); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn--ghost { background: transparent; color: var(--brand); border-color: var(--line-strong); }
.btn--ghost:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn--danger { background: transparent; border-color: #e6c9c4; color: var(--danger); }
.btn--danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn--sm { min-height: 34px; padding: 5px 12px; font-size: 13px; }
.btn--block { width: 100%; }

/* ---------- 后台框架 ---------- */
.admin-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .95); backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.admin-header__inner {
  max-width: 1200px; margin-inline: auto; padding: 12px 24px;
  display: flex; align-items: center; gap: 20px;
}
.admin-header__logo { height: 36px; width: auto; }
.admin-header__title { font-size: 13px; color: var(--muted); padding-left: 14px; border-left: 1px solid var(--line); }
.admin-header__spacer { margin-left: auto; }
.admin-user { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.admin-user b { color: var(--ink); }

.admin-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-tabs button {
  padding: 8px 16px; border-radius: 999px; border: 1px solid transparent;
  background: transparent; color: var(--ink-2); font-size: 14px; cursor: pointer;
}
.admin-tabs button[aria-selected="true"] { background: #eef2fb; border-color: #dbe4f7; color: var(--brand); font-weight: 600; }

.admin-main { max-width: 1200px; margin-inline: auto; padding: 26px 24px 64px; }
.admin-section[hidden] { display: none; }

.panel {
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 10px 30px -28px rgba(7, 26, 61, .5);
}
.panel__head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
  padding: 18px 22px; border-bottom: 1px solid var(--line);
}
.panel__head h2 { margin: 0; font-family: var(--font-serif); font-size: 20px; }
.panel__head .spacer { margin-left: auto; }
.panel__body { padding: 20px 22px; }
.panel__body--flush { padding: 0; }

.meta-line { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 12.5px; color: var(--muted); }

.table-scroll { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; min-width: 760px; font-size: 14px; }
table.list th, table.list td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list th { font-size: 12.5px; color: var(--muted); font-weight: 600; background: #fdfcf9; white-space: nowrap; }
table.list tr:last-child td { border-bottom: 0; }
table.list td .title { font-weight: 600; color: var(--ink); display: block; max-width: 340px; }
table.list td .sub { display: block; font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.row-actions { display: flex; gap: 8px; white-space: nowrap; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--published { color: var(--ok); background: #eaf5ee; }
.badge--scheduled { color: var(--warn); background: #fbf1dd; }
.badge--draft { color: var(--muted); background: #f1efe9; }
.badge--kind { color: var(--brand); background: #eef2fb; }
.badge--kind::before { display: none; }

.empty {
  padding: 46px 24px; text-align: center; color: var(--muted);
}
.empty b { display: block; color: var(--ink); font-family: var(--font-serif); font-size: 18px; margin-bottom: 6px; }

/* ---------- 编辑器 ---------- */
.editor {
  position: fixed; inset: 0; z-index: 60; display: none;
}
.editor[data-open="true"] { display: block; }
.editor__overlay { position: absolute; inset: 0; background: rgba(7, 26, 61, .42); }
.editor__panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(760px, 94vw); background: var(--paper);
  display: flex; flex-direction: column; box-shadow: -20px 0 60px -40px #000;
  transform: translateX(100%); transition: transform .26s cubic-bezier(.22, .8, .3, 1);
}
.editor[data-open="true"] .editor__panel { transform: none; }
.editor__head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 22px; border-bottom: 1px solid var(--line);
}
.editor__head h2 { margin: 0; font-family: var(--font-serif); font-size: 19px; }
.editor__head .spacer { margin-left: auto; }
.editor__close {
  width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: transparent; cursor: pointer; font-size: 18px; line-height: 1;
}
.editor__body { padding: 20px 22px 28px; overflow-y: auto; display: grid; gap: 18px; }
.editor__foot {
  padding: 14px 22px; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: flex-end;
  background: #fdfcf9;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.upload-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.thumb {
  width: 132px; height: 84px; border-radius: 8px; overflow: hidden;
  border: 1px dashed var(--line-strong); background: var(--cream);
  display: grid; place-items: center; color: var(--muted); font-size: 12px;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }

.radio-row { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.radio-row label { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px);
  padding: 11px 18px; border-radius: 999px; background: var(--brand-ink); color: #fff;
  font-size: 13.5px; opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
  z-index: 80;
}
.toast[data-show="true"] { opacity: 1; transform: translate(-50%, 0); }
.toast--error { background: #7d2a22; }

@media (max-width: 860px) {
  .admin-header__title { display: none; }
  .admin-main { padding: 18px 16px 72px; }
  .grid-2 { grid-template-columns: 1fr; }
  .editor__panel { width: 100%; }
  .admin-tabs button { padding: 7px 12px; font-size: 13px; }
}