/* ============================================================
   豆豆学堂 · 全部样式（零外部依赖）
   设计基调（v4.0）：孩子端大气清新、具象化、零红色；
   家长端信息密度高、桌面多栏 / 手机堆叠。
   ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --bg:        #FFF9EF;
  --bg-soft:   #FFF3DC;
  --card:      #FFFFFF;
  --ink:       #3A3226;
  --muted:     #8C8073;
  --line:      #EFE5D2;
  --gold:      #FFB300;
  --gold-deep: #F59E0B;
  --green:     #34B872;
  --green-bg:  #E8F8EE;
  --blue:      #4FA3FF;
  --blue-bg:   #EAF4FF;
  --amber:     #F59E0B;
  --amber-bg:  #FFF4DE;
  --purple:    #8B7CF6;
  --purple-bg: #F1EEFE;
  --red:       #E5484D;   /* 仅家长端使用 */
  --red-bg:    #FDECEC;
  --radius:    18px;
  --shadow:    0 6px 24px rgba(90, 70, 20, .08);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Roboto, sans-serif;
}

html { font-size: 17px; }
body {
  font-family: var(--font);
  background: linear-gradient(180deg, #FFF9EF 0%, #FFF3DC 100%);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; border: none; background: none; cursor: pointer; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 16px; color: var(--ink); }
[hidden] { display: none !important; }

/* ============ 孩子端外壳 ============ */

#childView { max-width: 560px; margin: 0 auto; padding: 0 16px calc(84px + env(safe-area-inset-bottom)); }

#childHeader {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 2px 10px; position: sticky; top: 0; z-index: 30;
  background: linear-gradient(180deg, #FFF9EF 78%, rgba(255,249,239,0));
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-bean { width: 44px; height: 44px; }
.brand-txt b { display: block; font-size: 1.05rem; letter-spacing: .5px; }
.brand-txt span { display: block; font-size: .72rem; color: var(--muted); margin-top: 2px; max-width: 46vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-right { display: flex; align-items: center; gap: 10px; }

.wallet-chip {
  display: flex; align-items: center; gap: 6px;
  background: linear-gradient(135deg, #FFE9B8, #FFD57A);
  border: 2px solid #F5C242; border-radius: 999px;
  padding: 8px 16px 8px 12px; font-size: 1.05rem; font-weight: 800; color: #7A5200;
  box-shadow: var(--shadow); transition: transform .15s;
}
.wallet-chip:active { transform: scale(.94); }
.star-ic { width: 22px; height: 22px; }

.parent-entry {
  width: 44px; height: 44px; border-radius: 14px;
  background: var(--card); color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow);
}
.parent-entry svg { width: 22px; height: 22px; }
.parent-entry.logged { color: var(--green); }

/* ============ 太阳进度条 ============ */

.sun-bar { position: relative; height: 54px; margin: 6px 0 4px; }
.sun-track {
  position: absolute; left: 0; right: 0; top: 30px; height: 8px; border-radius: 99px;
  background: linear-gradient(90deg, #FFE3B3 0%, #FFD57A 35%, #FFB864 75%, #C9B8E8 100%);
}
.sun-slot-mark { position: absolute; top: 24px; width: 2px; height: 20px; background: rgba(122,96,40,.25); border-radius: 2px; }
.sun-slot-label {
  position: absolute; top: 2px; transform: translateX(-50%);
  font-size: .64rem; color: var(--muted); white-space: nowrap; letter-spacing: .3px;
}
.sun-now {
  position: absolute; top: 8px; width: 34px; height: 34px; transform: translateX(-50%);
  transition: left 1s linear; filter: drop-shadow(0 3px 6px rgba(245,158,11,.45));
}
.sun-now svg { width: 100%; height: 100%; }
.sun-bar.done-note { text-align: center; font-size: .8rem; color: var(--muted); padding-top: 6px; }

/* ============ 豆豆气泡 ============ */

.doudou-bubble { display: flex; align-items: flex-start; gap: 10px; margin: 10px 0 6px; }
.doudou-mini { width: 58px; height: 58px; flex: 0 0 58px; }
.bubble {
  position: relative; background: var(--card); border-radius: 16px 16px 16px 4px;
  padding: 12px 14px; font-size: .92rem; line-height: 1.55; box-shadow: var(--shadow);
  animation: popIn .3s ease;
}
.bubble b { color: var(--gold-deep); }
.bubble .sub { display: block; font-size: .74rem; color: var(--muted); margin-top: 4px; }

/* ============ 开始作业区 ============ */

.start-area { margin: 12px 0 4px; }
.big-start {
  width: 100%; min-height: 62px; border-radius: 20px;
  background: linear-gradient(135deg, #FFC24D, #FF9F1C);
  color: #fff; font-size: 1.25rem; font-weight: 800; letter-spacing: 2px;
  box-shadow: 0 8px 22px rgba(255,159,28,.35);
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: transform .15s;
}
.big-start:active { transform: scale(.97); }
.big-start .hint { font-size: .78rem; font-weight: 500; opacity: .92; letter-spacing: 0; }
.started-card {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--green-bg); border: 2px solid #BEE7CE; border-radius: 18px; padding: 12px 16px;
}
.started-card .t { font-weight: 700; color: #1F7A4D; font-size: .95rem; }
.started-card .t small { display: block; font-weight: 400; color: #4E9A74; font-size: .74rem; margin-top: 2px; }
.video-btn {
  min-height: 50px; padding: 0 18px; border-radius: 14px; font-size: .9rem; font-weight: 700;
  background: var(--blue); color: #fff; display: flex; align-items: center; gap: 8px;
}
.video-btn svg { width: 20px; height: 20px; }
.video-btn.done { background: var(--blue-bg); color: #2E77C8; }

/* ============ 任务区 ============ */

.task-area { margin-top: 12px; }
.pool-title { display: flex; align-items: center; gap: 8px; margin: 16px 2px 10px; font-size: .95rem; font-weight: 800; }
.pool-title .cnt { background: var(--bg-soft); border-radius: 99px; padding: 1px 10px; font-size: .75rem; color: var(--muted); font-weight: 700; }
.pool-title svg { width: 20px; height: 20px; }

.task-card {
  background: var(--card); border-radius: var(--radius); padding: 14px 14px;
  margin-bottom: 12px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 12px;
  animation: slideUp .25s ease;
}
.task-card.demo { border: 2px dashed #E4C97F; }
.task-card.done-card { background: var(--green-bg); border: 2px solid #CBEBCF; }
.task-card.rolled { border-left: 6px solid #C9B8E8; }
.demo-badge { font-size: .62rem; background: #F3E3B4; color: #8A6D1E; padding: 2px 8px; border-radius: 99px; font-weight: 700; margin-left: 8px; }

.task-subject { width: 46px; height: 46px; flex: 0 0 46px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 800; }
.sub-语文 { background: #FDEEE3; color: #C25E1E; }
.sub-数学 { background: #EAF4FF; color: #2E77C8; }
.sub-英语 { background: #F1EEFE; color: #6C5CE7; }
.sub-综合 { background: #E8F8EE; color: #1F7A4D; }

.task-body { flex: 1; min-width: 0; }
.task-title { font-size: .98rem; font-weight: 700; line-height: 1.35; word-break: break-all; }
.task-meta { display: flex; align-items: center; gap: 8px; margin-top: 5px; font-size: .74rem; color: var(--muted); flex-wrap: wrap; }
.task-meta .pts { display: inline-flex; align-items: center; gap: 3px; color: var(--gold-deep); font-weight: 800; }
.task-meta .pts svg { width: 14px; height: 14px; }
.task-meta .slot-chip { background: var(--bg-soft); padding: 1px 8px; border-radius: 99px; }
.task-meta .redo-chip { background: var(--amber-bg); color: #B26A00; padding: 1px 8px; border-radius: 99px; font-weight: 700; }
.task-meta .done-at { color: #1F7A4D; font-weight: 700; }
.rolled-hint { background: #F1EDFB; color: #7A6BB5; padding: 1px 8px; border-radius: 99px; font-weight: 700; }

.btn-done {
  min-width: 62px; min-height: 52px; border-radius: 16px; flex: 0 0 62px;
  background: var(--green); color: #fff; font-size: .95rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 5px 14px rgba(52,184,114,.3); transition: transform .15s;
}
.btn-done:active { transform: scale(.93); }
.btn-done svg { width: 26px; height: 26px; }
.btn-undone { background: var(--card); border: 2px solid #CBEBCF; color: #4E9A74; box-shadow: none; }

/* 空状态 */
.empty-box { text-align: center; padding: 26px 16px; color: var(--muted); font-size: .88rem; }
.empty-box svg { width: 64px; height: 64px; margin-bottom: 8px; opacity: .7; }

/* ============ 今日小结 ============ */

.today-summary { display: flex; gap: 10px; margin-top: 18px; }
.sum-chip { flex: 1; background: var(--card); border-radius: 16px; padding: 12px 8px; text-align: center; box-shadow: var(--shadow); }
.sum-chip b { display: block; font-size: 1.3rem; }
.sum-chip span { font-size: .7rem; color: var(--muted); }
.sum-chip.e b { color: var(--gold-deep); }
.sum-chip.s b { color: #7A6BB5; }

/* ============ 攒星星 Tab ============ */

.redeem-hero {
  background: linear-gradient(135deg, #FFE9B8 0%, #FFD57A 60%, #FFC24D 100%);
  border-radius: 22px; padding: 22px 18px; text-align: center; margin-top: 14px;
  box-shadow: 0 10px 26px rgba(245,194,66,.3); position: relative; overflow: hidden;
}
.redeem-hero .jar { width: 76px; height: 76px; margin: 0 auto 6px; }
.redeem-hero .bal { font-size: 2.5rem; font-weight: 900; color: #7A5200; line-height: 1.1; }
.redeem-hero .lbl { font-size: .8rem; color: #9A7420; }
.redeem-hero .left-hint { margin-top: 8px; font-size: .78rem; color: #7A5200; background: rgba(255,255,255,.5); display: inline-block; border-radius: 99px; padding: 4px 14px; }

.reward-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 16px; }
.reward-card { background: var(--card); border-radius: var(--radius); padding: 16px 12px; text-align: center; box-shadow: var(--shadow); animation: slideUp .25s ease; }
.reward-card .r-ic { width: 54px; height: 54px; margin: 0 auto 8px; border-radius: 16px; display: flex; align-items: center; justify-content: center; }
.reward-card .r-ic svg { width: 30px; height: 30px; }
.reward-name { font-size: .88rem; font-weight: 700; line-height: 1.4; min-height: 2.6em; display: flex; align-items: center; justify-content: center; }
.reward-cost { display: inline-flex; align-items: center; gap: 4px; margin: 6px 0 10px; font-weight: 900; color: var(--gold-deep); font-size: 1.05rem; }
.reward-cost svg { width: 17px; height: 17px; }
.reward-note { font-size: .68rem; color: var(--muted); margin: -4px 0 8px; min-height: 1em; }
.btn-redeem {
  width: 100%; min-height: 50px; border-radius: 14px; font-size: .95rem; font-weight: 800;
  background: var(--green); color: #fff; box-shadow: 0 5px 14px rgba(52,184,114,.3);
}
.btn-redeem:disabled { background: #EDE6D8; color: #B3A896; box-shadow: none; }
.btn-redeem .lack { font-size: .72rem; font-weight: 600; display: block; }

/* ============ 豆豆 Tab ============ */

.doudou-home { background: var(--card); border-radius: var(--radius); padding: 20px; text-align: center; margin-top: 14px; box-shadow: var(--shadow); }
.doudou-big { width: 110px; height: 110px; margin: 0 auto; }
.doudou-lv { font-size: 1.15rem; font-weight: 900; margin-top: 6px; }
.doudou-lv .lv-name { color: var(--green); }
.exp-bar { position: relative; height: 14px; background: var(--bg-soft); border-radius: 99px; margin: 12px 6px 4px; overflow: hidden; }
.exp-fill { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, #7ED8A0, #34B872); border-radius: 99px; transition: width .5s ease; }
.exp-hint { font-size: .72rem; color: var(--muted); }
.streak-row { display: flex; justify-content: center; gap: 14px; margin-top: 14px; }
.streak-box { background: var(--amber-bg); border-radius: 14px; padding: 8px 18px; }
.streak-box b { display: block; font-size: 1.25rem; color: #B26A00; }
.streak-box span { font-size: .7rem; color: #9A7420; }

.coupon-area h3, .log-area h3 { font-size: .95rem; margin: 18px 2px 10px; display: flex; align-items: center; gap: 8px; }
.coupon-area h3 svg, .log-area h3 svg { width: 20px; height: 20px; }
.coupon-list { display: flex; flex-direction: column; gap: 10px; }
.coupon-card { background: var(--card); border-radius: 16px; padding: 14px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow); }
.coupon-card.unused { border: 2px solid #F5C242; background: linear-gradient(135deg, #FFFDF6, #FFF3D6); }
.coupon-card .c-body { flex: 1; min-width: 0; }
.coupon-card .c-name { font-weight: 800; font-size: .95rem; }
.coupon-card .c-meta { font-size: .72rem; color: var(--muted); margin-top: 3px; }
.coupon-card .c-cost { font-weight: 900; color: var(--gold-deep); }
.coupon-card.used { opacity: .55; }
.coupon-card.cancelled, .coupon-card.expired { opacity: .6; }
.c-status { font-size: .68rem; padding: 2px 10px; border-radius: 99px; font-weight: 700; }
.c-status.unused { background: var(--green-bg); color: #1F7A4D; }
.c-status.used { background: var(--bg-soft); color: var(--muted); }
.c-status.cancelled { background: var(--bg-soft); color: var(--muted); }
.c-status.expired { background: var(--purple-bg); color: #7A6BB5; }
.btn-coupon { min-height: 50px; border-radius: 14px; padding: 0 16px; font-weight: 800; font-size: .88rem; }
.btn-coupon.show { background: var(--blue); color: #fff; }
.btn-coupon.cancel { background: var(--card); border: 2px solid var(--line); color: var(--muted); }

/* 全屏券面（出示给家长核销） */
.coupon-full { position: fixed; inset: 0; z-index: 90; background: rgba(58,50,38,.55); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 22px; }
.coupon-full .paper {
  width: min(420px, 100%); background: linear-gradient(160deg, #FFFDF6, #FFEDC2); border-radius: 24px;
  padding: 34px 26px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.25);
  animation: popIn .25s ease;
}
.coupon-full .paper .c-ic { width: 84px; height: 84px; margin: 0 auto 10px; }
.coupon-full .paper h2 { font-size: 1.45rem; margin: 4px 0 8px; }
.coupon-full .paper .c-cost { font-size: 1.2rem; color: var(--gold-deep); font-weight: 900; }
.coupon-full .paper .c-exp { font-size: .82rem; color: var(--muted); margin: 10px 0 4px; }
.coupon-full .paper .tip { font-size: .78rem; color: #9A7420; background: rgba(255,255,255,.7); border-radius: 12px; padding: 10px; margin-top: 12px; line-height: 1.6; }
.coupon-full .paper .acts { display: flex; gap: 10px; margin-top: 16px; }
.coupon-full .paper .acts button { flex: 1; min-height: 52px; border-radius: 14px; font-weight: 800; font-size: .95rem; }

/* ============ 孩子明细 ============ */

.log-list { display: flex; flex-direction: column; gap: 8px; }
.log-item { background: var(--card); border-radius: 14px; padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; box-shadow: var(--shadow); }
.log-item .l-reason { flex: 1; min-width: 0; font-size: .85rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-item .l-time { font-size: .68rem; color: var(--muted); display: block; margin-top: 2px; font-weight: 400; }
.log-item .l-delta { font-weight: 900; font-size: 1rem; flex: 0 0 auto; }
.l-delta.up { color: var(--gold-deep); }
.l-delta.down { color: #9A8FB8; }

/* ============ 底部 Tab ============ */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; justify-content: center; gap: 6%;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255,253,247,.94); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tab-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  min-width: 72px; min-height: 52px; color: var(--muted); font-size: .72rem; font-weight: 700;
}
.tab-btn svg { width: 25px; height: 25px; }
.tab-btn.active { color: var(--gold-deep); transform: translateY(-2px); transition: transform .2s; }

/* ============ 家长端 ============ */

#parentView { max-width: 1120px; margin: 0 auto; padding: 0 16px 40px; font-size: 15px; }
#parentHeader {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0 12px; background: linear-gradient(180deg, #FFF9EF 82%, rgba(255,249,239,0));
}
.p-brand { display: flex; align-items: center; gap: 10px; font-size: 1.02rem; }
.p-brand .brand-bean { width: 36px; height: 36px; }
.p-head-actions { display: flex; gap: 8px; }
.p-btn {
  min-height: 40px; padding: 0 16px; border-radius: 12px; font-weight: 700; font-size: .88rem;
  background: var(--card); color: var(--ink); box-shadow: var(--shadow);
}
.p-btn.primary { background: var(--green); color: #fff; }
.p-btn.warn { background: var(--red); color: #fff; }
.p-btn.ghost { background: var(--card); border: 1.5px solid var(--line); box-shadow: none; color: var(--muted); }
.p-btn:disabled { opacity: .5; }

.p-nav { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px; scrollbar-width: none; }
.p-nav::-webkit-scrollbar { display: none; }
.p-nav button {
  flex: 0 0 auto; min-height: 42px; padding: 0 18px; border-radius: 999px;
  background: var(--card); color: var(--muted); font-weight: 700; font-size: .9rem; box-shadow: var(--shadow);
}
.p-nav button.active { background: var(--ink); color: #FFF9EF; }
.p-nav button .dot { display: inline-block; width: 8px; height: 8px; border-radius: 99px; background: var(--red); margin-left: 6px; vertical-align: middle; }

.p-main { animation: slideUp .25s ease; }
.p-card { background: var(--card); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.p-card h3 { font-size: 1rem; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.p-card h3 svg { width: 20px; height: 20px; }

.p-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat { background: var(--card); border-radius: 16px; padding: 14px; text-align: center; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 1.45rem; }
.stat span { font-size: .72rem; color: var(--muted); }
.stat.g b { color: var(--gold-deep); }
.stat.gr b { color: var(--green); }
.stat.p b { color: #7A6BB5; }

.p-form { display: grid; gap: 10px; }
.p-row { display: flex; gap: 10px; flex-wrap: wrap; }
.p-field { flex: 1; min-width: 130px; display: flex; flex-direction: column; gap: 5px; }
.p-field label { font-size: .76rem; color: var(--muted); font-weight: 700; }
.p-field input, .p-field select {
  min-height: 44px; border-radius: 12px; border: 1.5px solid var(--line);
  background: #FFFDF8; padding: 0 12px; outline: none;
}
.p-field input:focus, .p-field select:focus { border-color: var(--gold); }

.pt-list { display: flex; flex-direction: column; gap: 10px; }
.pt-row { border: 1.5px solid var(--line); border-radius: 14px; padding: 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pt-row .pt-title { font-weight: 700; flex: 1; min-width: 160px; }
.pt-row .pt-tags { display: flex; gap: 6px; font-size: .72rem; color: var(--muted); }
.pt-row .pt-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.pt-row .pt-acts button { min-height: 38px; padding: 0 12px; border-radius: 10px; font-size: .8rem; font-weight: 700; background: var(--bg-soft); }
.pt-row .pt-acts button.q-pass { background: var(--green-bg); color: #1F7A4D; }
.pt-row .pt-acts button.q-sloppy { background: var(--amber-bg); color: #B26A00; }
.pt-row .pt-acts button.danger { background: var(--red-bg); color: var(--red); }
.pt-row.overdue { border-color: #F3C1C3; background: #FFFAFA; }
.pt-row.overdue .pt-title::after { content: "逾期"; color: var(--red); font-size: .68rem; margin-left: 8px; font-weight: 800; }
.pt-row.done { background: var(--green-bg); border-color: #CBEBCF; }

/* 家长流水表（宽屏表格 / 窄屏卡片） */
.logs-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.logs-table th { text-align: left; padding: 8px 8px; color: var(--muted); font-size: .72rem; border-bottom: 1.5px solid var(--line); white-space: nowrap; }
.logs-table td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.logs-table .num-up { color: var(--gold-deep); font-weight: 800; }
.logs-table .num-down { color: var(--red); font-weight: 800; }
.pill { display: inline-block; font-size: .68rem; padding: 2px 10px; border-radius: 99px; font-weight: 700; white-space: nowrap; }
.pill.gain { background: var(--green-bg); color: #1F7A4D; }
.pill.loss { background: var(--red-bg); color: var(--red); }
.pill.redeem { background: var(--amber-bg); color: #B26A00; }
.pill.refund { background: var(--blue-bg); color: #2E77C8; }
.pill.adjust { background: var(--purple-bg); color: #6C5CE7; }
.pill.demo { background: var(--bg-soft); color: var(--muted); }

.logs-cards { display: none; flex-direction: column; gap: 10px; }
.logc { border: 1.5px solid var(--line); border-radius: 14px; padding: 10px 14px; }
.logc .r1 { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.logc .r1 .reason { font-size: .85rem; font-weight: 600; flex: 1; }
.logc .r2 { display: flex; gap: 8px; align-items: center; margin-top: 5px; font-size: .7rem; color: var(--muted); flex-wrap: wrap; }

.rev-btn { min-height: 34px; padding: 0 10px; border-radius: 9px; font-size: .74rem; font-weight: 700; background: var(--purple-bg); color: #6C5CE7; }

/* 商城管理 */
.rw-list { display: grid; grid-template-columns: 1fr; gap: 10px; }
.rw-row { border: 1.5px solid var(--line); border-radius: 14px; padding: 12px; display: flex; align-items: center; gap: 10px; }
.rw-row .rw-name { flex: 1; font-weight: 700; font-size: .9rem; }
.rw-row .rw-cost { font-weight: 900; color: var(--gold-deep); }
.rw-row.off { opacity: .55; }

/* 时间表编辑 */
.slot-edit { display: flex; flex-direction: column; gap: 10px; }
.slot-edit .se-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.slot-edit .se-row .se-name { flex: 1; min-width: 110px; font-size: .85rem; font-weight: 700; }
.slot-edit .se-row input[type="time"] { min-height: 40px; border: 1.5px solid var(--line); border-radius: 10px; padding: 0 8px; background: #FFFDF8; }

/* 登录 / 引导 */
.auth-box { max-width: 380px; margin: 40px auto; text-align: center; }
.auth-bean { width: 90px; height: 90px; margin: 0 auto 10px; }
.pwd-input { width: 100%; min-height: 56px; border-radius: 16px; border: 2px solid var(--line); background: #FFFDF8; text-align: center; font-size: 1.6rem; letter-spacing: 14px; outline: none; }
.pwd-input:focus { border-color: var(--gold); }
.auth-tip { font-size: .78rem; color: var(--muted); margin: 10px 0 16px; line-height: 1.6; }

/* ============ 引导（三步） ============ */

#onboarding { position: fixed; inset: 0; z-index: 80; background: rgba(255,249,239,.98); display: flex; align-items: center; justify-content: center; padding: 24px; }
.ob-step { width: min(430px, 100%); text-align: center; animation: popIn .3s ease; }
.ob-step .ob-bean { width: 110px; height: 110px; margin: 0 auto 8px; }
.ob-step h2 { font-size: 1.3rem; margin-bottom: 8px; }
.ob-step p { font-size: .92rem; color: var(--muted); line-height: 1.7; margin-bottom: 18px; }
.ob-step input[type="text"] { width: 100%; min-height: 56px; border-radius: 16px; border: 2px solid var(--line); background: #fff; text-align: center; font-size: 1.15rem; outline: none; }
.ob-step input[type="text"]:focus { border-color: var(--gold); }
.ob-btn { width: 100%; min-height: 56px; border-radius: 16px; background: var(--green); color: #fff; font-size: 1.05rem; font-weight: 800; margin-top: 12px; }
.ob-btn.ghost { background: var(--card); color: var(--muted); border: 2px solid var(--line); }
.ob-dots { display: flex; justify-content: center; gap: 8px; margin-top: 18px; }
.ob-dots i { width: 8px; height: 8px; border-radius: 99px; background: var(--line); }
.ob-dots i.on { background: var(--gold); width: 22px; }

/* ============ 弹层 / Toast / 特效 ============ */

.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(58,50,38,.5); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { width: min(430px, 100%); background: var(--card); border-radius: 22px; padding: 24px 20px; animation: popIn .25s ease; max-height: 84vh; overflow-y: auto; }
.modal h3 { margin-bottom: 10px; }
.modal .m-body { font-size: .92rem; line-height: 1.7; color: var(--ink); }
.modal .m-acts { display: flex; gap: 10px; margin-top: 18px; }
.modal .m-acts button { flex: 1; min-height: 50px; border-radius: 14px; font-weight: 800; font-size: .95rem; }
.m-acts .m-yes { background: var(--green); color: #fff; }
.m-acts .m-no { background: var(--bg-soft); color: var(--muted); }
.m-acts .m-danger { background: var(--red); color: #fff; }

.toast-root { position: fixed; left: 0; right: 0; top: 16px; z-index: 100; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  background: rgba(58,50,38,.92); color: #FFF9EF; border-radius: 14px; padding: 12px 22px;
  font-size: .9rem; font-weight: 600; max-width: 86vw; animation: popIn .25s ease;
  display: flex; align-items: center; gap: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
.toast.star { background: linear-gradient(135deg, #FFC24D, #FF9F1C); color: #fff; font-weight: 800; }
.toast.error { background: rgba(120,60,50,.95); }
.toast svg { width: 20px; height: 20px; flex: 0 0 auto; }

.fx-root { position: fixed; inset: 0; z-index: 95; pointer-events: none; overflow: hidden; }
.fly-star { position: absolute; width: 30px; height: 30px; transition: all .7s cubic-bezier(.35,-0.2,.6,1); }
.confetti { position: absolute; width: 10px; height: 14px; border-radius: 3px; animation: confFall 1.6s ease-in forwards; }

@keyframes popIn { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes slideUp { from { transform: translateY(14px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes confFall { to { transform: translateY(105vh) rotate(720deg); opacity: .4; } }
@keyframes bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.bean-bounce { animation: bounce 1.6s ease infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ 响应式 ============ */

/* 平板（孩子端居中卡已足够；家长端起双列） */
@media (min-width: 768px) {
  #childView { max-width: 620px; }
  .reward-grid { grid-template-columns: repeat(3, 1fr); }
  .p-stats { grid-template-columns: repeat(4, 1fr); }
  .p-form { grid-template-columns: repeat(2, 1fr); }
  .p-form .full { grid-column: 1 / -1; }
  .rw-list { grid-template-columns: 1fr 1fr; }
}

/* 桌面（家长端三栏布局：左侧导航 + 右侧内容） */
@media (min-width: 1024px) {
  #parentView { padding: 0 24px 60px; }
  .p-body { display: grid; grid-template-columns: 210px 1fr; gap: 18px; align-items: start; }
  .p-nav { position: sticky; top: 84px; flex-direction: column; overflow: visible; }
  .p-nav button { width: 100%; text-align: left; border-radius: 14px; }
  .logs-cards { display: none; }
}

/* 窄屏：家长流水表 → 卡片 */
@media (max-width: 767px) {
  .logs-table { display: none; }
  .logs-cards { display: flex; }
  .today-summary { flex-wrap: wrap; }
  .sum-chip { min-width: 45%; }
}

/* ============================================================
   自主管理模块（异地家长版）：快捷入口 / 每日计划 / 成就墙 / 热力条
   ============================================================ */

/* ---- 快捷入口（今天 Tab） ---- */
.quick-add { display: flex; gap: 10px; margin: 12px 0 2px; }
.qa-btn {
  flex: 1; min-height: 72px; border-radius: 18px; background: var(--card);
  box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; padding: 8px 6px; transition: transform .15s;
}
.qa-btn:active { transform: scale(.96); }
.qa-btn .qa-ic { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border-radius: 10px; background: var(--green-bg); color: var(--green); }
.qa-btn .qa-ic svg { width: 18px; height: 18px; }
.qa-btn.ext .qa-ic { background: var(--purple-bg); color: var(--purple); }
.qa-btn .qa-t { font-size: .95rem; font-weight: 800; }
.qa-btn small { font-size: .64rem; color: var(--muted); font-weight: 500; }

/* ---- 每日计划（今天 Tab 底部） ---- */
.plan-area { margin-top: 16px; }
.plan-list { display: flex; flex-direction: column; gap: 10px; }
.plan-row {
  background: var(--card); border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 10px;
}
.plan-row.paused { opacity: .62; }
.plan-row .plan-info { flex: 1; min-width: 0; }
.plan-row .plan-name { font-size: .92rem; font-weight: 700; }
.plan-row .plan-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: .72rem; color: var(--muted); flex-wrap: wrap; }
.plan-row .plan-op {
  min-height: 44px; min-width: 64px; padding: 0 14px; border-radius: 13px;
  background: var(--bg-soft); color: var(--muted); font-size: .82rem; font-weight: 700;
}
.plan-row .plan-op.resume { background: var(--green-bg); color: #1F7A4D; }

/* ---- 任务卡：自录 / 拓展 / 删除 ---- */
.self-badge { font-size: .62rem; background: var(--blue-bg); color: #2E77C8; padding: 2px 8px; border-radius: 99px; font-weight: 700; margin-left: 6px; }
.ext-badge { font-size: .62rem; background: var(--purple-bg); color: #6C5CE7; padding: 2px 8px; border-radius: 99px; font-weight: 700; margin-left: 6px; }
.btn-del {
  width: 38px; height: 38px; flex: 0 0 38px; border-radius: 12px;
  background: var(--bg-soft); color: var(--muted); display: flex; align-items: center; justify-content: center;
}
.btn-del svg { width: 16px; height: 16px; }
.btn-del.armed { background: var(--amber-bg); color: #B26A00; }

/* ---- 成就墙（豆豆 Tab） ---- */
.ach-area h3 { font-size: .98rem; margin: 18px 2px 12px; display: flex; align-items: center; gap: 8px; }
.ach-area h3 svg { width: 20px; height: 20px; color: var(--gold-deep); }
.ach-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ach-badge {
  background: var(--card); border-radius: 16px; padding: 14px 10px 12px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px;
}
.ach-badge .ach-ic { width: 44px; height: 44px; border-radius: 14px; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #FFE9B8, #FFD57A); color: #9A6A00; }
.ach-badge .ach-ic svg { width: 24px; height: 24px; }
.ach-badge.on .ach-ic { background: linear-gradient(135deg, #FFC24D, #FF9F1C); color: #fff; box-shadow: 0 4px 12px rgba(255,159,28,.35); }
.ach-badge.off .ach-ic { background: var(--bg-soft); color: var(--muted); }
.ach-badge .ach-name { font-size: .78rem; font-weight: 800; }
.ach-badge.off .ach-name { color: var(--muted); }
.ach-badge .ach-bar { width: 100%; height: 6px; border-radius: 99px; background: var(--bg-soft); overflow: hidden; }
.ach-badge .ach-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, #FFC24D, #FF9F1C); }
.ach-badge.off .ach-fill { background: var(--line); }
.ach-badge .ach-hint { font-size: .64rem; color: var(--muted); line-height: 1.4; min-height: 1.7em; }

/* ---- 弹窗表单（记作业 / 建计划） ---- */
.f-row { margin-bottom: 6px; }
.f-input {
  width: 100%; min-height: 52px; border-radius: 14px; border: 2px solid var(--line);
  background: #FFFDF8; padding: 0 14px; font-size: 16px; outline: none;
}
.f-input:focus { border-color: var(--gold); }
.f-label { font-size: .76rem; font-weight: 800; color: var(--muted); margin: 14px 0 8px; }
.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px; padding: 0 16px; border-radius: 14px; border: 2px solid var(--line);
  background: #FFFDF8; font-size: .85rem; font-weight: 700; color: var(--muted);
  transition: all .15s;
}
.chip.on { border-color: var(--green); background: var(--green-bg); color: #1F7A4D; }
.f-note { font-size: .74rem; color: var(--muted); line-height: 1.6; margin-top: 14px; }

/* ---- 家长端：周小结 + 热力条 ---- */
.weekly-txt { font-size: .95rem; line-height: 1.8; margin-bottom: 14px; }
.weekly-txt b { color: var(--gold-deep); font-size: 1.05rem; }
.heat-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.heat-cell { display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: default; }
.heat-cell i { width: 100%; padding-top: 62%; border-radius: 7px; background: var(--bg-soft); }
.heat-cell.full i { background: linear-gradient(135deg, #34B872, #1F9A5C); }
.heat-cell.mid i { background: linear-gradient(135deg, #FFC24D, #F59E0B); }
.heat-cell.low i { background: #F3C1C3; }
.heat-cell.none i { background: var(--line); }
.heat-cell span { font-size: .58rem; color: var(--muted); white-space: nowrap; }

/* 家长端：新 pill 变体 */
.pill.self { background: var(--blue-bg); color: #2E77C8; }
.pill.ext { background: var(--purple-bg); color: #6C5CE7; }
.pill.off { background: var(--bg-soft); color: var(--muted); }
.pt-row.off-row { opacity: .6; }

/* ---- 响应式补充 ---- */
@media (max-width: 420px) {
  .ach-grid { grid-template-columns: repeat(2, 1fr); }
  .heat-strip { grid-template-columns: repeat(7, 1fr); gap: 4px; }
  .quick-add { flex-direction: column; }
  .qa-btn { flex-direction: row; justify-content: flex-start; gap: 10px; min-height: 56px; padding: 8px 14px; }
  .qa-btn .qa-ic { flex: 0 0 36px; }
  .qa-btn .qa-t { flex: 1; text-align: left; }
  .qa-btn small { flex-basis: 100%; text-align: left; }
}
@media (min-width: 768px) {
  .ach-grid { grid-template-columns: repeat(6, 1fr); }
}
