/* 手機版（docs/design/mobile.html 定稿）。整份包在同一個 media query 裡，條件與
   js/lib/mobile-breakpoint.js 的 MOBILE_QUERY 一致，電腦版完全不受影響。
   類別一律 m- 開頭；圖表本身沿用 watch.css 的 .w-pane／.w-legend 等，這裡只覆蓋手機需要的部分。 */

@media (max-width: 768px), (hover: none) and (pointer: coarse) and (max-height: 500px) {

/* ---------- 外殼：藏起電腦版頂部，整頁不能被拉動（只讓內容區捲動） ---------- */
html, body {
  position: fixed;
  inset: 0;
  overflow: hidden;
  overscroll-behavior: none;
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
#shell-top { display: none; }
#page { flex: 1; min-height: 0; position: relative; }

.m-root {
  --tab-h: 49px;
  --top-h: 56px;
  --m-scale-w: 60px;  /* mobile.js 依圖表實際價格軸寬、主圖高覆寫 */
  --m-main-h: 300px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: var(--safe-t) var(--safe-r) 0 var(--safe-l);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.m-root input, .m-root textarea { user-select: text; -webkit-user-select: text; }
:where(.m-root) button { min-width: 0; padding: 0; touch-action: manipulation; }
.m-root svg.i { width: 20px; height: 20px; }
.m-root svg.i.sm { width: 14px; height: 14px; }
.m-root svg.i.md { width: 16px; height: 16px; }
.m-root :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.m-screens { position: relative; flex: 1; min-height: 0; }
.m-screen { position: absolute; inset: 0; display: none; flex-direction: column; overflow: hidden; }
.m-screen.on { display: flex; }
.m-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }

/* ---------- 底部分頁列 ---------- */
.m-tabbar {
  flex: 0 0 auto;
  display: flex;
  height: calc(var(--tab-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  margin: 0 calc(-1 * var(--safe-r)) 0 calc(-1 * var(--safe-l));
  padding-left: var(--safe-l);
  padding-right: var(--safe-r);
  background: var(--panel);
  border-top: 1px solid var(--line);
}
.m-tabbar button {
  flex: 1;
  min-height: 49px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 500;
}
.m-tabbar button svg.i { width: 24px; height: 24px; }
.m-tabbar button.on { color: var(--accent); }
.m-badgewrap { position: relative; display: inline-flex; }
.m-cnt {
  position: absolute;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--fill);
  color: var(--ink);
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}
.m-cnt[hidden] { display: none; }
.m-tabbar .m-cnt { top: -4px; right: -10px; }

/* ---------- 共用按鈕 ---------- */
.m-iconbtn {
  position: relative;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: var(--text-2);
}
.m-iconbtn:active { background: var(--panel-2); }
.m-iconbtn .m-cnt { top: 6px; right: 4px; }
.m-btn {
  min-height: 48px;
  padding: 0 18px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
}
.m-btn.m-primary { background: var(--fill); color: var(--ink); }
.m-btn.m-ghost { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
.m-btn.m-danger { background: var(--down-soft); color: var(--down); }
.m-btn[disabled] { opacity: .45; }
.m-root .up { color: var(--up); }
.m-root .down { color: var(--down); }

.m-toast {
  position: absolute;
  z-index: 90;
  left: 50%;
  bottom: calc(var(--tab-h) + var(--safe-b) + 14px);
  max-width: min(340px, calc(100% - 32px));
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  text-align: center;
  box-shadow: var(--shadow);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity .18s, transform .18s;
}
.m-toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 圖表頁 ---------- */
.m-topbar {
  flex: 0 0 auto;
  height: var(--top-h);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 4px 0 6px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.m-symbtn {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 0 8px !important;
  border-radius: 10px;
  text-align: left;
}
.m-symbtn:active { background: var(--panel-2); }
.m-l1 { display: flex; align-items: center; gap: 4px; max-width: 100%; font-size: 16px; font-weight: 600; }
.m-l1 .m-symname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-l1 svg.i { color: var(--text-3); }
.m-l2 { display: flex; gap: 8px; font-size: 13px; }
.m-l2 .m-px { color: var(--text); }
.m-tfchip {
  position: relative;
  min-width: 52px;
  height: 36px;
  margin: 0 2px;
  padding: 0 8px !important;
  border: 1px solid var(--line-2) !important;
  border-radius: 9px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}
.m-tfchip::before { content: ''; position: absolute; inset: -5px 0; } /* 觸控範圍補到 44px */

.m-chartwrap {
  position: relative;
  flex: 1;
  min-height: 0;
}
.m-panehost.w-pane {
  position: absolute;
  inset: 0;
  border: 0;
  border-radius: 0;
  background: var(--bg);
  touch-action: none;
}
.m-panehost .w-legend { top: 6px; left: 10px; right: calc(var(--m-scale-w) + 8px); gap: 8px; font-size: 12px; }
.m-panehost .w-history-status { left: 10px; font-size: 12px; padding: 4px 10px; }
.m-panehost .w-goto-btn { display: none; }
.m-panehost .w-paneico { display: none; }
.m-panehost .w-panelabel { left: 10px; }
.m-panehost .w-panename { font-size: 12px; color: var(--text-2); }
/* 提醒線的鈴鐺：手指要按得到（44px 觸控範圍），外觀維持小膠囊 */
.m-panehost .w-alert-badge { width: 26px; height: 22px; margin-top: -2px; border-radius: 5px; }
.m-panehost .w-alert-badge::before { content: ''; position: absolute; inset: -11px -10px; }
.m-chartwrap.is-crosshair .w-legend { visibility: hidden; }

.m-ohlc {
  position: absolute;
  z-index: 8;
  top: 8px;
  left: 10px;
  width: 184px;
  display: none;
  padding: 8px 10px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  box-shadow: var(--shadow);
  font-size: 13px;
  pointer-events: none;
}
.m-ohlc.is-right { left: auto; right: calc(var(--m-scale-w) + 12px); }
.m-chartwrap.is-crosshair .m-ohlc { display: block; }
.m-ohlc-t { margin-bottom: 4px; color: var(--text-2); font-size: 12px; }
.m-ohlc dl { display: grid; grid-template-columns: auto 1fr; gap: 1px 10px; margin: 0; }
.m-ohlc dt { color: var(--text-3); }
.m-ohlc dd { margin: 0; text-align: right; }

.m-fab {
  position: absolute;
  z-index: 9;
  right: calc(var(--m-scale-w) + 10px);
  top: max(8px, calc(var(--m-main-h) - 66px));
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: var(--fill);
  color: var(--ink);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .35);
  transition: opacity .15s;
}
.m-fab svg.i { width: 24px; height: 24px; stroke-width: 2; }
.m-fab-plus {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: var(--ink);
  color: var(--fill);
}
.m-fab-plus svg.i { width: 10px; height: 10px; stroke-width: 3; }
.m-fab.is-off { background: var(--panel-2); color: var(--text-3); border: 1px solid var(--line-2); box-shadow: none; }
.m-fab.is-off .m-fab-plus { background: var(--text-3); color: var(--panel-2); }
.m-chartwrap.is-crosshair .m-fab { opacity: 0; pointer-events: none; }

.m-actionbar {
  position: absolute;
  z-index: 12;
  left: 8px;
  right: calc(var(--m-scale-w) + 8px);
  bottom: 8px;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.m-chartwrap.is-crosshair .m-actionbar { display: flex; }
.m-actionbar .m-btn { flex: 1; min-width: 0; font-size: 15px; white-space: nowrap; overflow: hidden; }
.m-actionbar .m-btn span { overflow: hidden; text-overflow: ellipsis; }

/* ---------- 底部抽屜 ---------- */
.m-layer { position: absolute; inset: 0; z-index: 40; pointer-events: none; }
.m-scrim { position: absolute; inset: 0; background: rgba(5, 8, 16, .5); opacity: 0; transition: opacity .2s; }
.m-layer.is-open.scrim-on .m-scrim { opacity: 1; pointer-events: auto; }
.m-sheet {
  position: absolute;
  left: var(--safe-l);
  right: var(--safe-r);
  bottom: 0;
  max-height: 88%;
  display: flex;
  flex-direction: column;
  padding-bottom: var(--safe-b);
  border-top: 1px solid var(--line-2);
  border-radius: 18px 18px 0 0;
  background: var(--panel);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, .3);
  transform: translateY(105%);
  transition: transform .22s cubic-bezier(.2, .8, .3, 1);
  visibility: hidden;
}
.m-layer.is-open .m-sheet { visibility: visible; pointer-events: auto; }
.m-sheet.open { transform: translateY(0); }
.m-sheet.is-dragging { transition: none; }
.m-grab { flex: 0 0 auto; height: 20px; display: flex; align-items: center; justify-content: center; touch-action: none; }
.m-grab::before { content: ''; width: 36px; height: 5px; border-radius: 3px; background: var(--line-2); }
.m-sheet-head { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding: 0 8px 6px 18px; touch-action: none; }
.m-sheet-title { flex: 1; min-width: 0; margin: 0; font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-meta { margin-left: 6px; color: var(--text-3); font-size: 13px; font-weight: 400; }
.m-sheet-body { min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; padding: 4px 18px 12px; }
.m-sheet-foot { flex: 0 0 auto; padding: 10px 18px 8px; border-top: 1px solid var(--line); }
.m-sheet-foot[hidden] { display: none; }
.m-foot-btns { display: flex; gap: 10px; }
.m-foot-btns .m-btn { flex: 1; }

.m-secttl { margin: 12px 0 6px; color: var(--text-3); font-size: 12px; }
.m-secttl:first-child { margin-top: 0; }
.m-note { margin-top: 10px; color: var(--text-3); font-size: 12px; line-height: 1.55; }
.m-list { display: flex; flex-direction: column; }
.m-li {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 2px !important;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  text-align: left;
  color: var(--text);
}
.m-li:last-child { border-bottom: 0; }
.m-li .m-grow { flex: 1; min-width: 0; }
.m-li .m-grow small { display: block; color: var(--text-3); font-size: 12px; }
.m-li.is-dis { color: var(--text-3); }
.m-li.is-warn { color: var(--down); }
.m-li.is-danger { color: var(--down); }
.m-li.is-accent { color: var(--accent); }
.m-li .m-ck { color: var(--accent); }
.m-switch-hit { flex: 0 0 auto; width: 59px; height: 44px; display: flex; align-items: center; justify-content: center; }
.m-switch { position: relative; width: 51px; height: 31px; border-radius: 16px; background: var(--line-2); transition: background .15s; }
.m-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .15s; }
.m-switch.on { background: var(--fill); }
.m-switch.on::after { transform: translateX(20px); }
.m-li.is-full .m-switch { opacity: .55; }

.m-segctl { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); }
.m-segctl button { flex: 1; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 9px; color: var(--text-2); font-size: 15px; font-weight: 500; }
.m-segctl button[aria-pressed="true"] { background: var(--fill-soft); color: var(--accent); box-shadow: inset 0 0 0 1px var(--fill-border); }
.m-segdesc { margin-top: 6px; color: var(--text-3); font-size: 12px; }

/* 週期 */
.m-favrow { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.m-favrow button { min-width: 56px; min-height: 44px; padding: 0 14px !important; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-2); font-size: 15px; font-weight: 600; }
.m-favrow button[aria-pressed="true"] { border-color: var(--fill-border); background: var(--fill-soft); color: var(--accent); }
.m-favrow button.is-na { opacity: .42; }
.m-tfgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; margin-bottom: 4px; }
.m-tfcell { display: flex; align-items: center; min-height: 48px; border: 1px solid transparent; border-radius: 11px; background: var(--panel-2); }
.m-tfcell.cur { border-color: var(--fill-border); background: var(--fill-soft); }
.m-tfcell .m-pick { flex: 1; min-height: 48px; display: flex; flex-direction: column; justify-content: center; padding-left: 12px !important; text-align: left; }
.m-tfcell .m-pick b { font-size: 15px; font-weight: 600; }
.m-tfcell.cur .m-pick b { color: var(--accent); }
.m-tfcell .m-pick small { color: var(--text-3); font-size: 12px; }
.m-tfcell.na { opacity: .42; }
.m-star { flex: 0 0 auto; width: 44px; height: 48px; display: flex; align-items: center; justify-content: center; color: var(--text-3); }
.m-star.on { color: var(--accent); }
.m-star.on svg.i { fill: currentColor; }
.m-tag { display: inline-block; margin-left: 4px; padding: 1px 6px; border-radius: 999px; background: var(--tag-bg); color: var(--tag-fg); font-size: 11px; font-weight: 500; vertical-align: 1px; }

/* 提醒抽屜 */
.m-field { margin-bottom: 14px; }
.m-field > label, .m-lab { display: block; margin-bottom: 6px; color: var(--text-2); font-size: 13px; }
.m-stepper { display: flex; align-items: stretch; gap: 8px; }
.m-stepper button { width: 52px; min-height: 52px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line) !important; border-radius: 12px; background: var(--panel-2); color: var(--text); }
.m-alprice, .m-input {
  flex: 1;
  min-width: 0;
  min-height: 52px;
  width: 100%;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font-size: 16px; /* iOS：≥16px 才不會 focus 時自動放大 */
  outline: none;
}
.m-alprice { font-family: var(--mono); font-size: 22px; font-weight: 600; text-align: center; }
.m-alprice:focus, .m-input:focus, .m-note-in:focus { border-color: var(--accent); }
.m-alprice.is-invalid { border-color: var(--down); }
.m-subline { display: flex; justify-content: space-between; margin-top: 6px; color: var(--text-3); font-size: 13px; }
.m-err { margin-top: 6px; color: var(--down); font-size: 13px; }
.m-err[hidden] { display: none; }
.m-cond { min-height: 48px; display: flex; align-items: center; gap: 10px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); font-size: 15px; }
.m-cond b { font-weight: 600; }
.m-why { margin-left: auto; color: var(--text-3); font-size: 12px; white-space: nowrap; }
.m-note-in { width: 100%; min-height: 64px; padding: 10px 12px; resize: none; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--text); font: 16px var(--font); outline: none; }
.m-unsaved { display: none; align-items: center; gap: 8px; margin-bottom: 12px; padding: 10px 12px; border: 1px solid var(--fill-border); border-radius: 12px; background: var(--fill-soft); color: var(--text); font-size: 14px; }
.m-unsaved svg.i { color: var(--accent); }
.m-sheet.is-dirty .m-unsaved { display: flex; }
.m-status { margin-top: 8px; color: var(--text-2); font-size: 13px; }
.m-status[hidden] { display: none; }
.m-alactions { display: flex; gap: 10px; margin-top: 12px; }
.m-alactions .m-btn { flex: 1; }
.m-alactions .m-btn[hidden] { display: none; }
.m-more-toggle { min-height: 44px; display: none; align-items: center; gap: 6px; color: var(--text-2); font-size: 14px; }
.m-sheet.is-compact .m-full { display: none; }
.m-sheet.is-compact .m-more-toggle { display: flex; }
.m-confirm { margin: 4px 0 8px; color: var(--text-2); font-size: 15px; line-height: 1.6; }

/* ---------- 商品搜尋（全螢幕） ---------- */
.m-search {
  position: absolute;
  inset: 0;
  z-index: 45;
  display: flex;
  flex-direction: column;
  padding: var(--safe-t) var(--safe-r) var(--safe-b) var(--safe-l);
  background: var(--bg);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .18s, transform .18s;
}
.m-search[hidden] { display: none; }
.m-search.open { opacity: 1; transform: none; }
.m-search-top { display: flex; align-items: center; gap: 6px; padding: 6px 8px 6px 12px; }
.m-sbox { flex: 1; height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--panel-2); color: var(--text-3); }
.m-q { flex: 1; min-width: 0; border: 0; outline: none; background: none; color: var(--text); font: 16px var(--font); -webkit-appearance: none; appearance: none; }
.m-q::-webkit-search-cancel-button { -webkit-appearance: none; }
.m-cancel { min-height: 44px; padding: 0 8px !important; color: var(--accent); font-size: 16px; }
.m-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 12px 8px; }
.m-chips button { position: relative; min-height: 36px; padding: 0 13px !important; border: 1px solid var(--line); border-radius: 18px; background: var(--panel-2); color: var(--text-2); font-size: 14px; }
.m-chips button::before { content: ''; position: absolute; inset: -4px 0; }
.m-chips button[aria-pressed="true"] { border-color: var(--fill-border); background: var(--fill-soft); color: var(--accent); }
.m-recent { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 12px 6px; }
.m-recent button { position: relative; min-height: 40px; display: flex; align-items: center; gap: 6px; padding: 0 12px !important; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); font-size: 14px; }
.m-recent button::before { content: ''; position: absolute; inset: -2px 0; }
.m-recent svg.i { color: var(--text-3); }
.m-sec-h { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px 6px; color: var(--text-3); font-size: 12px; }
.m-res { display: flex; align-items: center; gap: 4px; min-height: 60px; padding: 0 4px 0 16px; border-bottom: 1px solid var(--line); }
.m-res .m-pick { flex: 1; min-width: 0; min-height: 60px; display: flex; align-items: center; gap: 12px; text-align: left; }
.m-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.m-nm { display: flex; align-items: center; gap: 4px; font-size: 15px; font-weight: 600; }
.m-ttl { color: var(--text-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-cat { color: var(--text-3); font-size: 12px; white-space: nowrap; }
.m-empty-res { padding: 40px 20px; text-align: center; color: var(--text-3); font-size: 14px; line-height: 1.6; }
.m-ic { flex: 0 0 32px; width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.m-badge { display: flex; align-items: center; justify-content: center; color: #fff; font: 700 11px var(--mono); letter-spacing: -.3px; }

/* ---------- 自選 ---------- */
.m-hdr { flex: 0 0 auto; height: 56px; display: flex; align-items: center; gap: 2px; padding: 0 6px 0 18px; }
.m-hdr h1 { flex: 1; margin: 0; font-size: 26px; font-weight: 700; }
.m-hdr [hidden] { display: none; }
.m-done { min-height: 44px; padding: 0 12px !important; color: var(--accent); font-size: 16px; font-weight: 600; }
.m-colhead { flex: 0 0 auto; height: 36px; display: flex; align-items: center; padding: 0 12px 0 16px; border-bottom: 1px solid var(--line); }
.m-colhead[hidden] { display: none; }
.m-colhead button { position: relative; min-height: 36px; display: inline-flex; align-items: center; gap: 2px; color: var(--text-3); font-size: 12px; }
.m-colhead button::before { content: ''; position: absolute; inset: -4px -4px; }
.m-colhead button.on { color: var(--accent); }
.m-colhead .c1 { flex: 1; justify-content: flex-start; }
.m-colhead .c2 { width: 110px; justify-content: flex-end; }
.m-colhead .c3 { width: 86px; justify-content: flex-end; }
.m-mvhint { display: none; padding: 8px 16px; border-bottom: 1px solid var(--line); background: var(--panel-2); color: var(--text-3); font-size: 12px; line-height: 1.5; }
.is-editing .m-mvhint { display: block; }
.m-wl-content { position: relative; }
.m-group > .m-gh { min-height: 44px; display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--line); background: var(--panel); }
.m-gtoggle { flex: 1; min-height: 44px; display: flex; align-items: center; gap: 6px; padding: 0 16px !important; color: var(--text-2); font-size: 13px; font-weight: 600; text-align: left; }
.m-gtoggle svg.i { color: var(--text-3); transition: transform .15s; }
.m-group.closed .m-gtoggle svg.i { transform: rotate(-90deg); }
.m-n { color: var(--text-3); font-size: 12px; font-weight: 400; }
.m-gname { flex: 1; min-width: 0; min-height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 0 0 16px !important; color: var(--text); font-size: 14px; font-weight: 600; text-align: left; }
.m-gname svg.i { color: var(--accent); }
.m-gdel { color: var(--down); }
.m-group.is-drop > .m-gh { background: var(--fill-soft); }
.m-wrow { position: relative; min-height: 58px; display: flex; align-items: center; border-bottom: 1px solid var(--line); background: var(--bg); }
.m-wrow .m-pick { flex: 1; min-width: 0; min-height: 58px; display: flex; align-items: center; gap: 12px; padding-left: 16px !important; text-align: left; }
.m-wrow .m-ttl { max-width: 150px; }
.m-bell { display: inline-flex; color: var(--accent); }
.m-wrow .m-px { flex: 0 0 auto; width: 110px; text-align: right; font-size: 15px; }
.m-wrow .m-px.is-tight, .m-pcbtn.is-tight { letter-spacing: -.5px; font-size: 13px; }
.m-pc { flex: 0 0 86px; display: flex; justify-content: flex-end; padding-right: 12px; }
.m-pcbtn { position: relative; min-width: 70px; height: 32px; padding: 0 6px !important; border-radius: 7px; background: var(--panel-2); color: var(--text-2); font-size: 13px; font-weight: 600; }
.m-pcbtn::before { content: ''; position: absolute; inset: -6px -4px; }
.m-pcbtn.u { background: var(--up); color: #fff; }
.m-pcbtn.d { background: var(--down); color: #fff; }
:root[data-theme="dark"] .m-pcbtn.u { color: #04210F; }
:root[data-theme="dark"] .m-pcbtn.d { color: #2A0606; }
.m-wrow.cur { background: color-mix(in srgb, var(--fill) 7%, var(--bg)); }
.m-wrow.cur::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--fill); }
.m-del, .m-grip { flex: 0 0 auto; width: 44px; height: 52px; display: flex; align-items: center; justify-content: center; }
.m-del span { width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; border-radius: 11px; background: var(--down); color: #fff; }
.m-del span svg.i { width: 14px; height: 14px; stroke-width: 2.6; }
.m-grip { margin-right: 4px; color: var(--text-3); touch-action: none; cursor: grab; }
.is-editing .m-wrow .m-pick { padding-left: 0 !important; }
.is-editing .m-wrow .m-px { width: auto; padding-right: 6px; color: var(--text-3); font-size: 13px; }
.m-wrow.is-lift { z-index: 3; background: var(--panel); box-shadow: 0 8px 20px rgba(0, 0, 0, .35); }
.m-dropline { position: absolute; z-index: 4; left: 8px; right: 8px; height: 3px; border-radius: 2px; background: var(--fill); pointer-events: none; }
.m-dropline[hidden] { display: none; }
.m-gempty { padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--text-3); font-size: 13px; }
.m-addgroup { width: 100%; min-height: 52px; display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--accent); font-size: 15px; font-weight: 600; }
.m-wl-foot { padding: 14px 16px 24px; color: var(--text-3); font-size: 12px; line-height: 1.6; }
.m-retry { width: calc(100% - 24px); margin: 10px 12px; min-height: 44px; padding: 8px 12px !important; border: 1px solid var(--fill-border); border-radius: 10px; color: var(--accent); font-size: 14px; text-align: left; }

/* ---------- 提醒分頁 ---------- */
.m-segwrap { flex: 0 0 auto; padding: 2px 16px 10px; }
.m-alist { display: flex; flex-direction: column; gap: 10px; padding: 2px 12px 12px; }
.m-acard-wrap { position: relative; overflow: hidden; border-radius: 14px; background: var(--down); }
.m-swipe-del { position: absolute; top: 0; right: 0; bottom: 0; width: 88px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: #fff; font-size: 13px; font-weight: 600; }
.m-acard { position: relative; display: flex; gap: 10px; padding: 12px 6px 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); touch-action: pan-y; transition: transform .18s ease; }
.m-acard.dragging { transition: none; }
.m-amain { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; text-align: left; }
.m-atop { display: flex; align-items: center; gap: 8px; }
.m-atop .m-ic { flex-basis: 24px; width: 24px; height: 24px; font-size: 10px; }
.m-asym { font-size: 15px; font-weight: 600; }
.m-adist { margin-left: auto; color: var(--text-3); font-size: 12px; }
.m-apx { font-size: 20px; font-weight: 600; letter-spacing: -.3px; }
.m-ameta { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; }
.m-ameta span { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel-2); color: var(--text-2); }
.m-ameta .dir-u { color: var(--up); border-color: color-mix(in srgb, var(--up) 35%, var(--line)); background: var(--up-soft); }
.m-ameta .dir-d { color: var(--down); border-color: color-mix(in srgb, var(--down) 35%, var(--line)); background: var(--down-soft); }
.m-amemo { color: var(--text-2); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-alast { color: var(--text-3); font-size: 12px; }
.m-aside { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.m-acard.inactive .m-apx, .m-acard.inactive .m-asym { color: var(--text-2); }
.m-astate { padding: 1px 7px; border-radius: 999px; font-size: 11px; }
.m-astate.trig { background: var(--tag-bg); color: var(--tag-fg); }
.m-astate.pause { border: 1px solid var(--line); background: var(--panel-2); color: var(--text-3); }
.m-tgnote { display: flex; gap: 8px; align-items: flex-start; margin: 4px 16px 18px; padding: 10px 12px; border: 1px dashed var(--line-2); border-radius: 12px; background: var(--panel); color: var(--text-3); font-size: 12px; line-height: 1.55; }
.m-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 40px 32px 60px; color: var(--text-2); text-align: center; }
.m-ring { width: 72px; height: 72px; display: flex; align-items: center; justify-content: center; border-radius: 36px; background: var(--fill-soft); color: var(--accent); }
.m-root .m-ring svg.i { width: 34px; height: 34px; }
.m-empty h3 { margin: 6px 0 0; color: var(--text); font-size: 17px; }
.m-empty p { margin: 0; font-size: 14px; line-height: 1.6; }
.m-desktop-only { justify-content: center; }

/* ---------- 橫向：圖表分頁藏起分頁列、頂列縮小 ---------- */
@media (orientation: landscape) and (max-height: 500px) {
  .m-root[data-tab="chart"] .m-tabbar { display: none; }
  .m-root[data-tab="chart"] { --top-h: 44px; padding-bottom: var(--safe-b); }
  .m-root[data-tab="chart"] .m-symbtn { min-height: 44px; flex-direction: row; align-items: center; justify-content: flex-start; gap: 10px; }
  .m-root[data-tab="chart"] .m-tfchip { height: 32px; }
  .m-sheet { left: 50%; right: auto; width: min(520px, 100%); margin-left: max(-260px, -50%); max-height: 94%; }
  .m-toast { bottom: calc(var(--safe-b) + 14px); }
}
.m-root[data-tab="chart"] .m-toast { bottom: calc(var(--tab-h) + var(--safe-b) + 70px); }

@media (prefers-reduced-motion: reduce) {
  .m-root *, .m-root *::before, .m-root *::after { transition: none !important; animation: none !important; }
}

} /* end @media mobile */
