:root{
  --paper:#F6F2E8; --card:#FFFCF5; --ink:#17150F; --ink2:#3A362D; --muted:#8B8474;
  --line:#E7DFCE; --seal:#B93E2A; --seal-d:#8C2A19; --teal:#2D5A66; --gold:#BF9440;
  --jade:#4C7A62; --sand:#EFE8D8; --shadow:0 12px 30px -22px rgba(40,30,15,.55);
  --serif:"Songti SC","STSong","Noto Serif SC",serif;
  --ui:"PingFang SC","HarmonyOS Sans SC","Microsoft YaHei",-apple-system,BlinkMacSystemFont,sans-serif;
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{height:100%}
body{
  margin:0;background:var(--paper);color:var(--ink);font-family:var(--ui);font-size:14px;
  -webkit-font-smoothing:antialiased;
  background-image:radial-gradient(70% 50% at 100% 0%,#FFFDF6,transparent 60%),radial-gradient(60% 40% at 0% 100%,#EFE7D6,transparent 60%);
}
button,input,select,textarea{font-family:inherit;font-size:inherit;color:inherit}
button{cursor:pointer;border:0;background:none;padding:0}
a{color:inherit;text-decoration:none}
.hidden{display:none !important}

/* ---------- login ---------- */
.login{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;padding:24px;z-index:100;
  background:radial-gradient(90% 70% at 80% 0%,#2C2822,#14130E 70%)}
.login-card{width:100%;max-width:360px;text-align:center;color:#EDE6D6}
.brand-mark{width:64px;height:64px;border-radius:16px;margin:0 auto 18px;display:flex;align-items:center;justify-content:center;
  background:linear-gradient(150deg,#C9452C,#8A2A19);box-shadow:0 14px 30px -12px rgba(201,69,44,.8);
  font-family:var(--serif);font-size:32px;color:#FBEFDA}
.brand-mark.sm{width:38px;height:38px;border-radius:10px;font-size:19px;margin:0}
.login-title{font-family:var(--serif);font-size:30px;letter-spacing:.16em}
.login-sub{font-size:11px;color:#8E8676;letter-spacing:.12em;margin:8px 0 28px}
.pin-input{width:100%;height:48px;border-radius:12px;border:1px solid rgba(255,255,255,.14);background:rgba(255,255,255,.06);
  color:#F6F2E8;text-align:center;letter-spacing:.4em;font-size:18px;outline:none;margin-bottom:12px}
.pin-input::placeholder{letter-spacing:.1em;font-size:13px;color:#7E7665}
.login-hint{margin-top:16px;font-size:10.5px;color:#7E7665;line-height:1.8}
.login-hint b{color:#C9BDA6}
.login-err{min-height:18px;margin-top:8px;font-size:11px;color:#E8896A}

/* ---------- shell ---------- */
.shell{display:grid;grid-template-columns:224px 1fr;min-height:100vh}
.sidebar{position:sticky;top:0;height:100vh;background:#15140F;color:#CFC7B6;display:flex;flex-direction:column;padding:20px 14px 14px}
.side-brand{display:flex;align-items:center;gap:11px;padding:0 6px 20px}
.side-brand b{font-family:var(--serif);font-size:15px;letter-spacing:.1em;color:#EDE6D6;display:block}
.side-brand small{display:block;font-size:8.5px;letter-spacing:.18em;color:#7E7665;margin-top:3px}
.side-nav{display:flex;flex-direction:column;gap:2px;flex:1;overflow-y:auto;min-height:0}
.side-nav a{display:flex;align-items:center;gap:10px;padding:10px 12px;border-radius:9px;font-size:12.5px;color:#ABA392;transition:.16s}
.side-nav a .ic{width:22px;height:22px;border-radius:6px;background:rgba(255,255,255,.05);display:flex;align-items:center;justify-content:center;
  font-family:var(--serif);font-size:11px;color:#8E8676}
.side-nav a:hover{background:rgba(255,255,255,.05);color:#EDE6D6}
.side-nav a.on{background:rgba(226,96,63,.15);color:#FAEDD8}
.side-nav a.on .ic{background:var(--seal);color:#FBEFDA}
.side-foot{margin-top:auto;padding:14px 10px 4px;border-top:1px solid rgba(255,255,255,.08);font-size:10px;color:#7E7665;line-height:1.8}
.sync-dot{color:#7FA88C}

.main{min-width:0;display:flex;flex-direction:column}
.topbar{position:sticky;top:0;z-index:20;display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:16px 28px 12px;background:rgba(246,242,232,.9);-webkit-backdrop-filter:blur(10px);border-bottom:1px solid rgba(231,223,206,.6)}
.topbar-title h1{margin:0;font-family:var(--serif);font-size:22px;font-weight:600;letter-spacing:.02em}
.topbar-title .sub{font-size:10.5px;color:var(--muted);margin-top:4px;letter-spacing:.06em}
.topbar-actions{display:flex;align-items:center;gap:10px}
.icon-btn{width:34px;height:34px;border-radius:10px;border:1px solid var(--line);background:rgba(255,255,255,.6);color:var(--ink2);font-size:16px}
.icon-btn:active{transform:scale(.96)}
.avatar{width:34px;height:34px;border-radius:50%;background:#F2E2DA;color:#A8432B;display:flex;align-items:center;justify-content:center;
  font-family:var(--serif);font-size:13px;font-weight:600}
.view{padding:20px 28px 40px;max-width:1180px;width:100%;margin:0 auto}

/* ---------- common ---------- */
.grid{display:grid;gap:12px}
.kpis{grid-template-columns:repeat(auto-fit,minmax(170px,1fr))}
.card{background:var(--card);border:1px solid var(--line);border-radius:16px;padding:16px;box-shadow:var(--shadow)}
.card.tight{padding:12px}
.card-title{font-size:13px;font-weight:600;display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:10px}
.kpi .k{font-size:10.5px;color:var(--muted);letter-spacing:.04em}
.kpi .v{font-family:var(--serif);font-size:30px;font-weight:600;line-height:1.2;margin-top:6px}
.kpi .d{font-size:10px;color:var(--muted);margin-top:6px}
.kpi .v small{font-size:12px;font-family:var(--ui);color:var(--muted);margin-left:2px}
.red{color:var(--seal)}.jade{color:var(--jade)}.gold{color:var(--gold)}.teal{color:var(--teal)}
.muted{color:var(--muted)}
.sec{display:flex;align-items:flex-end;justify-content:space-between;margin:24px 2px 10px}
.sec h2{margin:0;font-family:var(--serif);font-size:17px;font-weight:600}
.sec .link{font-size:11px;color:var(--seal);cursor:pointer}

.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;height:38px;padding:0 14px;border-radius:10px;
  background:var(--ink);color:#F7EFDD;font-size:12px;font-weight:600;border:1px solid transparent;transition:.15s;white-space:nowrap}
.btn:active{transform:scale(.98)}
.btn-primary{background:var(--seal);color:#FFF1E4}
.btn-ghost{background:transparent;border-color:var(--line);color:var(--ink2);font-weight:500}
.btn-soft{background:var(--sand);color:var(--ink2);font-weight:500}
.btn-sm{height:30px;font-size:10.5px;border-radius:8px;padding:0 10px}
.btn-block{width:100%}
.btn:disabled{opacity:.45;cursor:not-allowed}
.btn-group{display:flex;gap:8px;flex-wrap:wrap}

.chip{display:inline-flex;align-items:center;gap:4px;height:22px;padding:0 9px;border-radius:99px;background:#F0EADB;color:#6E6655;
  font-size:10px;white-space:nowrap;font-weight:500}
.chip.jade{background:#E4EEE7;color:#3A6A51}
.chip.red{background:#F9E5DE;color:#A5371F}
.chip.gold{background:#F6EBCF;color:#856018}
.chip.teal{background:#E1EBE9;color:#21515B}
.chip.ghost{background:transparent;border:1px solid var(--line);color:#7C7462}
.dot{width:6px;height:6px;border-radius:50%;background:currentColor;display:inline-block}

/* lists */
.list{display:flex;flex-direction:column}
.row-item{display:flex;align-items:center;gap:12px;padding:12px 0;border-bottom:1px dashed var(--line)}
.row-item:last-child{border-bottom:0;padding-bottom:0}
.row-item:first-child{padding-top:0}
.row-main{flex:1;min-width:0}
.row-title{font-size:13px;font-weight:500;display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.row-sub{font-size:10.5px;color:var(--muted);margin-top:3px;line-height:1.55}
.avatar-sm{width:34px;height:34px;border-radius:50%;display:flex;align-items:center;justify-content:center;
  font-family:var(--serif);font-size:12px;font-weight:600;flex:none}
.t1{background:#F2E2DA;color:#A8432B}.t2{background:#E1EAE7;color:#2F6459}.t3{background:#EDE8D4;color:#7C6720}
.t4{background:#E3E6EE;color:#435172}.t5{background:#F0E4E7;color:#8A4356}.t6{background:#E8E5DC;color:#5F5A4C}

.bar{height:6px;border-radius:99px;background:#ECE5D4;overflow:hidden}
.bar > i{display:block;height:100%;border-radius:99px;background:linear-gradient(90deg,#B93E2A,#DB7B52)}
.bar.jade > i{background:linear-gradient(90deg,#4C7A62,#7FA88C)}

.empty{padding:34px 10px;text-align:center;color:var(--muted);font-size:12px}
.empty b{display:block;font-family:var(--serif);font-size:16px;color:var(--ink2);margin-bottom:6px}

/* table */
.table-wrap{overflow-x:auto;margin:0 -4px}
table{border-collapse:collapse;width:100%;font-size:12px;min-width:620px}
th{text-align:left;font-weight:500;color:var(--muted);font-size:10px;letter-spacing:.06em;padding:8px 10px;border-bottom:1px solid var(--line);white-space:nowrap}
td{padding:10px;border-bottom:1px dashed var(--line);white-space:nowrap}
tr:last-child td{border-bottom:0}
tr.click{cursor:pointer}
tr.click:hover td{background:#FBF6E9}
.num-cell{font-family:var(--serif);font-size:13px}

/* tabs */
.tabs{display:flex;gap:4px;background:#EDE6D5;border-radius:11px;padding:3px;margin-bottom:14px}
.tabs button{flex:1;height:32px;border-radius:8px;font-size:11.5px;color:#6F6857}
.tabs button.on{background:var(--card);color:var(--ink);font-weight:600;box-shadow:0 2px 8px -4px rgba(0,0,0,.2)}

/* forms */
.field{margin-bottom:12px}
.field label{display:block;font-size:10.5px;color:var(--muted);margin-bottom:5px}
.field input,.field select,.field textarea{width:100%;height:38px;border:1px solid var(--line);border-radius:9px;background:#FFFCF5;padding:0 11px;outline:none}
.field textarea{height:76px;padding:9px 11px;resize:vertical}
.field input:focus,.field select:focus,.field textarea:focus{border-color:#D9C7A4}
.field-row{display:flex;gap:10px}
.field-row .field{flex:1}

/* attendance roster */
.roster{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:10px}
.stu-card{background:var(--card);border:1px solid var(--line);border-radius:13px;padding:12px}
.stu-head{display:flex;align-items:center;gap:10px;margin-bottom:10px}
.stu-actions{display:flex;gap:6px}
.stu-actions button{flex:1;height:30px;border-radius:7px;font-size:10.5px;border:1px solid var(--line);background:#FFFDF8;color:#6E6655}
.stu-actions button.on[data-st="present"]{background:#E4EEE7;border-color:#9BC0AC;color:#2F6459;font-weight:600}
.stu-actions button.on[data-st="late"]{background:#F6EBCF;border-color:#DCC08A;color:#856018;font-weight:600}
.stu-actions button.on[data-st="leave"]{background:#EFE8D8;border-color:#D8CBAA;color:#6E6655;font-weight:600}
.stu-actions button.on[data-st="absent"]{background:#F9E5DE;border-color:#E3B4A4;color:#A5371F;font-weight:600}
.stu-meta{font-size:10px;color:var(--muted);display:flex;justify-content:space-between}

/* date bar */
.datebar{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:14px}
.datebar .date{font-family:var(--serif);font-size:18px;font-weight:600}
.datebar input[type=date]{height:34px;border:1px solid var(--line);border-radius:8px;background:#FFFCF5;padding:0 8px}

/* week */
.week{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:8px}
.day{background:var(--card);border:1px solid var(--line);border-radius:12px;padding:9px;min-height:120px}
.day h4{margin:0 0 6px;font-size:10px;color:var(--muted);font-weight:500;display:flex;justify-content:space-between}
.day h4 b{font-family:var(--serif);font-size:13px;color:var(--ink2)}
.ev{border-left:3px solid var(--seal);background:#FBF6E9;border-radius:6px;padding:5px 6px;margin-bottom:5px;font-size:9.5px;line-height:1.35;cursor:pointer}
.ev small{display:block;color:var(--muted);font-size:8.5px;margin-top:2px}

/* modal / toast */
.modal{position:fixed;inset:0;background:rgba(20,18,12,.45);display:none;align-items:center;justify-content:center;padding:16px;z-index:90}
.modal.on{display:flex}
.modal-card{width:100%;max-width:440px;background:var(--card);border-radius:18px;padding:20px;max-height:88vh;overflow:auto;box-shadow:0 30px 70px -30px rgba(0,0,0,.5)}
.modal-card h3{margin:0 0 4px;font-family:var(--serif);font-size:19px}
.modal-card .sub{font-size:10.5px;color:var(--muted);margin-bottom:14px}
.modal-actions{display:flex;gap:8px;margin-top:16px}
.modal-actions .btn{flex:1}
.toast{position:fixed;left:50%;bottom:90px;transform:translate(-50%,12px);background:rgba(23,21,15,.94);color:#F7EFDD;
  font-size:12px;padding:10px 16px;border-radius:99px;opacity:0;pointer-events:none;transition:.24s;z-index:120;max-width:82%;text-align:center}
.toast.on{opacity:1;transform:translate(-50%,0)}
.toast.err{background:#8C2A19}

/* bottom nav */
.bottomnav{display:none}
@media (max-width:820px){
  .shell{grid-template-columns:1fr}
  .sidebar{display:none}
  .topbar{padding:12px 16px 10px}
  .topbar-title h1{font-size:19px}
  .view{padding:14px 14px 96px}
  .bottomnav{display:flex;position:fixed;left:0;right:0;bottom:0;z-index:40;background:rgba(255,252,245,.97);
    border-top:1px solid var(--line);padding-bottom:env(safe-area-inset-bottom)}
  .bottomnav a{flex:1;display:flex;flex-direction:column;align-items:center;gap:3px;padding:8px 0 6px;font-size:9.5px;color:#9A927F}
  .bottomnav a .bn-ic{width:28px;height:22px;border-radius:6px;display:flex;align-items:center;justify-content:center;font-family:var(--serif);font-size:12px}
  .bottomnav a.on{color:var(--seal)}
  .bottomnav a.on .bn-ic{background:#F9E5DE}
  .kpi .v{font-size:26px}
  .kpis{grid-template-columns:repeat(2,minmax(0,1fr))}
  .week{grid-template-columns:1fr;gap:6px}
  .day{min-height:auto}
  .roster{grid-template-columns:1fr}
}
@media (max-width:480px){
  .field-row{flex-direction:column;gap:0}
  .datebar{gap:8px}
  .datebar .date{font-size:16px}
}

/* ---------- 教务工具 ---------- */
.tool{display:flex;align-items:center;gap:12px;cursor:pointer;transition:.16s}
.tool:hover{border-color:#D8CBAA;transform:translateY(-1px)}
.tool-ic{width:40px;height:40px;border-radius:11px;background:#F3E8D2;color:#8C6A1E;display:flex;align-items:center;justify-content:center;
  font-family:var(--serif);font-size:18px;flex:none}
.tool-arrow{margin-left:auto;color:#C9BDA6}

/* ---------- 教学总结 ---------- */
.summary-text{font-size:11.5px;color:#5F5849;line-height:1.8;margin-top:10px;
  display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}

/* ---------- 美育 ---------- */
.feature{border-radius:18px;padding:22px;color:#FFF6EC;position:relative;overflow:hidden;margin-top:2px}
.feature:after{content:"美";position:absolute;right:18px;bottom:-16px;font-family:var(--serif);font-size:110px;color:rgba(255,255,255,.08)}
.feature-cat{font-size:9px;letter-spacing:.22em;opacity:.75}
.feature-title{font-family:var(--serif);font-size:24px;margin:8px 0 6px;line-height:1.3}
.feature-sub{font-size:11.5px;opacity:.8;margin-bottom:14px;max-width:80%}
.aes-card{cursor:pointer;transition:.16s}
.aes-card:hover{border-color:#D8CBAA;transform:translateY(-1px)}
.aes-mark{width:34px;height:34px;border-radius:9px;color:#fff;display:flex;align-items:center;justify-content:center;
  font-family:var(--serif);font-size:15px;margin-bottom:10px}
.aes-body{font-size:13px;line-height:2;color:#3A362D;white-space:normal}

/* ---------- 成长报告 ---------- */
.report-sheet{max-width:820px;margin:0 auto;background:#FFFDF8;border:1px solid var(--line);border-radius:18px;padding:38px 42px;box-shadow:var(--shadow)}
.report-top{display:flex;justify-content:space-between;align-items:flex-start;border-bottom:1px solid var(--line);padding-bottom:18px}
.report-org{font-size:10px;letter-spacing:.2em;color:var(--muted)}
.report-title{font-family:var(--serif);font-size:28px;margin-top:6px}
.report-meta{font-size:10.5px;color:var(--muted);margin-top:5px}
.report-seal{width:46px;height:46px;border-radius:6px;background:var(--seal);color:#FBEFDA;font-family:var(--serif);
  font-size:22px;display:flex;align-items:center;justify-content:center;transform:rotate(-4deg)}
.report-person{display:flex;align-items:center;gap:14px;margin:22px 0}
.report-avatar{width:54px;height:54px;border-radius:50%;background:#F2E2DA;color:#A8432B;display:flex;align-items:center;justify-content:center;font-family:var(--serif);font-size:20px}
.report-name{font-family:var(--serif);font-size:20px}
.report-sub{font-size:10.5px;color:var(--muted);margin-top:4px}
.report-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;background:#FBF6E9;border-radius:12px;padding:16px;text-align:center}
.report-grid b{display:block;font-family:var(--serif);font-size:22px}
.report-grid span{display:block;font-size:9.5px;color:var(--muted);margin-top:4px}
.report-h{font-family:var(--serif);font-size:15px;margin:22px 0 8px;padding-left:10px;border-left:3px solid var(--seal)}
.report-p{font-size:12.5px;line-height:1.95;color:#3A362D;margin:0}
.report-list{list-style:none;padding:0;margin:0}
.report-list li{padding:8px 0;border-bottom:1px dashed var(--line);font-size:12px;line-height:1.6}
.report-list li b{display:block;font-weight:600}
.report-list li span{display:block;color:var(--muted);font-size:10.5px;margin-top:2px}
.report-note{width:100%;min-height:96px;border:1px dashed #DCD2BC;border-radius:10px;background:#FFFAEE;padding:11px;font-size:12.5px;line-height:1.9;resize:vertical;outline:none}
.report-note-print{display:none;font-size:12.5px;line-height:1.95;min-height:60px;padding:10px 0}
.report-foot{display:flex;justify-content:space-between;font-size:10px;color:var(--muted);margin-top:26px;padding-top:14px;border-top:1px solid var(--line)}
@media (max-width:640px){.report-sheet{padding:22px 18px}.report-grid{grid-template-columns:repeat(2,1fr)}}
@media print{
  body{background:#fff}
  .sidebar,.topbar,.bottomnav,.no-print,.toast,.modal,#toast{display:none!important}
  .shell{display:block}
  .main{display:block}
  .view{padding:0;max-width:none}
  .report-sheet{border:0;box-shadow:none;border-radius:0;padding:0;max-width:none}
  .report-note{display:none}
  .report-note-print{display:block}
  .report-foot{margin-top:18px}
}

/* ---------- 美育专栏 ---------- */
.col-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:12px}
.col-card{background:var(--card);border:1px solid var(--line);border-radius:16px;padding:16px 16px 14px;cursor:pointer;position:relative;overflow:hidden;transition:.16s}
.col-card:hover{transform:translateY(-2px);border-color:#D8CBAA;box-shadow:var(--shadow)}
.col-bar{position:absolute;left:0;top:0;bottom:0;width:4px}
.col-name{font-family:var(--serif);font-size:19px}
.col-sub{font-size:10.5px;color:var(--muted);margin-top:5px;line-height:1.5}
.col-foot{display:flex;justify-content:space-between;align-items:center;font-size:10px;color:var(--muted);margin-top:18px}
.col-hero{border-radius:18px;padding:26px;color:#FFF6EC;position:relative;overflow:hidden;margin-top:2px}
.col-hero .feature-title{font-size:28px}
.col-hero .feature-sub{max-width:640px}

.aes-cover{width:100%;max-height:320px;object-fit:cover;border-radius:12px;margin:6px 0 14px;display:block}

/* 登录页深色背景上的次级按钮 */
#login .btn-ghost{color:#E9DFC8;border-color:rgba(233,223,200,.38);background:rgba(255,255,255,.03)}
#login .btn-ghost:hover{background:rgba(255,255,255,.09);color:#FFF6E4}

.media-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(110px,1fr));gap:8px;margin-top:8px}
.media-grid img,.media-grid video{width:100%;height:110px;object-fit:cover;border-radius:10px;border:1px solid var(--line);background:#000}

/* 内部对话 */
.chat-box{height:56vh;overflow-y:auto;background:#FFFCF5;border:1px solid var(--line);border-radius:14px;padding:14px;display:flex;flex-direction:column;gap:8px}
.msg{display:flex;flex-direction:column;align-items:flex-start;max-width:78%}
.msg.me{align-self:flex-end;align-items:flex-end}
.msg .who{font-size:9px;color:var(--muted);margin-bottom:3px}
.bubble{background:#F3EDDE;color:#2A2720;padding:8px 12px;border-radius:12px;font-size:12px;line-height:1.75;white-space:normal}
.msg.me .bubble{background:var(--seal);color:#FFF6E8}
.chat-input{display:flex;gap:8px;margin-top:10px;align-items:flex-end}
.chat-input textarea{flex:1;min-height:46px;max-height:120px;border:1px solid var(--line);border-radius:12px;background:#FFFCF5;padding:10px 12px;font-size:12.5px;line-height:1.6;resize:vertical;outline:none}

.share-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:10px 0}
.share-text{width:100%;height:120px;border:1px solid var(--line);border-radius:10px;background:#FFFAEE;padding:10px;font-size:11.5px;line-height:1.7;color:#3A362D;resize:none;outline:none;margin-top:10px}

/* 班级学员名单 */
.class-roster{margin-top:12px;border-top:1px dashed var(--line);padding-top:8px}
.roster-row{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:7px 0;border-bottom:1px dashed var(--line)}
.roster-row:last-child{border-bottom:0}
.roster-name{font-size:12px;font-weight:600;color:var(--ink)}
.btn-xs{padding:3px 7px;font-size:10px;border-radius:6px}

.file-chip{display:inline-flex;align-items:center;gap:6px;max-width:100%;padding:8px 10px;border:1px solid var(--line);border-radius:9px;background:#FFFCF5;font-size:11.5px;color:var(--ink);text-decoration:none;word-break:break-all}
.file-chip .file-ic{flex:none}

.icp{font-size:8.5px;line-height:1.6;margin-top:8px;color:#7E7665}
.icp a{color:inherit;text-decoration:none;border-bottom:1px dotted rgba(255,255,255,.2)}
.login-icp{text-align:center;color:#8B8474;margin-top:12px}
