* { box-sizing: border-box; margin: 0; padding: 0; }
:root{
  --blue:#2F6BFF; --blue-d:#1E4FD8; --red:#F2544B; --ink:#1A2340; --muted:#8A97AE;
  --line:#E8ECF4; --bg:#F5F7FB; --card:#fff; --soft:#F0F4FF; --green:#16A34A;
}
body{ font-family:-apple-system,"PingFang SC","Microsoft YaHei",sans-serif; color:var(--ink); background:var(--bg); font-size:14px; }
.hidden{ display:none !important; }
button,input,select,textarea{ font-family:inherit; font-size:14px; outline:none; }

/* 登录 */
.login-wrap{ min-height:100vh; display:flex; align-items:center; justify-content:center;
  background:linear-gradient(135deg,#2F6BFF 0%,#5B8DEF 55%,#EEF3FF 100%); }
.login-card{ width:380px; background:#fff; border-radius:18px; padding:40px 36px; box-shadow:0 20px 60px rgba(30,60,120,.22); text-align:center; }
.login-logo{ margin-bottom:12px; }
.logo-mark{ display:inline-flex; width:44px; height:44px; border-radius:12px; background:linear-gradient(135deg,var(--blue),var(--red)); color:#fff; font-size:24px; font-weight:800; align-items:center; justify-content:center; }
.login-card h1{ font-size:22px; margin-bottom:6px; }
.login-sub{ color:var(--muted); margin-bottom:26px; }
.form-group{ text-align:left; margin-bottom:16px; }
.form-group label{ display:block; font-size:12px; color:var(--muted); margin-bottom:6px; font-weight:600; }
.form-group input,.form-group select,.form-group textarea{ width:100%; height:42px; border:1px solid var(--line); border-radius:9px; padding:0 12px; transition:.2s; }
.form-group textarea{ height:auto; padding:10px 12px; resize:vertical; }
.form-group input:focus,.form-group select:focus,.form-group textarea:focus{ border-color:var(--blue); box-shadow:0 0 0 3px rgba(47,107,255,.12); }
.login-err{ color:var(--red); font-size:12px; min-height:18px; text-align:left; margin-bottom:6px; }
.btn-primary{ background:var(--blue); color:#fff; border:none; border-radius:9px; height:40px; padding:0 18px; cursor:pointer; font-weight:600; transition:.2s; }
.btn-primary:hover{ background:var(--blue-d); }
.btn-primary.full{ width:100%; height:44px; font-size:15px; }
.login-hint{ margin-top:18px; font-size:11px; color:var(--muted); }

/* 布局 */
.app{ display:flex; min-height:100vh; }
.sidebar{ width:220px; background:#fff; border-right:1px solid var(--line); display:flex; flex-direction:column; position:fixed; top:0; bottom:0; left:0; z-index:10; }
.brand{ height:64px; display:flex; align-items:center; gap:10px; padding:0 20px; font-weight:700; font-size:16px; border-bottom:1px solid var(--line); }
.brand .logo-mark{ width:32px; height:32px; font-size:18px; border-radius:9px; }
.nav{ flex:1; padding:12px 0; overflow-y:auto; }
.nav-group{ font-size:11px; color:var(--muted); padding:14px 20px 6px; letter-spacing:1px; }
.nav-item{ height:42px; display:flex; align-items:center; gap:10px; padding:0 20px; cursor:pointer; color:#4a5670; transition:.15s; border-left:3px solid transparent; }
.nav-item i{ font-style:normal; width:18px; text-align:center; font-size:15px; }
.nav-item:hover{ background:var(--soft); }
.nav-item.active{ background:var(--soft); color:var(--blue); font-weight:600; border-left-color:var(--blue); }
.sidebar-foot{ padding:14px 18px; border-top:1px solid var(--line); }
.admin-info{ font-size:12px; color:var(--muted); margin-bottom:8px; }
.btn-logout{ width:100%; height:34px; background:#fff; border:1px solid var(--line); border-radius:8px; cursor:pointer; color:#667; }
.btn-logout:hover{ border-color:var(--red); color:var(--red); }
.main{ flex:1; margin-left:220px; width:calc(100% - 220px); }
.topbar{ height:64px; background:#fff; border-bottom:1px solid var(--line); display:flex; align-items:center; justify-content:space-between; padding:0 28px; font-size:16px; font-weight:600; position:sticky; top:0; z-index:5; }
.topbar-right{ font-size:12px; color:var(--muted); font-weight:400; }
.content{ padding:24px 28px; }

/* 卡片 / 通用 */
.card{ background:var(--card); border-radius:14px; padding:20px; box-shadow:0 2px 12px rgba(30,50,100,.04); margin-bottom:18px; }
.card-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; }
.card-head h2{ font-size:16px; }
.row{ display:flex; gap:12px; flex-wrap:wrap; }
.row > *{ flex:1; min-width:160px; }
.toolbar{ display:flex; gap:10px; align-items:center; margin-bottom:16px; flex-wrap:wrap; }
.toolbar input,.toolbar select{ height:36px; border:1px solid var(--line); border-radius:8px; padding:0 10px; }
.toolbar .spacer{ flex:1; }
.btn{ height:36px; padding:0 14px; border-radius:8px; border:1px solid var(--line); background:#fff; cursor:pointer; font-weight:500; }
.btn:hover{ border-color:var(--blue); color:var(--blue); }
.btn.primary{ background:var(--blue); color:#fff; border-color:var(--blue); }
.btn.primary:hover{ background:var(--blue-d); color:#fff; }
.btn.danger{ color:var(--red); }
.btn.sm{ height:30px; padding:0 10px; font-size:12px; }

/* 统计卡 */
.stats{ display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:16px; margin-bottom:20px; }
.stat-card{ background:#fff; border-radius:14px; padding:20px; box-shadow:0 2px 12px rgba(30,50,100,.04); display:flex; align-items:center; gap:14px; }
.stat-ic{ width:46px; height:46px; border-radius:12px; display:flex; align-items:center; justify-content:center; font-size:22px; background:var(--soft); color:var(--blue); }
.stat-card .num{ font-size:26px; font-weight:700; }
.stat-card .lab{ font-size:12px; color:var(--muted); margin-top:2px; }

/* 表格 */
table{ width:100%; border-collapse:collapse; }
th,td{ text-align:left; padding:11px 12px; border-bottom:1px solid var(--line); font-size:13px; vertical-align:middle; }
th{ color:var(--muted); font-weight:600; font-size:12px; background:#FAFBFE; }
tr:hover td{ background:#FAFCFF; }
.tag{ display:inline-block; padding:3px 9px; border-radius:20px; font-size:11px; background:var(--soft); color:var(--blue); }
.tag.green{ background:#E8F8EF; color:var(--green); }
.tag.red{ background:#FDECEB; color:var(--red); }
.tag.gray{ background:#F0F2F6; color:#899; }
.actions button{ border:none; background:none; color:var(--blue); cursor:pointer; font-size:12px; padding:2px 6px; }
.actions button.del{ color:var(--red); }
.empty{ text-align:center; color:var(--muted); padding:40px; }

/* 模态框 */
.modal{ position:fixed; inset:0; z-index:50; display:flex; align-items:center; justify-content:center; }
.modal-mask{ position:absolute; inset:0; background:rgba(20,30,60,.45); }
.modal-box{ position:relative; background:#fff; border-radius:14px; width:min(760px,92vw); max-height:88vh; display:flex; flex-direction:column; box-shadow:0 24px 70px rgba(0,0,0,.25); }
.modal-head{ height:54px; display:flex; align-items:center; justify-content:space-between; padding:0 22px; border-bottom:1px solid var(--line); font-weight:600; font-size:16px; }
.modal-x{ font-size:24px; cursor:pointer; color:var(--muted); line-height:1; }
.modal-body{ padding:22px; overflow-y:auto; flex:1; }
.modal-foot{ padding:14px 22px; border-top:1px solid var(--line); display:flex; justify-content:flex-end; gap:10px; }

/* 富文本编辑器 */
.editor-toolbar{ display:flex; gap:4px; flex-wrap:wrap; padding:8px; border:1px solid var(--line); border-bottom:none; border-radius:9px 9px 0 0; background:#FAFBFE; }
.editor-toolbar button{ min-width:30px; height:28px; border:1px solid transparent; background:#fff; border-radius:5px; cursor:pointer; }
.editor-toolbar button:hover{ border-color:var(--blue); }
.editor-area{ min-height:320px; border:1px solid var(--line); border-radius:0 0 9px 9px; padding:14px; line-height:1.7; overflow-y:auto; }
.editor-area:focus{ border-color:var(--blue); }
.editor-area img{ max-width:100%; height:auto; }
.img-size-tip{ font-size:11px; color:var(--muted); background:var(--soft); border-radius:6px; padding:6px 10px; margin-top:8px; }

/* 题目编辑 */
.q-item{ border:1px solid var(--line); border-radius:10px; padding:14px; margin-bottom:12px; background:#fff; }
.q-item .q-head{ display:flex; gap:10px; align-items:center; margin-bottom:10px; }
.q-item .q-head input{ flex:1; }
.opt-row{ display:flex; gap:8px; margin-bottom:6px; align-items:center; }
.opt-row input{ flex:1; }

/* toast */
.toast{ position:fixed; top:24px; left:50%; transform:translateX(-50%) translateY(-80px); background:var(--ink); color:#fff; padding:11px 22px; border-radius:9px; z-index:100; opacity:0; transition:.25s; font-size:13px; }
.toast.show{ opacity:1; transform:translateX(-50%) translateY(0); }
.pagination{ display:flex; gap:8px; align-items:center; justify-content:flex-end; margin-top:14px; font-size:12px; color:var(--muted); }
