/* ==========================================================================
   游文小学 · 七彩诚雅少年积分系统  |  设计系统
   ========================================================================== */
:root {
  --bg: #f5f6fa;
  --panel: #ffffff;
  --panel-2: #fbfbfd;
  --ink: #171923;
  --ink-2: #3d4250;
  --muted: #6b7280;
  --line: #e6e8ef;
  --line-2: #eef0f6;

  --brand: #4f46e5;
  --brand-2: #7c6cf3;
  --brand-soft: #eef0ff;
  --ok: #16a34a;
  --ok-soft: #e8f7ee;
  --warn: #d97706;
  --warn-soft: #fef4e6;
  --danger: #dc2626;
  --danger-soft: #fdecec;

  --red: #e5484d;
  --orange: #f76b15;
  --yellow: #eab308;
  --green: #30a46c;
  --cyan: #0ea5a5;
  --blue: #0090ff;
  --purple: #8e4ec6;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(18, 21, 40, .05);
  --shadow: 0 4px 16px rgba(18, 21, 40, .07);
  --shadow-lg: 0 18px 48px rgba(18, 21, 40, .14);
  --header-h: 62px;
  --sidebar-w: 226px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.6;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
img { max-width: 100%; }
::selection { background: #ddd8ff; }

/* ---------- 基础控件 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: .16s ease;
}
.btn:hover { border-color: #cdd2e0; background: #fafbff; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: #4338ca; border-color: #4338ca; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: #f2f3f9; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn-lg { height: 46px; padding: 0 24px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-icon { width: 34px; padding: 0; }

.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
  outline: none; transition: .16s;
}
.textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 76px; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.hint { font-size: 12px; color: var(--muted); }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-pad { padding: 18px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line-2);
}
.card-head h3 { font-size: 15px; }
.card-body { padding: 18px; }

.tag {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px;
  border-radius: 999px; background: #f2f3f9; color: var(--ink-2);
  font-size: 12px; font-weight: 600;
}
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }
.tag-danger { background: var(--danger-soft); color: var(--danger); }
.tag-brand { background: var(--brand-soft); color: var(--brand); }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* 七色卡配色工具类 */
.c-red { color: var(--red); } .bg-red { background: var(--red); }
.c-orange { color: var(--orange); } .bg-orange { background: var(--orange); }
.c-yellow { color: #b45309; } .bg-yellow { background: var(--yellow); }
.c-green { color: var(--green); } .bg-green { background: var(--green); }
.c-cyan { color: var(--cyan); } .bg-cyan { background: var(--cyan); }
.c-blue { color: var(--blue); } .bg-blue { background: var(--blue); }
.c-purple { color: var(--purple); } .bg-purple { background: var(--purple); }

/* ---------- 首页 ---------- */
.landing {
  min-height: 100%; position: relative; overflow-x: hidden;
  background:
    radial-gradient(900px 460px at 12% -10%, #e9e6ff 0%, transparent 60%),
    radial-gradient(760px 420px at 92% 0%, #dff4ff 0%, transparent 58%),
    var(--bg);
}
.landing-nav {
  max-width: 1120px; margin: 0 auto; height: 72px; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand-mark { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .02em; }
.brand-logo {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, #6d63ff, #b06cf0 55%, #ff8a5c);
  color: #fff; font-size: 17px; box-shadow: 0 6px 16px rgba(109, 99, 255, .3);
}
.hero { max-width: 1120px; margin: 0 auto; padding: 44px 24px 20px; text-align: center; }
.hero h1 { font-size: 44px; line-height: 1.2; letter-spacing: -.02em; }
.hero h1 em {
  font-style: normal;
  background: linear-gradient(100deg, #4f46e5, #8b5cf6 40%, #ec4899 70%, #f59e0b);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p.lead { margin: 16px auto 0; max-width: 620px; color: var(--muted); font-size: 16px; }
.hero-actions { margin-top: 26px; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.rainbow-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 28px 0 6px; }
.rainbow-card {
  width: 108px; padding: 12px 8px; border-radius: 14px; background: #fff;
  border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; color: var(--ink-2); text-align: center;
  transition: .2s;
}
.rainbow-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.rainbow-card .bar { width: 26px; height: 5px; border-radius: 4px; }

.feature-grid {
  max-width: 1120px; margin: 34px auto 0; padding: 0 24px 60px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px;
}
.feature { padding: 22px; border-radius: 16px; background: #fff; border: 1px solid var(--line); }
.feature .ico {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  font-size: 20px; background: var(--brand-soft); margin-bottom: 12px;
}
.feature h3 { font-size: 16px; margin-bottom: 6px; }
.feature p { color: var(--muted); font-size: 13.5px; }

.lookup-panel {
  max-width: 620px; margin: 30px auto 0; padding: 22px;
  background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
}
.lookup-form { display: flex; gap: 10px; margin-top: 12px; }

/* ---------- 登录页 ---------- */
.auth-wrap {
  min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr;
  background: var(--bg);
}
.auth-aside {
  position: relative; overflow: hidden; padding: 54px 56px;
  background: linear-gradient(150deg, #4f46e5 0%, #6d5cf0 42%, #a855f7 78%, #ec4899 130%);
  color: #fff; display: flex; flex-direction: column; justify-content: space-between;
}
.auth-aside::after {
  content: ""; position: absolute; right: -120px; bottom: -140px;
  width: 380px; height: 380px; border-radius: 50%;
  background: rgba(255, 255, 255, .12);
}
.auth-aside h2 { font-size: 30px; line-height: 1.35; max-width: 460px; }
.auth-aside p { margin-top: 14px; color: rgba(255, 255, 255, .82); max-width: 420px; }
.auth-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; position: relative; z-index: 1; }
.auth-chips span {
  padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .22);
}
.auth-main { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { font-size: 26px; margin-bottom: 6px; }
.auth-card .sub { color: var(--muted); margin-bottom: 24px; font-size: 13.5px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form .input { height: 44px; border-radius: 12px; }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }

/* ---------- 后台框架 ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); background: #fff;
  border-right: 1px solid var(--line); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; z-index: 30;
}
.sidebar-brand {
  height: var(--header-h); display: flex; align-items: center; gap: 10px;
  padding: 0 16px; border-bottom: 1px solid var(--line-2); font-weight: 800; font-size: 13.5px;
}
.nav { padding: 10px 10px 20px; overflow-y: auto; flex: 1; }
.nav-group { margin-top: 12px; }
.nav-label { font-size: 11px; font-weight: 700; color: #9aa1b1; letter-spacing: .08em; padding: 6px 10px; }
.nav a {
  display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: 9px;
  color: var(--ink-2); font-weight: 600; font-size: 13.5px; margin-bottom: 2px;
  text-decoration: none; transition: .14s;
}
.nav a:hover { background: #f5f6fb; }
.nav a.active { background: var(--brand-soft); color: var(--brand); }
.nav a .ni { width: 18px; text-align: center; font-size: 14px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--header-h); background: rgba(255, 255, 255, .88); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center;
  justify-content: space-between; padding: 0 20px; position: sticky; top: 0; z-index: 20;
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar h1 { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-chip {
  display: flex; align-items: center; gap: 8px; padding: 5px 10px 5px 5px;
  border-radius: 999px; background: #f5f6fb; border: 1px solid var(--line);
}
.avatar {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, #6d63ff, #b06cf0); color: #fff; font-size: 12px; font-weight: 700;
}
.content { padding: 22px; max-width: 1440px; width: 100%; margin: 0 auto; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { font-size: 20px; }
.page-head p { color: var(--muted); font-size: 13px; margin-top: 3px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }

/* 统计卡 */
.stat { padding: 16px 18px; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); }
.stat .k { font-size: 12.5px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.stat .v { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin-top: 6px; line-height: 1.15; }
.stat .s { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat.accent { background: linear-gradient(140deg, #4f46e5, #7c6cf3); color: #fff; border-color: transparent; }
.stat.accent .k, .stat.accent .s { color: rgba(255, 255, 255, .8); }

/* 七色卡按钮 */
.card-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.card-chip {
  position: relative; padding: 14px; border-radius: 14px; border: 1.5px solid var(--line);
  background: #fff; cursor: pointer; text-align: left; transition: .16s;
  display: flex; align-items: center; gap: 10px;
}
.card-chip:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.card-chip.active { border-color: currentColor; box-shadow: 0 0 0 3px rgba(79, 70, 229, .1); }
.card-chip .swatch { width: 26px; height: 26px; border-radius: 8px; flex: 0 0 auto; }
.card-chip .nm { font-weight: 700; font-size: 13.5px; color: var(--ink); }
.card-chip .ds { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }

/* 学生选择 */
.stu-picker { display: flex; flex-wrap: wrap; gap: 8px; max-height: 300px; overflow-y: auto; padding: 2px; }
.stu-chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 13px; font-weight: 600;
  transition: .14s; user-select: none;
}
.stu-chip:hover { border-color: #c7cbe0; background: #fafbff; }
.stu-chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.stu-chip .pt { font-size: 11px; opacity: .7; font-weight: 700; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th {
  text-align: left; font-size: 12px; color: var(--muted); font-weight: 700;
  padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--panel-2);
}
table.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.tbl tbody tr:hover { background: #fafbff; }
table.tbl tbody tr:last-child td { border-bottom: 0; }
.num { font-variant-numeric: tabular-nums; }
.empty { text-align: center; color: var(--muted); padding: 34px 12px; font-size: 13px; }
.empty .big { font-size: 30px; display: block; margin-bottom: 6px; opacity: .5; }

/* 动态流 */
.feed-item { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px dashed var(--line-2); }
.feed-item:last-child { border-bottom: 0; }
.feed-ico {
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: 9px;
  display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 800;
}

/* 排行榜 */
.rank-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line-2); }
.rank-item:last-child { border-bottom: 0; }
.rank-no {
  width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  font-size: 12px; font-weight: 800; background: #f2f3f9; color: var(--muted); flex: 0 0 auto;
}
.rank-no.top1 { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #fff; }
.rank-no.top2 { background: linear-gradient(135deg, #cbd5e1, #94a3b8); color: #fff; }
.rank-no.top3 { background: linear-gradient(135deg, #fca5a5, #f87171); color: #fff; }
.rank-name { font-weight: 700; font-size: 13.5px; }
.rank-sub { font-size: 11.5px; color: var(--muted); }
.rank-val { margin-left: auto; font-weight: 800; font-variant-numeric: tabular-nums; }

/* 条形图 */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 120px; }
.bars .b { flex: 1; background: linear-gradient(180deg, #a5b4fc, #6366f1); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.bars .b:hover { background: linear-gradient(180deg, #818cf8, #4f46e5); }
.bars-labels { display: flex; gap: 4px; margin-top: 6px; }
.bars-labels span { flex: 1; text-align: center; font-size: 10px; color: var(--muted); }

.meter { height: 8px; border-radius: 999px; background: #eef0f6; overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #6d63ff, #a855f7); }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(18, 21, 40, .45); backdrop-filter: blur(2px);
  display: grid; place-items: center; z-index: 100; padding: 20px; animation: fade .16s ease;
}
.modal {
  width: 100%; max-width: 460px; max-height: 86vh; overflow-y: auto; background: #fff;
  border-radius: 16px; box-shadow: var(--shadow-lg); animation: pop .18s ease;
}
.modal.wide { max-width: 720px; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line-2); display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 8px; }
@keyframes fade { from { opacity: 0 } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98) } }

/* 提示 */
.toast-wrap { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  padding: 10px 18px; border-radius: 10px; background: #1f2333; color: #fff; font-size: 13.5px;
  box-shadow: var(--shadow-lg); animation: pop .18s ease; max-width: 90vw;
}
.toast.ok { background: #15803d; }
.toast.err { background: #b91c1c; }

/* 标签页 */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs button {
  height: 38px; padding: 0 14px; border: 0; background: transparent; color: var(--muted);
  font-weight: 700; font-size: 13.5px; cursor: pointer; border-bottom: 2px solid transparent;
}
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }

/* 扫码 */
.scan-box { display: grid; gap: 14px; place-items: center; }
.scan-frame {
  width: 100%; max-width: 340px; aspect-ratio: 1; border-radius: 16px; overflow: hidden;
  background: #0f1220; position: relative; display: grid; place-items: center; color: #8b93a7;
}
.scan-frame video { width: 100%; height: 100%; object-fit: cover; }
.scan-target { position: absolute; width: 62%; aspect-ratio: 1; border: 2px solid rgba(255,255,255,.75); border-radius: 12px; pointer-events: none; }

/* 宠物 */
.pet-card { text-align: center; padding: 18px; }
.pet-avatar { font-size: 46px; line-height: 1; }
.pet-name { font-weight: 800; margin-top: 6px; }
.pet-lv { font-size: 12px; color: var(--muted); }

/* 二维码打印 */
.qr-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.qr-cell {
  border: 1px solid var(--line); border-radius: 10px; padding: 8px; text-align: center;
  break-inside: avoid; page-break-inside: avoid; background: #fff;
}
.qr-cell img { width: 100%; height: auto; display: block; }
.qr-cell .n { font-size: 12px; font-weight: 700; margin-top: 4px; }
.qr-cell .no { font-size: 10px; color: var(--muted); }

/* 移动端 */
.mobile-toggle { display: none; }
@media (max-width: 1080px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: 1fr; }
}
@media (max-width: 880px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .feature-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 30px; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%);
    transition: transform .22s ease; box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: none; }
  .mobile-toggle { display: inline-flex; }
  .content { padding: 14px; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .qr-grid { grid-template-columns: repeat(2, 1fr); }
  .lookup-form { flex-direction: column; }
  .topbar { padding: 0 12px; }
  .user-chip .uname, .user-chip .urole { display: none; }
}

/* 打印 */
@media print {
  .sidebar, .topbar, .page-actions, .no-print, .modal-foot, .tabs { display: none !important; }
  body { background: #fff; }
  .content { padding: 0; max-width: none; }
  .modal-mask { position: static; background: none; padding: 0; display: block; }
  .modal, .modal.wide { max-width: none; box-shadow: none; border-radius: 0; }
  .qr-grid { grid-template-columns: repeat(4, 1fr); }
  .print-only { display: block !important; }
  .card { break-inside: avoid; }
}
.print-only { display: none; }
