/* 大地香氛學堂 — 大地色系 */
:root {
  --bg: #f6f2e9;
  --card: #ffffff;
  --primary: #5f6f3e;      /* 橄欖綠 */
  --primary-deep: #47542e;
  --accent: #c2703d;       /* 陶土橘 */
  --gold: #b98a2f;
  --text: #3c382f;
  --muted: #8a8374;
  --line: #e7e0d2;
  --danger: #b3402f;
  --ok: #4d7c4a;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(60, 56, 47, .07);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body {
  font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  background: var(--bg); color: var(--text);
  max-width: 480px; margin: 0 auto; min-height: 100vh;
  padding-bottom: 84px;
}

/* Header */
.hdr {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(135deg, var(--primary-deep), var(--primary));
  color: #fff; padding: 14px 18px 12px;
  display: flex; align-items: center; justify-content: space-between;
  border-radius: 0 0 20px 20px;
}
.hdr .brand { font-size: 1.1rem; font-weight: 700; letter-spacing: .05em; display: flex; align-items: center; gap: 8px; }
.hdr .brand small { display: block; font-size: .68rem; font-weight: 400; opacity: .82; letter-spacing: .12em; }
.pts-chip {
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px; padding: 6px 14px; text-align: center; line-height: 1.15;
}
.pts-chip b { font-size: 1.05rem; color: #ffe9b8; }
.pts-chip span { font-size: .62rem; opacity: .85; display: block; }

/* Layout */
.page { padding: 14px 14px 20px; display: none; }
.page.on { display: block; }
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 15px 16px; margin-bottom: 12px; border: 1px solid var(--line);
}
h2.sec { font-size: .95rem; color: var(--primary-deep); margin: 4px 2px 10px; letter-spacing: .06em; }
.muted { color: var(--muted); font-size: .8rem; }
.small { font-size: .75rem; }

/* Segmented */
.seg { display: flex; background: #ece6d8; border-radius: 12px; padding: 4px; margin-bottom: 12px; }
.seg button {
  flex: 1; border: 0; background: transparent; padding: 9px 0; border-radius: 9px;
  font-size: .9rem; color: var(--muted); font-weight: 600; cursor: pointer;
}
.seg button.on { background: #fff; color: var(--primary-deep); box-shadow: var(--shadow); }

/* Chips */
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; }
.chips button {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 5px 12px; font-size: .78rem; color: var(--muted); white-space: nowrap; cursor: pointer;
}
.chips button.on { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Course card */
.course { display: flex; gap: 12px; align-items: flex-start; }
.datebox {
  min-width: 56px; text-align: center; background: #f0ead9; border-radius: 12px; padding: 8px 4px;
  color: var(--primary-deep);
}
.datebox b { font-size: 1.25rem; display: block; }
.datebox span { font-size: .66rem; letter-spacing: .05em; }
.course h3 { font-size: .95rem; margin-bottom: 3px; }
.course p { font-size: .78rem; color: var(--muted); line-height: 1.5; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.tag {
  font-size: .68rem; padding: 3px 9px; border-radius: 999px;
  background: #f0ead9; color: var(--primary-deep);
}
.tag.gold { background: #f7ecd2; color: var(--gold); font-weight: 700; }
.tag.ok { background: #e4efe2; color: var(--ok); font-weight: 700; }
.tag.warn { background: #f9e5dd; color: var(--accent); }

/* Buttons */
.btn {
  display: inline-block; border: 0; border-radius: 12px; cursor: pointer;
  padding: 11px 16px; font-size: .9rem; font-weight: 700; letter-spacing: .04em;
  background: var(--primary); color: #fff; text-align: center;
}
.btn.full { width: 100%; }
.btn.accent { background: var(--accent); }
.btn.ghost { background: #fff; color: var(--primary-deep); border: 1.5px solid var(--primary); }
.btn.gray { background: #eee7d8; color: var(--muted); }
.btn.sm { padding: 7px 13px; font-size: .8rem; border-radius: 10px; }
.btn:disabled { opacity: .45; cursor: default; }
.btnrow { display: flex; gap: 8px; margin-top: 10px; }
.btnrow .btn { flex: 1; }

/* GPS status */
.gps { font-size: .8rem; padding: 9px 12px; border-radius: 10px; background: #f0ead9; margin: 10px 0; line-height: 1.5; }
.gps.ok { background: #e4efe2; color: var(--ok); }
.gps.bad { background: #f9e0da; color: var(--danger); }

/* Toggle */
.toggle { display: flex; align-items: center; justify-content: space-between; padding: 4px 2px; }
.switch { position: relative; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; background: #d8d0bd; border-radius: 999px; transition: .2s; cursor: pointer;
}
.slider:before {
  content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .2s;
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider:before { transform: translateX(20px); }

/* Inputs */
input[type=text], input[type=tel], input[type=number], textarea, select {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px;
  padding: 11px 13px; font-size: .95rem; font-family: inherit; background: #fffdf8; color: var(--text);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); }
label.fl { display: block; font-size: .78rem; color: var(--muted); margin: 10px 2px 5px; }
textarea { resize: vertical; min-height: 96px; line-height: 1.6; }

/* Product grid */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.prod { text-align: center; padding: 14px 10px 12px; }
.prod .emoji { font-size: 2.1rem; }
.prod h3 { font-size: .82rem; margin: 7px 0 3px; min-height: 2.1em; line-height: 1.3; }
.prod .pt { color: var(--gold); font-weight: 800; font-size: .95rem; }
.prod .pt small { color: var(--muted); font-weight: 400; }

/* Ledger / list rows */
.row { display: flex; justify-content: space-between; align-items: center; padding: 10px 2px; border-bottom: 1px dashed var(--line); gap: 8px; }
.row:last-child { border-bottom: 0; }
.row .l { font-size: .82rem; line-height: 1.45; }
.row .l .muted { display: block; }
.row .r { font-weight: 800; font-size: .95rem; white-space: nowrap; }
.row .r.plus { color: var(--ok); }
.row .r.minus { color: var(--danger); }

/* Streak */
.streak { display: flex; gap: 5px; margin: 10px 0 4px; }
.streak i {
  flex: 1; height: 9px; border-radius: 5px; background: #e9e2d0; font-style: normal;
}
.streak i.on { background: linear-gradient(90deg, var(--primary), var(--accent)); }

/* Big stat */
.bigstat { text-align: center; padding: 20px 14px; }
.bigstat b { font-size: 2.2rem; color: var(--primary-deep); }
.bigstat .muted { margin-top: 4px; }

/* Bottom nav */
.nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; z-index: 30;
  background: #fffdf8; border-top: 1px solid var(--line);
  display: flex; padding: 6px 4px calc(8px + env(safe-area-inset-bottom));
}
.nav button {
  flex: 1; border: 0; background: transparent; cursor: pointer;
  font-size: .66rem; color: var(--muted); padding: 5px 0 2px; font-family: inherit;
}
.nav button .ico { display: block; font-size: 1.35rem; margin-bottom: 2px; filter: grayscale(.9); opacity: .65; }
.nav button.on { color: var(--primary-deep); font-weight: 700; }
.nav button.on .ico { filter: none; opacity: 1; }

/* Modal */
.modal-bg {
  position: fixed; inset: 0; background: rgba(40, 36, 26, .5); z-index: 40;
  display: none; align-items: flex-end; justify-content: center;
}
.modal-bg.on { display: flex; }
.modal {
  background: var(--bg); width: 100%; max-width: 480px; border-radius: 22px 22px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); max-height: 86vh; overflow-y: auto;
}
.modal h3 { color: var(--primary-deep); margin-bottom: 10px; }

/* Toast */
#toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%);
  background: rgba(50, 46, 36, .92); color: #fff; padding: 11px 20px; border-radius: 999px;
  font-size: .85rem; z-index: 60; display: none; white-space: nowrap; max-width: 90vw;
}

/* Banner */
.banner {
  background: linear-gradient(135deg, #6d7c49, #8a9660);
  border-radius: var(--radius); color: #fff; padding: 16px; margin-bottom: 12px;
}
.banner b { font-size: 1.05rem; }
.banner p { font-size: .78rem; opacity: .9; margin-top: 4px; line-height: 1.5; }

.center { text-align: center; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; }
.divider { border: 0; border-top: 1px dashed var(--line); margin: 12px 0; }
.notice { font-size: .72rem; color: var(--muted); line-height: 1.6; margin-top: 10px; }
