/* 小苗教室 家长 App — v2 样式，保留原配色 */
:root {
  --nav: #d5bf77;         /* 底部导航 / 顶栏（原色） */
  --nav-soft: #f4ecd2;
  --accent: #529d6b;      /* 选中 / 标题（原色） */
  --accent-soft: #e3f3e8;
  --green: #4EB771;       /* 文字绿色（原色） */
  --login: #64CD88;       /* 登录页背景（原色） */
  --btn: #D5B139;         /* 按钮金色（原色） */
  --blue: #60a3bc;        /* Logo 圆圈（原色） */
  --danger: #ae0404;
  --danger-soft: #fbe6e6;
  --success: #3dae04;
  --success-soft: #e6f6dc;
  --cream: #fcfee6;
  --bg: #f8f9fa;
  --text: #24301f;
  --muted: #7d8577;
  --line: #e7eadf;
  --card: #ffffff;
  --radius: 18px;
  --shadow: 0 2px 10px rgba(40, 70, 30, .07), 0 1px 2px rgba(40, 70, 30, .05);
  --tabbar-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

/* asia 中文字体的 @font-face 在 assets/asia-font.css */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}
img { max-width: 100%; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + var(--safe-t)) 14px 10px;
  background: var(--nav);
  box-shadow: 0 1px 0 rgba(0,0,0,.05);
}
.topbar-title { flex: 1; text-align: center; font-size: 18px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-btn, .topbar-logo, .topbar-spacer { width: 40px; height: 40px; flex: 0 0 40px; display: grid; place-items: center; border-radius: 50%; }
.topbar-btn { background: rgba(255,255,255,.6); }
.topbar-btn:active { background: #fff; }
.topbar-btn .ic { width: 22px; height: 22px; }
.topbar-logo img { width: 38px; height: 38px; object-fit: contain; }

/* ---------- Segmented tabs (Calendar | Food Menu) ---------- */
.segment {
  display: flex; gap: 6px; margin: 14px 16px 0; padding: 5px;
  background: #fff; border-radius: 999px; box-shadow: var(--shadow);
}
.segment a {
  flex: 1; text-align: center; padding: 9px 10px; border-radius: 999px;
  font-weight: 700; font-size: 15px; color: var(--muted);
}
.segment a.is-active { background: var(--accent); color: #fff; }

/* ---------- Page ---------- */
.page {
  max-width: 640px; margin: 0 auto;
  padding: 16px 16px calc(var(--tabbar-h) + var(--safe-b) + 24px);
}
.section-title { font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 22px 4px 10px; }
.section-title:first-child { margin-top: 4px; }

/* ---------- Bottom tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around; align-items: stretch;
  height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: var(--nav);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -4px 16px rgba(40,70,30,.10);
}
.tabbar-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 11.5px; font-weight: 700; color: #5b4e22;
}
.tabbar-item .ic { width: 26px; height: 26px; }
.tabbar-item.is-active { color: var(--accent); }
.tabbar-item.is-active .ic { transform: translateY(-1px); }
.tabbar-logo { width: 34px; height: 30px; display: grid; place-items: center; }
.tabbar-logo img { width: 34px; height: 30px; object-fit: contain; }
.tabbar-item.is-active .tabbar-logo { transform: scale(1.08); }

/* ---------- Cards & lists ---------- */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.card + .card { margin-top: 14px; }
.card-pad { padding: 18px; }
.card-head { padding: 14px 18px; font-weight: 800; color: var(--accent); font-size: 17px; border-bottom: 1px solid var(--line); }

.list { list-style: none; margin: 0; padding: 0; }
.list-item {
  display: flex; align-items: center; gap: 14px;
  padding: 15px 18px; min-height: 58px;
  border-top: 1px solid var(--line);
}
.list-item:first-child { border-top: 0; }
a.list-item:active, button.list-item:active { background: var(--nav-soft); }
button.list-item { width: 100%; border: 0; background: none; text-align: left; cursor: pointer; }
.list-item .ic { width: 22px; height: 22px; flex: 0 0 22px; color: var(--accent); }
.list-item .chev { width: 18px; height: 18px; flex: 0 0 18px; color: #c9c1b3; }
.list-body { flex: 1; min-width: 0; }
.list-title { display: block; font-weight: 700; font-size: 16px; }
.list-sub { display: block; color: var(--muted); font-size: 14px; }

/* Entry cards (events, bills, logs) — keep the playful cream style */
.entry {
  position: relative; display: flex; gap: 14px; align-items: center;
  background: var(--cream); border-radius: var(--radius);
  padding: 16px 16px 16px 20px; margin-bottom: 12px;
  box-shadow: var(--shadow); border: 1.5px solid #f1ecd0;
  overflow: hidden;
}
.entry::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--danger); }
.entry.is-green::before { background: var(--success); }
.entry.is-orange::before { background: var(--accent); }
.entry.is-today { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
a.entry:active { transform: scale(.99); }
.entry-body { flex: 1; min-width: 0; }
.entry-kicker { font-size: 13px; font-weight: 700; color: var(--muted); }
.entry-title { font-size: 17px; font-weight: 800; margin: 2px 0; word-wrap: break-word; }
.entry-title.is-closure { color: var(--danger); }
.entry-text { font-size: 15px; color: #4b463f; word-wrap: break-word; }
.entry .chev { width: 20px; height: 20px; flex: 0 0 20px; color: #c9c1b3; }
.entry-thumb { width: 46px; height: 46px; flex: 0 0 46px; border-radius: 14px; background: #fff; display: grid; place-items: center; }
.entry-thumb img { width: 38px; height: 38px; object-fit: contain; }
.entry-amount { font-weight: 800; font-size: 16px; white-space: nowrap; }

/* Pills / tags */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; vertical-align: middle; }
.pill-red { background: var(--danger-soft); color: var(--danger); }
.pill-green { background: var(--success-soft); color: #2a7a03; }
.pill-orange { background: var(--accent); color: #fff; }
.pill-soft { background: var(--accent-soft); color: #2f6a43; }

/* Empty state */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty img { width: 90px; opacity: .85; margin-bottom: 8px; }
.empty p { margin: 0; font-weight: 600; }

/* Notice */
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--danger-soft); color: var(--danger); font-weight: 700; font-size: 14px; margin-bottom: 14px; }
.notice .ic { width: 20px; height: 20px; flex: 0 0 20px; margin-top: 1px; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > .ic { position: absolute; left: 14px; width: 20px; height: 20px; color: var(--muted); pointer-events: none; }
.input {
  width: 100%; height: 52px; padding: 0 16px; border-radius: 14px;
  border: 1.5px solid var(--line); background: #fff; font-size: 16px; outline: none;
  transition: border-color .15s, box-shadow .15s; -webkit-appearance: none; appearance: none;
}
.input-wrap > .ic + .input { padding-left: 44px; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.input-toggle { position: absolute; right: 6px; width: 40px; height: 40px; border: 0; background: none; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.input-toggle .ic { width: 20px; height: 20px; }
.input-wrap .input-toggle + .input, .input-wrap .input.has-toggle { padding-right: 48px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 52px; padding: 0 22px; border-radius: 999px; border: 0; cursor: pointer;
  font-weight: 800; font-size: 16px; background: var(--btn); color: #fff;
  box-shadow: 0 4px 12px rgba(213,177,57,.3); transition: transform .1s, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .55; }
.btn-block { width: 100%; }
.btn-light { background: #fff; color: var(--text); box-shadow: var(--shadow); }
.btn-orange { background: var(--accent); box-shadow: 0 4px 12px rgba(82,157,107,.3); }
.btn .ic { width: 20px; height: 20px; }

/* Date bar */
.datebar { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; }
.datebar .input { flex: 1; text-align: center; font-weight: 700; }
.datebar .icon-btn { width: 52px; height: 52px; flex: 0 0 52px; border-radius: 14px; border: 0; background: #fff; box-shadow: var(--shadow); display: grid; place-items: center; cursor: pointer; }
.datebar .icon-btn .ic { width: 22px; height: 22px; }
.datebar .icon-btn:active { background: var(--nav-soft); }
.today-link { display: block; text-align: center; margin: -6px 0 14px; font-weight: 700; font-size: 14px; color: var(--accent); background: none; border: 0; width: 100%; cursor: pointer; }

/* ---------- Home ---------- */
.hello { margin: 2px 4px 14px; }
.hello small { display: block; color: var(--muted); font-weight: 700; }
.hello strong { font-size: 24px; font-weight: 800; color: var(--accent); }

.carousel { position: relative; border-radius: 22px; overflow: hidden; box-shadow: var(--shadow); background: var(--cream); }
.carousel-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.carousel-track::-webkit-scrollbar { display: none; }
.slide { position: relative; flex: 0 0 100%; scroll-snap-align: start; aspect-ratio: 4 / 3; background: var(--cream); display: block; }
.slide img { width: 100%; height: 100%; object-fit: contain; display: block; }
.slide-cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 30px 16px 26px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.65)); }
.slide-cap h3 { font-size: 18px; font-weight: 800; }
.slide-cap p { margin: 2px 0 0; font-size: 14px; opacity: .92; }
.slide-dl { position: absolute; top: 12px; right: 12px; background: rgba(255,255,255,.92); color: var(--text); }
.dots { position: absolute; left: 0; right: 0; bottom: 8px; display: flex; justify-content: center; gap: 6px; }
.dots button { width: 8px; height: 8px; padding: 0; border-radius: 99px; border: 0; background: rgba(255,255,255,.6); transition: width .2s; cursor: pointer; }
.dots button.is-active { width: 22px; background: #fff; }

.shortcuts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 18px; }
.shortcut { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 4px 12px; background: #fff; border-radius: 18px; box-shadow: var(--shadow); font-size: 12.5px; font-weight: 700; text-align: center; }
.shortcut .ic-wrap { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.shortcut:nth-child(2) .ic-wrap { background: var(--success-soft); color: var(--success); }
.shortcut:nth-child(3) .ic-wrap { background: var(--danger-soft); color: var(--danger); }
.shortcut:nth-child(4) .ic-wrap { background: #e3f1f6; color: var(--blue); }
.shortcut .ic { width: 24px; height: 24px; }
.shortcut:active { transform: scale(.97); }

/* ---------- Bill detail ---------- */
.amount-card { text-align: center; padding: 26px 18px 22px; position: relative; }
.amount-card .label { color: var(--muted); font-weight: 700; font-size: 14px; }
.amount-card .amount { font-size: 38px; font-weight: 800; margin: 2px 0 6px; }
.amount-card .stamp { position: absolute; right: 10px; top: 10px; width: 92px; transform: rotate(10deg); opacity: .95; }
.upload-box { padding: 4px 18px 18px; }
.file-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 130px; border: 2px dashed #e3d9c2; border-radius: 16px; background: var(--cream); color: var(--muted); font-weight: 700; text-align: center; padding: 16px; cursor: pointer; }
.file-drop .ic { width: 30px; height: 30px; color: var(--accent); }
.file-drop img { max-height: 220px; border-radius: 12px; }
.file-drop input { display: none; }

/* ---------- Gallery (weekly log) ---------- */
.log-desc { font-size: 16px; line-height: 1.65; word-wrap: break-word; }
.gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.gallery button { padding: 0; border: 0; border-radius: 14px; overflow: hidden; aspect-ratio: 1; background: var(--cream); cursor: zoom-in; }
.gallery button:first-child:nth-last-child(odd) { grid-column: 1 / -1; aspect-ratio: 4 / 3; }
.gallery img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- Student detail ---------- */
.kid-hero { display: flex; align-items: center; gap: 14px; padding: 18px; }
.avatar { width: 52px; height: 52px; flex: 0 0 52px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 20px; color: #fff; background: var(--accent); }
.avatar.sm { width: 42px; height: 42px; flex-basis: 42px; font-size: 17px; }
.kv { display: grid; grid-template-columns: 42% 1fr; gap: 4px 14px; padding: 12px 18px; border-top: 1px solid var(--line); font-size: 15px; }
.kv:first-child { border-top: 0; }
.kv dt { color: var(--muted); font-weight: 700; }
.kv dd { margin: 0; word-wrap: break-word; font-weight: 600; }
.kv-head { padding: 10px 18px 4px; font-weight: 800; color: var(--accent); font-size: 14px; border-top: 1px solid var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 3px 10px; border-radius: 99px; font-size: 13px; font-weight: 700; background: #f1eee8; color: #a39c90; }
.chip.on { background: var(--danger-soft); color: var(--danger); }

/* ---------- Login ---------- */
body.login { background: var(--login); min-height: 100vh; display: flex; flex-direction: column; }
.login-wrap { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: calc(30px + var(--safe-t)) 20px 30px; max-width: 460px; width: 100%; margin: 0 auto; }
.login-card { position: relative; background: #fff; border-radius: 26px; padding: 84px 22px 26px; box-shadow: 0 10px 30px rgba(20, 80, 40, .18); margin-top: 70px; }
.brand-ring { position: absolute; left: 50%; top: -70px; transform: translateX(-50%); width: 140px; height: 140px; border-radius: 50%; background: var(--blue); padding: 7px; box-shadow: 0 8px 20px rgba(96,163,188,.35); }
.brand-ring img { width: 100%; height: 100%; border-radius: 50%; border: 3px solid #fff; background: #fff; object-fit: contain; }
.brand-name { display: block; margin: 0 auto 6px; max-width: 80%; max-height: 70px; object-fit: contain; }
.brand-fallback { text-align: center; font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.login-sub { text-align: center; color: var(--muted); font-weight: 600; margin: 0 0 22px; }
.form-error { display: flex; gap: 8px; align-items: center; padding: 10px 14px; border-radius: 12px; background: var(--danger-soft); color: var(--danger); font-weight: 700; font-size: 14px; margin-bottom: 16px; }
.form-error .ic { width: 18px; height: 18px; flex: 0 0 18px; }
.login-foot { text-align: center; color: #fff; font-size: 13px; margin-top: 18px; }
.login-foot a { font-weight: 800; }

/* ---------- Loading & dialogs ---------- */
.loading { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: rgba(30,25,15,.35); }
.spinner { width: 46px; height: 46px; border-radius: 50%; border: 5px solid rgba(255,255,255,.4); border-top-color: #fff; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.dialog-backdrop { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(30,25,15,.45); animation: fade .15s ease-out; }
.dialog { width: 100%; max-width: 380px; background: #fff; border-radius: 22px; padding: 22px 20px 16px; box-shadow: 0 20px 50px rgba(0,0,0,.25); animation: pop .18s ease-out; }
.dialog h3 { font-size: 19px; font-weight: 800; margin-bottom: 6px; }
.dialog p { margin: 0 0 18px; color: #4b463f; }
.dialog-actions { display: flex; gap: 10px; }
.dialog-actions .btn { flex: 1; height: 46px; }
.dialog-image { max-width: 100%; max-height: 80vh; border-radius: 14px; display: block; margin: 0 auto; }
.dialog-backdrop.is-image { background: rgba(0,0,0,.85); }
.dialog-backdrop.is-image .dialog { background: transparent; box-shadow: none; padding: 0; max-width: 100%; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.94); opacity: 0; } }

/* Skeleton loader */
.skeleton { height: 86px; border-radius: var(--radius); margin-bottom: 12px; background: linear-gradient(90deg, #f0ece3 25%, #f8f5ee 50%, #f0ece3 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Rotate notice: phones in landscape only ---------- */
.rotate-overlay { display: none; }
@media screen and (orientation: landscape) and (max-height: 500px) {
  .rotate-overlay { display: flex; position: fixed; inset: 0; z-index: 999; background: #000; color: #fff; flex-direction: column; align-items: center; justify-content: center; gap: 10px; font-weight: 700; }
  .rotate-overlay img { height: 45%; }
  .tabbar { display: none; }
}

@media (min-width: 700px) {
  .tabbar { left: 50%; right: auto; width: 640px; transform: translateX(-50%); }
}

/* 品牌中文字体（原 app 的 asia 字体）用在标题和按钮 */
.topbar-title, .btn, .segment a, .tabbar-item span, .hello strong, .card-head, .entry-title, .section-title, .brand-fallback, .dialog h3 {
  font-family: "asia", "Nunito", -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}
body { font-family: "Nunito", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif; }
.section-title { text-transform: none; letter-spacing: .02em; font-size: 14px; }

/* ---------- 成长日志 月历 ---------- */
.month-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.month-bar .icon-btn { width: 46px; height: 46px; flex: 0 0 46px; border-radius: 14px; border: 0; background: #fff; box-shadow: var(--shadow); display: grid; place-items: center; cursor: pointer; }
.month-bar .icon-btn .ic { width: 22px; height: 22px; }
.month-bar .icon-btn[disabled] { opacity: .35; }
.month-title { flex: 1; text-align: center; font-family: "asia", "Nunito", sans-serif; font-size: 20px; font-weight: 800; }
.month-title select { border: 0; background: transparent; font: inherit; color: inherit; text-align: center; -webkit-appearance: none; appearance: none; cursor: pointer; padding: 0 2px; }
.cal { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px; }
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.cal-head div { text-align: center; font-size: 13px; font-weight: 800; color: #fff; background: var(--accent); border-radius: 10px; padding: 5px 0; }
.cal-grid { margin-top: 6px; }
.cal-day { position: relative; aspect-ratio: 1 / .9; border-radius: 12px; border: 0; background: #f6f7f2; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; color: var(--text); cursor: default; padding: 0; }
.cal-day.is-out { background: transparent; color: #c5cabd; }
.cal-day.has-log { background: var(--accent-soft); color: #2f6a43; cursor: pointer; }
.cal-day.has-log::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-top: 3px; }
.cal-day.is-today { box-shadow: inset 0 0 0 2px var(--btn); color: var(--danger); }
.cal-day.is-active { background: var(--accent); color: #fff; }
.cal-day.is-active::after { background: #fff; }
.today-chip { display: inline-flex; margin: 0 auto 12px; }
.log-entry { scroll-margin-top: 80px; }
.log-entry.is-flash { box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); border-color: var(--accent); }
.log-by { margin-top: 8px; font-size: 13px; color: var(--muted); font-weight: 700; }

/* ---------- 考试记录 ---------- */
.chips-scroll { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; margin: 0 -2px 6px; scrollbar-width: none; }
.chips-scroll::-webkit-scrollbar { display: none; }
.chip-btn { flex: 0 0 auto; border: 1.5px solid var(--accent); background: #fff; color: var(--accent); border-radius: 999px; padding: 8px 16px; font-weight: 800; font-size: 14px; cursor: pointer; font-family: "asia", "Nunito", sans-serif; }
.chip-btn.is-active { background: var(--accent); color: #fff; }
.subject-row { display: grid; grid-template-columns: 30% 1fr; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--line); }
.subject-row:first-child { border-top: 0; }
.subject-name { font-weight: 800; color: #2f6a43; }
.subject-text { word-wrap: break-word; }

/* 签到 */
.checkin-thumb { width: 54px; height: 54px; flex: 0 0 54px; border-radius: 14px; object-fit: cover; background: #fff; }
.kid-switch .list-item.is-current { background: var(--accent-soft); }
.kid-switch .tick { width: 22px; height: 22px; color: var(--accent); }
.entry-thumb .ic { width: 26px; height: 26px; color: var(--accent); }
