/* ============================================================
 * 管理后台样式（admin-style.css）
 *
 * 定位：桌面优先的数据仪表盘。清爽白底 + 青绿强调色。
 * 与孩子端/家长端**互不影响** —— 这个页面不引主站 css/style.css。
 * ============================================================ */

:root {
  --bg: #F4F7F9;
  --card: #FFFFFF;
  --ink: #16232E;
  --ink-2: #46586A;
  --muted: #7C8B99;
  --line: #E3E9EF;
  --line-soft: #EFF4F7;
  --brand: #0E9F9F;
  --brand-dk: #0A7C7C;
  --brand-soft: #E4F5F5;
  --amber: #EFA22C;
  --violet: #7C6BF0;
  --good: #16A34A;
  --good-soft: #E6F7EC;
  --warn: #C2761A;
  --warn-soft: #FDF3E3;
  --bad: #D93B3B;
  --bad-soft: #FDECEC;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 35, 46, .05), 0 10px 28px -18px rgba(16, 35, 46, .28);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body.admin-body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
a { color: var(--brand-dk); text-decoration: none; }
[hidden] { display: none !important; }

/* ==================== 登录 ==================== */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 32px 20px;
  background:
    radial-gradient(900px 420px at 50% -140px, #D9F0F0 0%, rgba(217, 240, 240, 0) 70%),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--card); border-radius: 20px;
  box-shadow: 0 2px 6px rgba(16,35,46,.06), 0 24px 60px -32px rgba(16,35,46,.35);
  padding: 34px 30px 26px;
  display: flex; flex-direction: column;
  border: 1px solid var(--line);
}
.login-logo { font-size: 40px; line-height: 1; text-align: center; }
.login-card h1 { font-size: 21px; font-weight: 700; text-align: center; margin-top: 10px; letter-spacing: .5px; }
.login-sub { font-size: 13px; color: var(--muted); text-align: center; margin: 6px 0 22px; }
.login-card label { font-size: 12.5px; color: var(--ink-2); font-weight: 600; margin: 0 0 6px 2px; }
.login-card input {
  width: 100%; padding: 12px 14px; font-size: 15px; font-family: inherit;
  border: 1.5px solid var(--line); border-radius: 10px; background: #FAFCFD;
  color: var(--ink); outline: none; margin-bottom: 16px;
  transition: border-color .16s, box-shadow .16s, background .16s;
  -webkit-user-select: text; user-select: text;
}
.login-card input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(14,159,159,.14); }
.login-err {
  background: var(--bad-soft); color: var(--bad); border-radius: 10px;
  padding: 10px 13px; font-size: 13px; margin-bottom: 14px; line-height: 1.45;
}
.login-back { text-align: center; font-size: 12.5px; color: var(--muted); margin-top: 16px; }

/* ==================== 按钮 ==================== */
.btn-primary {
  background: var(--brand); color: #fff; font-weight: 600; font-size: 15px;
  padding: 12px 20px; border-radius: 10px; width: 100%;
  box-shadow: 0 2px 8px rgba(14,159,159,.28);
  transition: background .16s, transform .1s;
}
.btn-primary:hover { background: var(--brand-dk); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: .6; cursor: default; box-shadow: none; }

.btn-ghost {
  font-size: 13px; color: var(--ink-2); padding: 7px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; transition: background .14s, color .14s, border-color .14s;
}
.btn-ghost:hover { background: var(--brand-soft); color: var(--brand-dk); border-color: #BFE4E4; }
.btn-ghost.danger:hover { background: var(--bad-soft); color: var(--bad); border-color: #F3C9C9; }

.btn-sm {
  font-size: 12.5px; padding: 6px 11px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  transition: background .14s, color .14s, border-color .14s; white-space: nowrap;
}
.btn-sm:hover { background: var(--brand-soft); color: var(--brand-dk); border-color: #BFE4E4; }
.btn-sm.warn:hover { background: var(--warn-soft); color: var(--warn); border-color: #EBD3A8; }
.btn-sm.danger { color: var(--bad); border-color: #F3C9C9; }
.btn-sm.danger:hover { background: var(--bad-soft); }

/* ==================== 顶栏 ==================== */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 22px;
  padding: 0 24px; height: 60px;
  background: rgba(255,255,255,.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-brand { display: flex; align-items: baseline; gap: 8px; flex: none; }
.brand-ico { font-size: 19px; }
.topbar-brand b { font-size: 16px; font-weight: 700; letter-spacing: .3px; }
.brand-sub { font-size: 12px; color: var(--muted); }
.topnav { display: flex; gap: 4px; }
.tnav {
  font-size: 14px; color: var(--ink-2); padding: 7px 15px; border-radius: 9px;
  transition: background .14s, color .14s;
}
.tnav:hover { background: var(--line-soft); }
.tnav.active { background: var(--brand-soft); color: var(--brand-dk); font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.who { font-size: 12.5px; color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ==================== 主体 ==================== */
.main { max-width: 1320px; margin: 0 auto; padding: 24px 24px 72px; }
.view-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.view-head h2 { font-size: 19px; font-weight: 700; }
.count { font-size: 13px; color: var(--muted); font-weight: 400; margin-left: 4px; }
.view-head .tools { margin-left: auto; display: flex; gap: 10px; }
.view-head input[type="search"], .view-head select {
  font-family: inherit; font-size: 13.5px; color: var(--ink);
  padding: 8px 12px; border: 1.5px solid var(--line); border-radius: 9px;
  background: #fff; outline: none; min-width: 180px;
}
.view-head input[type="search"]:focus, .view-head select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14,159,159,.12); }

.seg { margin-left: auto; display: flex; gap: 2px; padding: 3px; background: #E9EFF3; border-radius: 10px; }
.seg button { font-size: 13px; padding: 6px 14px; border-radius: 8px; color: var(--ink-2); }
.seg button.on { background: #fff; color: var(--brand-dk); font-weight: 600; box-shadow: 0 1px 3px rgba(16,35,46,.1); }

/* ==================== KPI ==================== */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 16px; box-shadow: var(--shadow);
}
.kpi .kpi-k { font-size: 12.5px; color: var(--muted); font-weight: 600; letter-spacing: .3px; }
.kpi .kpi-v { font-size: 27px; font-weight: 700; margin: 7px 0 4px; line-height: 1.05; letter-spacing: -.5px; }
.kpi .kpi-s { font-size: 11.5px; color: var(--muted); }
.kpi.good .kpi-v { color: var(--good); }
.kpi.warn .kpi-v { color: var(--warn); }
.kpi.brand .kpi-v { color: var(--brand-dk); }

/* ==================== 面板 ==================== */
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden;
}
.grid-2 .panel { margin-bottom: 0; }
.panel-hd {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--line-soft);
}
.panel-hd h3 { font-size: 14.5px; font-weight: 700; }
.phint { font-size: 12px; color: var(--muted); margin-left: auto; }

/* ==================== 柱状图 ==================== */
.chart {
  display: flex; align-items: flex-end; gap: 3px;
  padding: 18px; height: 216px;
}
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; min-width: 0; height: 100%; }
.chart .bar-wrap { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.chart .bar {
  width: min(100%, 30px); display: flex; flex-direction: column; justify-content: flex-end;
  border-radius: 4px 4px 2px 2px; overflow: hidden; background: var(--line-soft);
}
.chart .bar-s { background: var(--brand); width: 100%; }
.chart .bar-q { background: var(--amber); width: 100%; }
.chart .col-lbl { font-size: 10px; color: var(--muted); margin-top: 7px; white-space: nowrap; transform: rotate(-38deg); transform-origin: center; }
.chart .col:hover .bar { outline: 2px solid rgba(14,159,159,.3); outline-offset: 1px; }
.legend { display: flex; gap: 16px; padding: 0 18px 16px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; }

/* ==================== 排行 ==================== */
.rank { padding: 12px 18px 18px; }
.rank-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.rank-i { font-size: 11.5px; color: var(--muted); width: 18px; flex: none; font-weight: 600; }
.rank-name { font-size: 13.5px; width: 34%; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-bar { flex: 1; height: 8px; background: var(--line-soft); border-radius: 5px; overflow: hidden; }
.rank-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), #46C4C4); border-radius: 5px; }
.rank-v { font-size: 12.5px; color: var(--ink-2); width: 62px; text-align: right; flex: none; font-variant-numeric: tabular-nums; }
.empty-row { padding: 26px 18px; text-align: center; color: var(--muted); font-size: 13px; }

/* ==================== 表格 ==================== */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th {
  text-align: left; font-size: 11.5px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px;
  padding: 11px 16px; background: #FAFCFD; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.tbl td { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl tbody tr:hover { background: #FAFCFD; }
table.tbl .num { font-variant-numeric: tabular-nums; }
table.tbl .who-cell { display: flex; flex-direction: column; gap: 2px; }
table.tbl .who-cell b { font-weight: 600; font-size: 13.5px; }
table.tbl .who-cell span { font-size: 11.5px; color: var(--muted); }
table.tbl .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }

/* ==================== 徽标 ==================== */
.badge {
  display: inline-block; font-size: 11.5px; font-weight: 600; line-height: 1;
  padding: 5px 9px; border-radius: 7px; white-space: nowrap;
}
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.brand { background: var(--brand-soft); color: var(--brand-dk); }
.badge.gray { background: var(--line-soft); color: var(--ink-2); }
.badge.violet { background: #EFECFE; color: #5A47D6; }

/* ==================== 分页 ==================== */
.pager { display: flex; align-items: center; gap: 10px; justify-content: center; padding: 18px 0 4px; }
.pager .pg-info { font-size: 13px; color: var(--muted); }

/* ==================== 抽屉 ==================== */
.drawer-mask {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(16,35,46,.34); backdrop-filter: blur(2px);
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 61;
  width: min(720px, 100%);
  background: var(--bg); border-left: 1px solid var(--line);
  box-shadow: -20px 0 60px -30px rgba(16,35,46,.5);
  overflow-y: auto;
  animation: slide-in .22s cubic-bezier(.2,.7,.3,1);
}
@keyframes slide-in { from { transform: translateX(26px); opacity: .4; } to { transform: none; opacity: 1; } }

.dw-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: flex-start; gap: 14px;
  padding: 20px 22px 16px; background: rgba(255,255,255,.96);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.dw-avatar {
  width: 44px; height: 44px; border-radius: 12px; flex: none;
  background: var(--brand-soft); color: var(--brand-dk);
  display: flex; align-items: center; justify-content: center; font-size: 21px; font-weight: 700;
}
.dw-title { min-width: 0; flex: 1; }
.dw-title h3 { font-size: 16px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dw-title .dw-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dw-close { font-size: 20px; color: var(--muted); padding: 4px 8px; border-radius: 8px; line-height: 1; flex: none; }
.dw-close:hover { background: var(--line-soft); color: var(--ink); }
.dw-body { padding: 18px 22px 40px; }

.dw-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }

.dw-section { margin-bottom: 20px; }
.dw-section > h4 {
  font-size: 12.5px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .6px; margin-bottom: 10px;
}
.dw-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 10px; }
.dw-kpi {
  background: #fff; border: 1px solid var(--line); border-radius: 11px; padding: 11px 13px;
}
.dw-kpi .v { font-size: 19px; font-weight: 700; }
.dw-kpi .k { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

.child-card2 {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 15px; margin-bottom: 9px;
  display: flex; align-items: center; gap: 13px;
}
.child-card2 .cc-emo { font-size: 25px; flex: none; }
.child-card2 .cc-b { flex: 1; min-width: 0; }
.child-card2 .cc-b b { font-size: 14.5px; }
.child-card2 .cc-b .cc-m { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

.spark { display: flex; align-items: flex-end; gap: 2px; height: 54px; background: #fff;
  border: 1px solid var(--line); border-radius: 11px; padding: 9px 11px; }
.spark i { flex: 1; background: var(--brand); border-radius: 2px 2px 0 0; min-height: 2px; opacity: .85; }
.spark i.zero { background: var(--line); opacity: 1; }

/* ==================== 提示条 ==================== */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%);
  z-index: 90; background: #16232E; color: #fff;
  padding: 11px 20px; border-radius: 11px; font-size: 13.5px;
  box-shadow: 0 10px 34px -12px rgba(0,0,0,.5);
  animation: toast-in .2s ease;
  max-width: min(560px, 88vw); text-align: center; line-height: 1.45;
}
.toast.bad { background: #A32B2B; }
.toast.good { background: #157A3C; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

.loading { padding: 40px; text-align: center; color: var(--muted); font-size: 13.5px; }

/* ==================== 响应式 ==================== */
@media (max-width: 940px) {
  .grid-2 { grid-template-columns: 1fr; }
  .topbar { gap: 12px; padding: 0 14px; height: auto; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
  .topbar-right { margin-left: 0; width: 100%; }
  .who { display: none; }
  .main { padding: 16px 14px 60px; }
}
@media (max-width: 620px) {
  .view-head .tools { margin-left: 0; width: 100%; }
  .view-head input[type="search"] { flex: 1; min-width: 0; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .chart { height: 176px; padding: 14px 10px; }
  .chart .col-lbl { transform: rotate(-52deg); }
  .drawer { width: 100%; }
}
