/* ==========================================================
   天智教育 网站后台（内容管理）样式
   ========================================================== */
:root {
  --brand: #e02020;
  --brand-2: #ff5a3c;
  --ink: #171b22;
  --ink-2: #4b5563;
  --ink-3: #8a94a6;
  --bg: #f4f6fa;
  --panel: #ffffff;
  --line: #e6eaf2;
  --ok: #00a870;
  --warn: #f5a623;
  --blue: #2f7cf6;
  --radius: 12px;
  --shadow: 0 6px 24px rgba(23, 27, 34, .07);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: 14px; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; }

/* ---------------- 登录 ---------------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: radial-gradient(1200px 600px at 20% 0%, #ffeceb 0%, transparent 60%), radial-gradient(900px 500px at 100% 100%, #e8f0ff 0%, transparent 55%), var(--bg); }
.login-card { width: 100%; max-width: 400px; background: var(--panel); border-radius: 18px; box-shadow: var(--shadow); padding: 34px 30px; }
.login-card .lg { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login-card .mark { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; font-weight: 800; font-size: 20px; }
.login-card h1 { font-size: 19px; }
.login-card .sub { color: var(--ink-3); font-size: 12px; }
.login-card .tip { color: var(--ink-3); font-size: 12px; margin-top: 14px; text-align: center; }

/* ---------------- 表单控件 ---------------- */
.fld { margin-bottom: 16px; }
.fld > label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.fld .hint { font-size: 12px; color: var(--ink-3); font-weight: 400; margin-top: 4px; }
input[type=text], input[type=password], input[type=number], textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(224,32,32,.1); }
textarea { min-height: 84px; resize: vertical; line-height: 1.7; }
textarea.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; min-height: 150px; }
input[type=color] { width: 44px; height: 34px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch input { width: auto; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ---------------- 按钮 ---------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 18px;
  border-radius: 10px; font-size: 14px; font-weight: 600; border: 1px solid transparent; background: #fff; color: var(--ink); }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; }
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost { border-color: var(--line); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-danger { color: #c1121f; border-color: #f3c7c7; background: #fff5f5; }
.btn-danger:hover { background: #ffe9e9; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------------- 主框架 ---------------- */
.wrap { display: flex; min-height: 100vh; }
.side { width: 214px; flex: 0 0 214px; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px 14px; }
.side .brand .mark { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; font-weight: 800; }
.side .brand b { display: block; font-size: 15px; }
.side .brand i { font-style: normal; font-size: 10px; letter-spacing: 1.4px; color: var(--ink-3); }
.side nav { flex: 1; overflow-y: auto; padding: 6px 10px 16px; }
.side nav a { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: 9px; color: var(--ink-2); font-size: 14px; margin-bottom: 2px; }
.side nav a:hover { background: #f2f5fa; color: var(--ink); }
.side nav a.on { background: rgba(224,32,32,.08); color: var(--brand); font-weight: 600; }
.side nav a .ic { width: 18px; text-align: center; }
.side .side-foot { border-top: 1px solid var(--line); padding: 12px; }
.side .me { font-size: 12px; color: var(--ink-3); margin-bottom: 8px; }
.side .me b { color: var(--ink); font-size: 13px; display: block; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mhead { position: sticky; top: 0; z-index: 20; background: rgba(244,246,250,.9); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); padding: 16px 24px; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.mhead h1 { font-size: 19px; }
.mhead .desc { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.mhead .mact { display: flex; gap: 8px; flex-wrap: wrap; }
.mbody { padding: 20px 24px 60px; }

/* ---------------- 卡片 / 表格 ---------------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px; }
.card > h3 { font-size: 15px; margin-bottom: 14px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat .n { font-size: 26px; font-weight: 800; color: var(--brand); letter-spacing: -.5px; }
.stat .l { font-size: 12.5px; color: var(--ink-3); }

table.tb { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.tb th, table.tb td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); font-size: 13.5px; vertical-align: middle; }
table.tb th { background: #fafbfe; font-size: 12.5px; color: var(--ink-3); font-weight: 600; white-space: nowrap; }
table.tb tr:last-child td { border-bottom: 0; }
table.tb td.op { white-space: nowrap; text-align: right; }
table.tb td .muted { color: var(--ink-3); }
.pill { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 6px; background: #eef2f8; color: var(--ink-2); }
.pill.off { background: #f4f4f4; color: var(--ink-3); }
.pill.on { background: rgba(0,168,112,.1); color: var(--ok); }
.empty { text-align: center; color: var(--ink-3); padding: 34px 0; }

/* ---------------- 弹层 ---------------- */
.mask { position: fixed; inset: 0; background: rgba(16,20,28,.45); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 200; overflow-y: auto; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 720px; box-shadow: 0 24px 60px rgba(0,0,0,.22); }
.modal.wide { max-width: 940px; }
.modal .mh { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal .mh h3 { font-size: 16px; }
.modal .mh .x { border: 0; background: transparent; font-size: 20px; color: var(--ink-3); line-height: 1; }
.modal .mb { padding: 20px 22px; }
.modal .mf { padding: 14px 22px 20px; display: flex; justify-content: flex-end; gap: 10px; }

/* ---------------- 提示 ---------------- */
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 500; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #171b22; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13.5px; box-shadow: 0 10px 30px rgba(0,0,0,.2); max-width: 340px; }
.toast.err { background: #c1121f; }
.toast.ok { background: #0a7d55; }

/* 图片上传 */
.img-up { display: flex; gap: 10px; align-items: flex-start; }
.img-up .pv { width: 76px; height: 76px; border-radius: 10px; border: 1px dashed var(--line); background: #fafbfe; display: flex; align-items: center; justify-content: center; color: var(--ink-3); font-size: 11px; overflow: hidden; flex: 0 0 76px; }
.img-up .pv img { width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 820px) {
  .wrap { flex-direction: column; }
  .side { width: 100%; flex: none; height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--line); }
  .side nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .side nav a { margin: 0; }
  .row2 { grid-template-columns: 1fr; }
  .mbody, .mhead { padding-left: 14px; padding-right: 14px; }
}
