/* 秋雀启程 · 管理后台（本地）样式 */
:root {
  --blue: #29B6F6; --blue-deep: #0288D1;
  --green: #7CB342; --green-deep: #558B2F;
  --orange: #FFB300; --orange-deep: #FF8F00;
  --red: #EF5350; --red-deep: #C62828;
  --ink: #34465A; --ink-soft: #6B7C93;
  --bg: #F2F6FB; --card: #FFFFFF;
  --text: #2D3A4B; --sub: #7A8BA3; --line: #E4EAF2;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea {
  font-family: inherit; font-size: 14px; padding: 8px 12px;
  border: 2px solid var(--line); border-radius: 10px; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); }

/* ---- 布局 ---- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 200px; background: linear-gradient(180deg, #1E3A52, #24475F);
  color: #fff; padding: 20px 12px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 20px; border-bottom: 1px solid rgba(255,255,255,.12); }
.brand-logo { width: 40px; height: 40px; border-radius: 12px; }
.brand-name { font-size: 17px; font-weight: 800; }
.brand-sub { font-size: 11px; color: rgba(255,255,255,.55); }
.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 16px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px;
  border-radius: 10px; border: none; background: transparent; color: rgba(255,255,255,.75);
  font-size: 14px; font-weight: 600; text-align: left; transition: background .15s;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: var(--blue); color: #fff; }
.nav-icon { font-size: 17px; }
.sidebar-foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid rgba(255,255,255,.12); font-size: 11px; color: rgba(255,255,255,.5); line-height: 1.6; }

.main { flex: 1; padding: 24px 28px 60px; min-width: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
.page-title { font-size: 22px; font-weight: 800; }
.page-desc { font-size: 13px; color: var(--sub); margin-top: 4px; }

/* ---- 卡片 / 表格 ---- */
.card { background: var(--card); border-radius: 14px; padding: 20px; box-shadow: 0 2px 10px rgba(52,70,90,.06); }
.card + .card { margin-top: 16px; }
.card-title { font-size: 15px; font-weight: 800; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat-card { background: var(--card); border-radius: 14px; padding: 16px 18px; box-shadow: 0 2px 10px rgba(52,70,90,.06); border-left: 5px solid var(--blue); }
.stat-card.green { border-left-color: var(--green); }
.stat-card.orange { border-left-color: var(--orange); }
.stat-card.red { border-left-color: var(--red); }
.stat-num { font-size: 26px; font-weight: 800; }
.stat-label { font-size: 12px; color: var(--sub); margin-top: 2px; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
th { font-size: 12px; color: var(--sub); font-weight: 700; background: #F8FAFD; position: sticky; top: 0; }
tr:hover td { background: #F8FBFF; }
.table-wrap { overflow: auto; max-height: calc(100vh - 260px); border: 1px solid var(--line); border-radius: 12px; background: #fff; }

/* ---- 徽标 / 按钮 ---- */
.tag { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.tag-online { background: #E8F5E9; color: var(--green-deep); }
.tag-draft { background: #FFF8E1; color: var(--orange-deep); }
.tag-offline { background: #FFEBEE; color: var(--red-deep); }
.tag-mod { background: #E7F4FE; color: var(--blue-deep); }
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px;
  border-radius: 10px; border: 2px solid var(--ink); background: #fff;
  font-size: 13px; font-weight: 700; color: var(--text);
  box-shadow: 3px 3px 0 rgba(52,70,90,.12); transition: transform .1s, box-shadow .1s;
}
.btn:hover { transform: translate(1px,1px); box-shadow: 2px 2px 0 rgba(52,70,90,.12); }
.btn-primary { background: linear-gradient(180deg, #4FC3F7, var(--blue)); color: #fff; }
.btn-green { background: linear-gradient(180deg, #AED581, var(--green)); color: #fff; }
.btn-orange { background: linear-gradient(180deg, #FFCA28, var(--orange)); color: #5D4037; }
.btn-red { background: linear-gradient(180deg, #EF9A9A, var(--red)); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 12px; border-width: 2px; box-shadow: 2px 2px 0 rgba(52,70,90,.12); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---- 工具条 ---- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar input, .toolbar select { min-width: 130px; }
.toolbar .spacer { flex: 1; }

/* ---- 弹窗 ---- */
.mask { position: fixed; inset: 0; background: rgba(30,40,60,.5); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 100; overflow: auto; }
.dialog { background: #fff; border-radius: 16px; width: 100%; max-width: 720px; padding: 24px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.dialog-title { font-size: 17px; font-weight: 800; }
.dialog-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.form-row { display: flex; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.form-row > label { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--sub); font-weight: 700; }
.form-row > label input, .form-row > label select, .form-row > label textarea { font-weight: 500; color: var(--text); }
textarea { min-height: 70px; resize: vertical; }

/* ---- 媒体库 ---- */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.media-item { border: 2px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.media-thumb { height: 110px; display: flex; align-items: center; justify-content: center; background: #F4F8FD; font-size: 34px; overflow: hidden; }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-body { padding: 8px 10px; }
.media-name { font-size: 12px; font-weight: 700; word-break: break-all; line-height: 1.4; }
.media-id { font-size: 10px; color: var(--sub); word-break: break-all; margin: 4px 0 8px; line-height: 1.4; }
.media-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---- 绘本编辑器 ---- */
.page-row { border: 2px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; background: #FCFDFF; }
.page-row-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.page-no { width: 26px; height: 26px; border-radius: 8px; background: var(--blue); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; flex-shrink: 0; }
.page-preview { width: 72px; height: 72px; border-radius: 10px; border: 2px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 30px; overflow: hidden; flex-shrink: 0; background: #fff; }
.page-preview img { width: 100%; height: 100%; object-fit: cover; }

/* ---- Toast ---- */
#toast { position: fixed; left: 50%; top: 24px; transform: translateX(-50%); background: rgba(40,50,65,.92); color: #fff; padding: 10px 22px; border-radius: 999px; font-size: 13px; font-weight: 600; z-index: 200; display: none; }
#toast.show { display: block; }

.empty { text-align: center; padding: 48px 0; color: var(--sub); }
.empty-emoji { font-size: 44px; margin-bottom: 10px; }
.hint { font-size: 12px; color: var(--sub); line-height: 1.7; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.flex { display: flex; align-items: center; gap: 8px; }
