/* ============================================================
   哈哈学习平台 · assets/css/app.css
   一句话风格：米白底 + 白卡片 + 靛蓝主色 + 星星金，圆润、克制、可打印。
   ============================================================ */

:root {
    /* 主色 */
    --brand: #4f46e5;
    --brand-dark: #4338ca;
    --brand-soft: #eef2ff;
    --brand-line: #c7d2fe;

    /* 功能色 */
    --sun: #f59e0b;
    --sun-soft: #fff7e6;
    --green: #16a34a;
    --green-soft: #eafaf1;
    --red: #dc2626;
    --red-soft: #fef2f2;
    --blue: #0ea5e9;
    --purple: #a855f7;

    /* 中性色 */
    --bg: #f6f4ee;
    --bg-deep: #efece4;
    --card: #ffffff;
    --text: #1c1b22;
    --text-2: #5b5a66;
    --muted: #918f9b;
    --line: #ecebf3;
    --line-2: #dedce8;

    /* 尺寸 */
    --radius: 18px;
    --radius-sm: 12px;
    --radius-xs: 8px;
    --shadow-sm: 0 1px 2px rgba(24, 20, 50, .05), 0 2px 8px rgba(24, 20, 50, .04);
    --shadow: 0 2px 6px rgba(24, 20, 50, .05), 0 12px 32px rgba(24, 20, 50, .07);
    --shadow-lg: 0 24px 60px rgba(24, 20, 50, .18);
    --sidebar-w: 236px;
    --tabbar-h: 60px;
    --topbar-h: 56px;
    --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0 0 8px; }
code { background: var(--bg-deep); padding: 1px 6px; border-radius: 6px; font-size: .88em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

/* ============================================================
   1. 骨架布局
   ============================================================ */

.app {
    min-height: 100vh;
    display: flex;
    padding-bottom: calc(var(--tabbar-h) + var(--safe-b));
}

/* ---------- 侧边栏（桌面） ---------- */
.sidebar {
    display: none;
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: var(--card);
    border-right: 1px solid var(--line);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    padding: 20px 12px;
}

.side-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 8px 18px;
}
.brand-mark {
    width: 38px; height: 38px; flex: 0 0 38px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--brand), #7c6cf6);
    color: #fff;
    display: grid; place-items: center;
    font-weight: 700; font-size: 18px;
    box-shadow: 0 6px 16px rgba(79, 70, 229, .3);
}
.side-brand strong { display: block; font-size: 15px; line-height: 1.2; }
.side-brand span { font-size: 11.5px; color: var(--muted); }

.side-kid {
    display: flex; align-items: center; gap: 10px;
    background: var(--brand-soft);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin: 0 4px 16px;
}
.side-kid .kid-avatar { width: 34px; height: 34px; font-size: 15px; }
.side-kid b { display: block; font-size: 13.5px; }
.side-kid small { color: var(--brand); font-size: 11.5px; }

.side-label {
    font-size: 11px; color: var(--muted); letter-spacing: .08em;
    padding: 14px 12px 6px; text-transform: uppercase;
}

.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px;
    border-radius: 11px;
    color: var(--text-2);
    font-size: 14px;
    margin-bottom: 2px;
    transition: background .15s, color .15s;
}
.nav-item svg { width: 18px; height: 18px; flex: 0 0 18px; opacity: .85; }
.nav-item:hover { background: var(--bg-deep); color: var(--text); }
.nav-item.active { background: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(79, 70, 229, .28); }
.nav-item.active svg { opacity: 1; }
.nav-item .nav-count {
    margin-left: auto; font-size: 11px; background: var(--red); color: #fff;
    border-radius: 999px; padding: 0 6px; min-width: 18px; text-align: center;
}
.nav-item.active .nav-count { background: rgba(255,255,255,.28); }

/* ---------- 主区 ---------- */
.main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky; top: 0; z-index: 40;
    height: var(--topbar-h);
    display: flex; align-items: center; gap: 10px;
    padding: 0 16px;
    background: rgba(246, 244, 238, .86);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid rgba(0,0,0,.04);
    padding-top: env(safe-area-inset-top, 0px);
    height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
}
.topbar h1 { font-size: 17px; }
.topbar .sub { font-size: 12px; color: var(--muted); }
.topbar .spacer { flex: 1; }

.content {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 16px 16px 32px;
}

@media (min-width: 960px) {
    .app { padding-bottom: 0; }
    .sidebar { display: block; }
    .content { padding: 24px 28px 48px; }
    .topbar { padding-left: 28px; padding-right: 28px; }
}

/* ---------- 底部导航（移动） ---------- */
.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    height: calc(var(--tabbar-h) + var(--safe-b));
    padding-bottom: var(--safe-b);
    display: flex;
    background: rgba(255,255,255,.94);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    backdrop-filter: saturate(180%) blur(14px);
    border-top: 1px solid var(--line);
}
.tab {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px;
    font-size: 10.5px;
    color: var(--muted);
    padding-top: 6px;
}
.tab svg { width: 22px; height: 22px; }
.tab.active { color: var(--brand); font-weight: 600; }

@media (min-width: 960px) {
    .tabbar { display: none; }
}

/* ============================================================
   2. 基础组件
   ============================================================ */

.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 16px;
    margin-bottom: 14px;
}
.card.flush { padding: 0; overflow: hidden; }
.card-head {
    display: flex; align-items: center; gap: 10px;
    margin: -2px 0 12px;
}
.card-head h2 { font-size: 15px; }
.card-head .spacer { flex: 1; }
.card-more { font-size: 12.5px; color: var(--brand); }

.section-title {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; color: var(--text-2);
    margin: 18px 2px 10px;
    font-weight: 600;
}
.section-title .spacer { flex: 1; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 38px; padding: 0 16px;
    border-radius: 11px;
    border: 1px solid var(--line-2);
    background: var(--card);
    color: var(--text);
    font-size: 14px; font-weight: 500;
    cursor: pointer;
    transition: transform .08s, background .15s, border-color .15s, box-shadow .15s;
    white-space: nowrap;
}
.btn:hover { background: #faf9f6; }
.btn:active { transform: scale(.975); }
.btn svg { width: 16px; height: 16px; }
.btn-primary {
    background: var(--brand); border-color: var(--brand); color: #fff;
    box-shadow: 0 6px 16px rgba(79, 70, 229, .24);
}
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--bg-deep); }
.btn-sun { background: var(--sun); border-color: var(--sun); color: #fff; box-shadow: 0 6px 16px rgba(245,158,11,.28); }
.btn-sun:hover { background: #d97706; border-color: #d97706; }
.btn-danger { color: var(--red); border-color: #f3c9c9; background: #fff; }
.btn-danger:hover { background: var(--red-soft); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 9px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 15.5px; border-radius: 13px; }
.btn-block { width: 100%; }
.btn-icon { width: 38px; padding: 0; }
.btn-icon.btn-sm { width: 30px; }
.btn.disabled, .btn:disabled { opacity: .45; pointer-events: none; }

.chip {
    display: inline-flex; align-items: center; gap: 5px;
    height: 24px; padding: 0 9px;
    border-radius: 999px;
    font-size: 12px;
    background: var(--bg-deep);
    color: var(--text-2);
    white-space: nowrap;
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip-brand { background: var(--brand-soft); color: var(--brand); }
.chip-sun { background: var(--sun-soft); color: #b45309; }
.chip-green { background: var(--green-soft); color: var(--green); }
.chip-red { background: var(--red-soft); color: var(--red); }
.chip-line { background: transparent; border: 1px solid var(--line-2); }

.badge {
    display: inline-block; min-width: 18px; padding: 0 6px;
    border-radius: 999px; font-size: 11px; line-height: 18px; text-align: center;
    background: var(--brand-soft); color: var(--brand);
}
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-sun { background: var(--sun-soft); color: #b45309; }

.avatar {
    width: 40px; height: 40px; flex: 0 0 40px;
    border-radius: 50%;
    display: grid; place-items: center;
    background: linear-gradient(135deg, #7c6cf6, var(--brand));
    color: #fff; font-weight: 600; font-size: 17px;
    overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 30px; height: 30px; flex-basis: 30px; font-size: 13px; }
.avatar.lg { width: 56px; height: 56px; flex-basis: 56px; font-size: 22px; }

.empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
}
.empty .empty-emoji { font-size: 40px; line-height: 1; margin-bottom: 10px; }
.empty p { font-size: 13.5px; }
.empty .btn { margin-top: 12px; }

.hint { font-size: 12px; color: var(--muted); line-height: 1.7; }

.alert {
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 13.5px;
    margin-bottom: 12px;
    line-height: 1.65;
}
.alert-error { background: var(--red-soft); color: #991b1b; border: 1px solid #f6d5d5; }
.alert-info { background: var(--brand-soft); color: #3730a3; border: 1px solid var(--brand-line); }
.alert-ok { background: var(--green-soft); color: #166534; border: 1px solid #c7ebd5; }

/* ---------- 表单 ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
.field input[type=text], .field input[type=password], .field input[type=date],
.field input[type=time], .field input[type=number], .field input[type=search],
.field select, .field textarea, .input {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--line-2);
    border-radius: 11px;
    background: #fff;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.field textarea { height: auto; min-height: 88px; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}
.field .field-hint { font-size: 11.5px; color: var(--muted); margin-top: 5px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 520px) { .form-grid { grid-template-columns: 1fr; } }

.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--brand); }

.switch-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; }
.switch { position: relative; width: 42px; height: 24px; flex: 0 0 42px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
    position: absolute; inset: 0; background: #d6d3e0; border-radius: 999px; transition: .2s; cursor: pointer;
}
.switch span::after {
    content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
    background: #fff; top: 3px; left: 3px; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(18px); }

.seg {
    display: inline-flex; background: var(--bg-deep); border-radius: 11px; padding: 3px; gap: 2px;
}
.seg a, .seg button {
    border: 0; background: transparent; padding: 6px 14px; border-radius: 9px;
    font-size: 13px; color: var(--text-2); cursor: pointer;
}
.seg a.active, .seg button.active { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); font-weight: 600; }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
    text-align: left; font-weight: 600; color: var(--muted);
    font-size: 11.5px; letter-spacing: .04em;
    padding: 8px 10px; border-bottom: 1px solid var(--line);
}
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table td.ok { color: var(--green); }
.table td.bad { color: var(--red); }

/* ============================================================
   3. 业务组件
   ============================================================ */

/* 今日概览 */
.hero {
    background: linear-gradient(135deg, #4f46e5 0%, #6d5cf0 45%, #8b7cf8 100%);
    color: #fff;
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 14px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 14px 36px rgba(79, 70, 229, .26);
}
.hero::after {
    content: ""; position: absolute; right: -40px; top: -60px;
    width: 200px; height: 200px; border-radius: 50%;
    background: rgba(255,255,255,.09);
}
.hero-row { display: flex; align-items: center; gap: 16px; position: relative; z-index: 1; }
.hero-date { font-size: 12.5px; opacity: .85; }
.hero-title { font-size: 21px; font-weight: 700; margin: 2px 0 10px; letter-spacing: -.02em; }
.hero-stats { display: flex; gap: 18px; flex-wrap: wrap; }
.hero-stat b { display: block; font-size: 19px; line-height: 1.2; }
.hero-stat span { font-size: 11.5px; opacity: .82; }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; position: relative; z-index: 1; }
.hero .btn { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.3); color: #fff; }
.hero .btn:hover { background: rgba(255,255,255,.26); }
.hero .btn-white { background: #fff; border-color: #fff; color: var(--brand); font-weight: 600; }
.hero .btn-white:hover { background: #f5f3ff; }

/* 进度环 */
.ring { position: relative; width: 84px; height: 84px; flex: 0 0 84px; }
.ring svg { transform: rotate(-90deg); }
.ring .ring-bg { stroke: rgba(255,255,255,.22); }
.ring .ring-fg { stroke: #fff; stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.ring .ring-text {
    position: absolute; inset: 0; display: grid; place-items: center;
    font-size: 15px; font-weight: 700;
}
.ring.dark .ring-bg { stroke: var(--line); }
.ring.dark .ring-fg { stroke: var(--brand); }
.ring.dark .ring-text { color: var(--text); font-size: 14px; }
.ring.sm { width: 56px; height: 56px; flex-basis: 56px; }
.ring.sm .ring-text { font-size: 12px; }

/* 任务卡片 */
.task-list { display: flex; flex-direction: column; gap: 8px; }
.task {
    display: flex; align-items: flex-start; gap: 10px;
    background: var(--card);
    border-radius: var(--radius-sm);
    padding: 12px;
    border: 1px solid var(--line);
    transition: border-color .15s, box-shadow .15s;
    position: relative;
}
.task:hover { border-color: var(--line-2); box-shadow: var(--shadow-sm); }
.task.done { background: #fbfaf6; }
.task.done .task-title { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(0,0,0,.2); }
.task.overdue { border-color: #f7caca; background: linear-gradient(0deg, var(--red-soft), var(--red-soft)), #fff; }

.task-check {
    width: 26px; height: 26px; flex: 0 0 26px;
    border-radius: 50%;
    border: 2px solid var(--line-2);
    background: #fff;
    display: grid; place-items: center;
    cursor: pointer;
    margin-top: 1px;
    transition: all .15s;
    color: transparent;
}
.task-check svg { width: 14px; height: 14px; }
.task-check:hover { border-color: var(--brand); }
.task.done .task-check { background: var(--green); border-color: var(--green); color: #fff; }

.task-main { flex: 1; min-width: 0; }
.task-title { font-size: 14.5px; font-weight: 550; line-height: 1.45; word-break: break-word; }
.task-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 5px; font-size: 12px; color: var(--muted); }
.task-meta .time { font-variant-numeric: tabular-nums; }
.task-note { font-size: 12.5px; color: var(--text-2); margin-top: 6px; }
.task-thumbs { display: flex; gap: 5px; margin-top: 8px; flex-wrap: wrap; }
.task-thumbs img {
    width: 52px; height: 52px; object-fit: cover; border-radius: 9px;
    border: 1px solid var(--line); cursor: zoom-in;
}
.task-aside { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.star-pill {
    display: inline-flex; align-items: center; gap: 3px;
    font-size: 12px; color: #b45309; background: var(--sun-soft);
    padding: 2px 7px; border-radius: 999px; font-variant-numeric: tabular-nums;
}
.star-pill svg { width: 12px; height: 12px; }

/* 学科色条 */
.subject-bar { width: 4px; border-radius: 999px; align-self: stretch; flex: 0 0 4px; }

/* 分组标题 */
.group-head {
    display: flex; align-items: center; gap: 8px;
    font-size: 12.5px; color: var(--text-2); font-weight: 600;
    margin: 16px 2px 8px;
}
.group-head .dot { width: 8px; height: 8px; border-radius: 50%; }
.group-head .spacer { flex: 1; }
.group-head .cnt { font-size: 11.5px; color: var(--muted); font-weight: 400; }

/* 统计小卡 */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat {
    background: var(--card); border-radius: var(--radius-sm);
    padding: 14px; box-shadow: var(--shadow-sm);
}
.stat b { display: block; font-size: 22px; line-height: 1.25; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }
.stat .trend { font-size: 11.5px; }
.stat .trend.up { color: var(--green); }
.stat .trend.down { color: var(--red); }

/* 打卡日历 */
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.cal-head .spacer { flex: 1; }
.cal-title { font-size: 15px; font-weight: 600; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow {
    text-align: center; font-size: 11px; color: var(--muted); padding: 4px 0;
}
.cal-cell {
    position: relative;
    aspect-ratio: 1 / 1;
    max-height: 62px;
    min-height: 40px;
    border-radius: 10px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    font-size: 13px;
    background: #faf9f6;
    border: 1px solid transparent;
    color: var(--text-2);
    font-variant-numeric: tabular-nums;
}
@media (min-width: 960px) {
    .cal-grid { max-width: 560px; }
}
.cal-cell.out { opacity: .32; }
.cal-cell.today { border-color: var(--brand); color: var(--brand); font-weight: 700; }
.cal-cell.checked { background: var(--green); color: #fff; border-color: var(--green); font-weight: 600; }
.cal-cell.has-task::after {
    content: ""; position: absolute; bottom: 5px;
    width: 4px; height: 4px; border-radius: 50%; background: var(--brand);
}
.cal-cell.checked.has-task::after { background: rgba(255,255,255,.85); }
.cal-cell a { position: absolute; inset: 0; }
.cal-cell .cal-dot { position: absolute; top: 4px; right: 5px; font-size: 9px; }

/* 热力图 */
.heat {
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: repeat(7, 1fr);
    gap: 3px;
    overflow-x: auto;
    padding-bottom: 6px;
}
.heat i {
    width: 11px; height: 11px; border-radius: 3px; background: #eceaf3; display: block;
}
.heat i.l1 { background: #c7f0d6; }
.heat i.l2 { background: #86dfa8; }
.heat i.l3 { background: #34c46b; }
.heat i.l4 { background: #15803d; }
.heat-months { display: flex; gap: 0; font-size: 10px; color: var(--muted); margin-bottom: 4px; }

/* 项目卡 */
.project-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 720px) { .project-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .project-grid { grid-template-columns: repeat(3, 1fr); } }
.project-card {
    background: var(--card); border-radius: var(--radius);
    padding: 16px; box-shadow: var(--shadow-sm);
    border-top: 3px solid var(--brand);
    display: flex; flex-direction: column; gap: 8px;
}
.project-card h3 { font-size: 15.5px; display: flex; align-items: center; gap: 8px; }
.project-card .desc { font-size: 12.5px; color: var(--text-2); line-height: 1.6; min-height: 20px; }

.progress { height: 7px; border-radius: 999px; background: var(--bg-deep); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 999px; background: var(--brand); transition: width .5s; }

/* 星星 */
.star-hero {
    background: linear-gradient(135deg, #fbbf24, #f59e0b 60%, #ea580c);
    color: #fff; border-radius: var(--radius); padding: 18px 20px; margin-bottom: 14px;
    box-shadow: 0 14px 32px rgba(245, 158, 11, .28);
    position: relative; overflow: hidden;
}
.star-hero::after {
    content: ""; position: absolute; right: -30px; top: -50px;
    width: 170px; height: 170px; border-radius: 50%;
    background: rgba(255,255,255,.10);
}
.star-hero > * { position: relative; z-index: 1; }
.star-hero .num { font-size: 34px; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; }
.star-hero .num small { font-size: 13px; font-weight: 500; opacity: .85; margin-left: 4px; }
.ledger { display: flex; flex-direction: column; }
.ledger-row {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 0; border-bottom: 1px dashed var(--line);
}
.ledger-row:last-child { border-bottom: 0; }
.ledger-row .l-reason { flex: 1; min-width: 0; font-size: 13.5px; }
.ledger-row .l-time { font-size: 11.5px; color: var(--muted); }
.ledger-row .l-delta { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 14px; }
.ledger-row .l-delta.plus { color: var(--green); }
.ledger-row .l-delta.minus { color: var(--red); }

.wish {
    display: flex; align-items: center; gap: 12px;
    padding: 12px; border-radius: var(--radius-sm);
    border: 1px solid var(--line); background: var(--card);
}
.wish .w-title { flex: 1; font-size: 14px; }
.wish.off { opacity: .55; }

/* 成绩曲线 */
.chart-wrap { overflow-x: auto; }
.chart-wrap svg { display: block; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-top: 8px; }
.chart-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }

/* 图片灯箱 */
.lightbox {
    position: fixed; inset: 0; z-index: 100;
    background: rgba(12, 10, 24, .92);
    display: none;
    align-items: center; justify-content: center;
    padding: 16px;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 100%; max-height: 88vh; border-radius: 10px; object-fit: contain; }
.lightbox .lb-close {
    position: absolute; top: 14px; right: 16px; width: 40px; height: 40px;
    border-radius: 50%; background: rgba(255,255,255,.14); color: #fff;
    border: 0; font-size: 20px; cursor: pointer;
}
.lightbox .lb-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 44px; height: 44px; border-radius: 50%;
    background: rgba(255,255,255,.14); color: #fff; border: 0; font-size: 20px; cursor: pointer;
}
.lightbox .lb-prev { left: 12px; }
.lightbox .lb-next { right: 12px; }
.lightbox .lb-count { position: absolute; bottom: 18px; color: rgba(255,255,255,.7); font-size: 12px; }

/* 上传框 */
.uploader {
    border: 1.5px dashed var(--line-2);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    cursor: pointer;
    background: #fdfcfa;
    transition: all .15s;
}
.uploader:hover, .uploader.drag { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.uploader svg { width: 22px; height: 22px; margin-bottom: 4px; }
.upload-preview { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.upload-preview .up-item { position: relative; width: 74px; height: 74px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.upload-preview .up-item img { width: 100%; height: 100%; object-fit: cover; }
.upload-preview .up-item button {
    position: absolute; top: 2px; right: 2px; width: 20px; height: 20px;
    border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff;
    font-size: 12px; line-height: 1; cursor: pointer;
}

/* 弹层（原生 dialog 兼容层） */
.modal {
    position: fixed; inset: 0; z-index: 90; display: none;
    background: rgba(20, 16, 40, .45);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    padding: 16px;
    overflow-y: auto;
}
.modal.open { display: block; }
.modal-card {
    background: var(--card); border-radius: var(--radius);
    max-width: 520px; margin: 6vh auto; box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.modal-head {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-size: 15.5px; flex: 1; }
.modal-body { padding: 16px 18px; }
.modal-foot {
    display: flex; gap: 8px; justify-content: flex-end;
    padding: 12px 18px; border-top: 1px solid var(--line); background: #fcfbf8;
}

/* Toast */
.toast-wrap { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
    background: rgba(28, 24, 48, .92); color: #fff;
    padding: 9px 16px; border-radius: 999px; font-size: 13.5px;
    box-shadow: var(--shadow); animation: toast-in .2s ease;
}
.toast.err { background: rgba(185, 28, 28, .95); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* 登录页 */
.auth-body { background: linear-gradient(160deg, #eef2ff 0%, #f6f4ee 45%, #fff7e6 100%); min-height: 100vh; }
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card {
    width: 100%; max-width: 380px;
    background: rgba(255,255,255,.86);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,.7);
    border-radius: 24px;
    padding: 26px 24px;
    box-shadow: 0 24px 60px rgba(60, 50, 120, .14);
}
.auth-card.wide { max-width: 560px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-brand h1 { font-size: 19px; }
.auth-brand p { font-size: 12px; color: var(--muted); margin: 0; }
.auth-sub { font-size: 13px; color: var(--text-2); margin: 18px 0 10px; font-weight: 600; }
.auth-foot { text-align: center; font-size: 12px; color: var(--muted); margin-top: 16px; }

/* 工具类 */
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 760px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.grid-3 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 760px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.hide { display: none !important; }

/* ============================================================
   4. 打印（周报 A4）
   ============================================================ */
@media print {
    body { background: #fff; font-size: 12pt; }
    .sidebar, .tabbar, .topbar, .no-print, .hero-actions { display: none !important; }
    .app { padding: 0; display: block; }
    .content { max-width: none; padding: 0; }
    .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
    .print-title { display: block !important; }
    a { color: #000; }
    .page-break { page-break-before: always; }
}

/* ============================================================
   5. ѧ�� / ��Ŀҳ
   ============================================================ */
.subject-grid {
    display: grid; grid-template-columns: 1fr; gap: 10px;
}
@media (min-width: 760px) { .subject-grid { grid-template-columns: 1fr 1fr; } }
.subject-card {
    display: flex; align-items: center; gap: 12px;
    background: var(--card); border-radius: var(--radius-sm);
    padding: 14px; box-shadow: var(--shadow-sm);
    border: 1px solid var(--line);
    transition: transform .12s, box-shadow .15s;
    text-align: left; cursor: default;
}
.subject-card:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.subject-card .sc-icon {
    width: 42px; height: 42px; flex: 0 0 42px; border-radius: 12px;
    display: grid; place-items: center;
}
.subject-card .sc-main { flex: 1; min-width: 0; }
.subject-card .sc-name { font-size: 15px; font-weight: 600; }
.subject-card .sc-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.subject-card .sc-actions { display: flex; gap: 2px; }
.subject-card.add {
    justify-content: center; color: var(--muted); border: 1.5px dashed var(--line-2);
    box-shadow: none; background: transparent; cursor: pointer; font-size: 14px; min-height: 72px;
}
.subject-card.add:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }

.color-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.cp-item { cursor: pointer; }
.cp-item input { position: absolute; opacity: 0; }
.cp-item span {
    display: block; width: 30px; height: 30px; border-radius: 50%;
    border: 2px solid transparent; box-shadow: 0 0 0 1px rgba(0,0,0,.06);
    transition: transform .12s;
}
.cp-item input:checked + span { border-color: #fff; box-shadow: 0 0 0 2px var(--text); transform: scale(1.06); }

.icon-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.ip-item { cursor: pointer; }
.ip-item input { position: absolute; opacity: 0; }
.ip-item span {
    display: grid; place-items: center; width: 38px; height: 38px;
    border-radius: 10px; background: var(--bg-deep); color: var(--text-2);
}
.ip-item input:checked + span { background: var(--brand); color: #fff; }

/* �ɼ��� */
.score-row {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 0; border-bottom: 1px solid var(--line);
}
.score-row:last-child { border-bottom: 0; }
.score-badge {
    width: 54px; height: 54px; flex: 0 0 54px; border-radius: 14px;
    display: grid; place-items: center; font-weight: 700; font-size: 17px;
    background: var(--brand-soft); color: var(--brand); font-variant-numeric: tabular-nums;
}
.score-badge.good { background: var(--green-soft); color: var(--green); }
.score-badge.warn { background: #fff7e6; color: #b45309; }
.score-badge.bad { background: var(--red-soft); color: var(--red); }

.mood-pick { cursor: pointer; }
.mood-pick input { position: absolute; opacity: 0; }
.mood-pick span {
    display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
    background: rgba(255,255,255,.16); font-size: 20px; transition: all .15s;
}
.mood-pick input:checked + span { background: #fff; transform: scale(1.06); box-shadow: 0 4px 12px rgba(0,0,0,.15); }
