@media (max-width: 720px) and (orientation: portrait) {
  /* 顶栏：两行，品牌 + 可横滑操作区 */
  .topbar { flex-wrap: wrap; padding: 10px 14px; gap: 8px; }
  .brand-text p { display: none; }
  .top-actions { width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .top-actions::-webkit-scrollbar { display: none; }
  /* 统计：横滑卡片 */
  .stats { display: flex; overflow-x: auto; gap: 10px; padding-bottom: 8px; scroll-snap-type: x proximity; }
  .stat { flex: 0 0 72%; scroll-snap-align: start; }
  /* 主布局：单列，时间轴在上、侧栏在下 */
  .layout { display: flex; flex-direction: column; gap: 12px; }
  .side { position: static; max-height: none; overflow: visible; }
  /* 时间轴工具条：只留必要项，横向可滑 */
  .tl-toolbar { overflow-x: auto; flex-wrap: nowrap; }
  .tl-toolbar::-webkit-scrollbar { display: none; }
  .tl-scroll { max-height: none; min-height: 0; overflow: visible; }
  .tl-inner { min-width: 0 !important; width: 100% !important; }
  /* 手机议程清单 */
  .m-agenda { display: flex; flex-direction: column; gap: 10px; padding: 12px; }
  .m-agenda-head { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--text-2); }
  .m-card { position: relative; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); transition: transform .18s var(--spring); }
  .m-card:active { transform: scale(.985); }
  .m-card-top { display: flex; align-items: center; gap: 8px; }
  .m-card-top b { font-size: 14px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .m-badge { flex: 0 0 auto; font-size: 10.5px; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
  .m-badge.done { background: #e7f6ef; color: #0f9d76; }
  .m-badge.blocked { background: #fdecec; color: #d64545; }
  .m-badge.ongoing { background: #e8f7ef; color: #0f9d76; }
  .m-card-sub { margin-top: 6px; font-size: 11.5px; color: var(--muted); }
  .m-card-next { margin-top: 6px; font-size: 12px; color: var(--text-2); }
  .m-card-bar { margin-top: 10px; height: 4px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
  .m-card-bar span { display: block; height: 100%; width: 100%; border-radius: 999px; }
  .m-new { width: 100%; padding: 12px; border: 1.5px dashed rgba(var(--accent-rgb), .5); border-radius: 14px; background: rgba(var(--accent-rgb), .05); color: var(--accent); font-size: 13px; font-weight: 600; }
  .m-back-agenda { margin: 8px 12px; }
  /* 弹层全屏（已有基础规则，这里补宽度） */
  .modal { padding: 0; align-items: stretch; }
  .modal-card { width: 100%; max-width: 100%; height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .drawer { width: 100%; max-width: 100%; }
}
@media (max-width: 720px) and (orientation: portrait) {
  .m-tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
    background: rgba(255, 255, 255, .94); backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  }
  .m-tab {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    border: 0; background: none; color: var(--muted); font-size: 10.5px;
    padding: 6px 0; border-radius: 10px; transition: color .16s, background .16s;
  }
  .m-tab i { font-size: 17px; font-style: normal; line-height: 1; }
  .m-tab.on { color: var(--accent); background: rgba(var(--accent-rgb), .08); }
  .m-fab {
    display: grid; place-items: center; position: fixed; right: 16px;
    bottom: calc(74px + env(safe-area-inset-bottom)); z-index: 71;
    width: 54px; height: 54px; border-radius: 50%; border: 0;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff; font-size: 26px; box-shadow: 0 12px 28px rgba(35, 50, 90, .28);
  }
  .m-fab:active { transform: scale(.92); }
  .app { padding-bottom: calc(86px + env(safe-area-inset-bottom)); }

  /* 分栏：默认只显示时间轴 */
  .layout { display: block; }
  .side { display: none; }
  body[data-m-tab="timeline"] .tl-card { display: block; }
  body[data-m-tab="timeline"] .side { display: none; }
  body[data-m-tab="deadlines"] .tl-card { display: none; }
  body[data-m-tab="deadlines"] .side { display: flex; }
  body[data-m-tab="deadlines"] .side .card:not(:first-child) { display: none; }
  body[data-m-tab="labs"] .tl-card { display: none; }
  body[data-m-tab="labs"] .side { display: flex; }
  body[data-m-tab="labs"] .side .card:not(:nth-child(4)) { display: none; }
  /* 节点/地点单列卡片占满高度 */
  body[data-m-tab="deadlines"] .side .card, body[data-m-tab="labs"] .side .card { max-height: none; }
  /* 议程分区 */
  .m-sec { display: flex; flex-direction: column; gap: 10px; }
  .m-sec-head {
    display: flex; align-items: center; gap: 8px; margin: 14px 2px 4px;
    font-size: 11.5px; font-weight: 700; letter-spacing: .02em; color: var(--muted);
    text-transform: uppercase;
  }
  .m-sec-head span { font-weight: 500; color: var(--line); }
  .m-sec:first-child .m-sec-head { margin-top: 2px; }
  /* 顶栏在竖屏收成一行（品牌 + 头像），工具栏简化 */
  .topbar { border-radius: 0; box-shadow: none; }
  .top-actions .btn.ghost:not(#btnNew) { display: none; }
  .top-actions { gap: 6px; }
  .tl-toolbar { padding: 8px 10px; }
  .tl-toolbar .seg { display: none; }
}
@media (max-width: 720px) and (orientation: portrait) {
  body.app-live .m-tabbar { display: flex; }
  body.app-live .m-fab { display: grid; }
}
@media (max-width: 720px) and (orientation: portrait) {
  .tl-card { display: block !important; }
  .tl-card .tl-scroll { display: block !important; max-height: none !important; min-height: 0 !important; overflow: visible !important; }
  .tl-card .tl-inner { display: block !important; width: auto !important; min-width: 0 !important; }
  .tl-foot { display: none !important; }
  .tl-toolbar { position: static; overflow-x: auto; gap: 6px; padding: 8px 10px; }
  .tl-toolbar .seg, .tl-toolbar .zoom, .tl-toolbar .fine-window, .tl-toolbar .today-btn { display: none !important; }
  .tl-toolbar .search { min-width: 140px; flex: 1 1 140px; }
  .top-actions .btn.primary { flex: 0 0 auto; }
  .ws-chip { max-width: 130px; }
  .ws-chip .ws-role { display: none !important; }
  .ws-chip .ws-name { max-width: 74px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .user-chip .user-name { display: none; }
  .stats { margin-bottom: 10px; }
  .m-agenda { padding: 12px 14px 20px; }
}
@media (max-width: 720px) and (orientation: portrait) {
  #coachTip { display: none !important; }
  .tl-toolbar select, .tl-toolbar #statusFilter, .tl-toolbar #labFilter { display: none !important; }
  .tl-toolbar .search { flex: 1 1 100%; }
  .stat { flex: 0 0 58%; padding: 10px 12px; }
  .stat-sub { display: none; }
  .stat-value { font-size: 22px; }
  .stat-label { font-size: 11px; }
  .m-card { padding: 12px 13px; }
  .m-ms-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
  .m-ms-chip { font-size: 10.5px; padding: 3px 8px; border-radius: 999px; background: var(--hover); border: 1px solid var(--line-soft); color: var(--text-2); }
}
@media (max-width: 720px) and (orientation: portrait) {
  body { font-size: 13.5px; }
  /* 工具栏：只留「全部 / 未来30天 / 本月」做成大号时间 chip */
  .tl-toolbar { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  .tl-toolbar .search, .tl-toolbar select, .tl-toolbar #statusFilter, .tl-toolbar #labFilter,
  .tl-toolbar .seg:not(#viewSeg), .tl-toolbar .zoom, .tl-toolbar .fine-window, .tl-toolbar .today-btn { display: none !important; }
  #viewSeg { display: flex !important; width: 100%; order: 1; background: var(--line-soft); border-radius: 12px; padding: 4px; }
  #viewSeg button { flex: 1; padding: 9px 0; font-size: 13px; font-weight: 600; border-radius: 9px; border: 0; background: transparent; color: var(--text-2); }
  #viewSeg button.on { background: var(--surface); color: var(--accent); box-shadow: 0 2px 8px rgba(23,35,66,.08); }

  /* 议程卡片：更紧凑、一屏能看 2 张以上 */
  .m-agenda { padding: 10px 12px 16px; gap: 8px; }
  .m-agenda-head { margin-bottom: 2px; }
  .m-sec { gap: 8px; }
  .m-sec-head { margin: 8px 2px 2px; font-size: 11px; }
  .m-card { padding: 10px 12px; border-radius: 13px; }
  .m-card-top b { font-size: 14.5px; }
  .m-card-sub { margin-top: 4px; font-size: 11.5px; }
  .m-card-next { display: none; }
  .m-ms-chips { margin-top: 7px; flex-wrap: nowrap; overflow: hidden; }
  .m-ms-chip { font-size: 11px; padding: 3px 8px; white-space: nowrap; }
  .m-card-bar { height: 3px; margin-top: 8px; }

  /* 节点 tab：大触控行 */
  .dl-item { padding: 12px 10px; }
  .dl-title { font-size: 13.5px; }
  .dl-sub { font-size: 11.5px; }
  .side .card { border-radius: 14px; }
  .side { padding: 0 12px 8px; }

  /* 顶栏更轻 */
  .topbar { padding: 9px 12px; }
  .brand-text h1 { font-size: 15px; }
  .top-actions .btn.primary { padding: 10px 16px; font-size: 13.5px; }
}
@media (max-width: 720px) and (orientation: portrait) {
  .stats { display: none !important; }
  .m-span-card { margin: 10px 12px 4px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
  .m-span-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
  .m-span-head b { font-size: 13.5px; }
  .m-span-head span { font-size: 10.5px; color: var(--muted); }
  .m-span { position: relative; margin-top: 22px; padding-bottom: 6px; touch-action: none; }
  .m-span-axis { position: relative; height: 14px; }
  .m-span-tick { position: absolute; top: 0; transform: translateX(-50%); font-size: 9.5px; color: var(--muted); }
  .m-span-lane { position: relative; height: 26px; margin-top: 4px; }
  .m-span-bar {
    position: absolute; top: 0; height: 26px; border-radius: 8px; color: #fff;
    display: flex; align-items: center; padding: 0 10px; overflow: hidden;
    font-size: 10px; white-space: nowrap; box-shadow: 0 3px 10px rgba(23, 35, 66, .16);
    touch-action: none; cursor: grab;
  }
  .m-span-bar:active { cursor: grabbing; }
  .m-span-bar span { overflow: hidden; text-overflow: ellipsis; }
  .m-span-edge { position: absolute; right: 0; top: 0; bottom: 0; width: 16px; cursor: ew-resize; }
  .m-span-edge::after { content: ""; position: absolute; right: 5px; top: 6px; bottom: 6px; width: 2px; border-radius: 2px; background: rgba(255,255,255,.75); }
  .m-span-today { position: absolute; top: 14px; bottom: 0; width: 2px; background: #ff7a7a; opacity: .7; pointer-events: none; }
  .m-span-today span { position: absolute; top: -14px; left: -12px; font-size: 9px; color: #e05b5b; }
  .m-span-empty { font-size: 11.5px; color: var(--muted); padding: 12px 0; text-align: center; }
  .m-span-sum { margin-top: 8px; font-size: 11px; color: var(--muted); }
}
@media (max-width: 720px) and (orientation: portrait) {
  .tl-toolbar { display: none !important; }
  .m-agenda { padding: 10px 12px 18px; gap: 12px; }
  .m-hero { padding: 16px 16px 14px; border-radius: 16px; color: #fff; background: linear-gradient(135deg, #5b6cff, #7b8cff 55%, #9aa7ff); box-shadow: 0 14px 34px rgba(79, 107, 255, .28); }
  .m-hero-date { font-size: 11.5px; opacity: .85; letter-spacing: .04em; }
  .m-hero-title { margin-top: 4px; font-size: 20px; font-weight: 750; letter-spacing: -.01em; }
  .m-hero-sub { margin-top: 6px; font-size: 12px; opacity: .9; }
  .m-scope { display: flex; gap: 6px; margin-top: 12px; background: rgba(255,255,255,.18); padding: 4px; border-radius: 12px; }
  .m-scope button { flex: 1; border: 0; background: transparent; color: rgba(255,255,255,.85); font-size: 12px; padding: 7px 0; border-radius: 9px; }
  .m-scope button.on { background: #fff; color: #4f6bff; font-weight: 700; }
  .m-nodes { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
  .m-node { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 12px; background: rgba(255,255,255,.16); }
  .m-node.overdue { background: rgba(255, 120, 120, .28); }
  .m-node-check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(255,255,255,.85); background: transparent; flex: 0 0 auto; }
  .m-node-check:active, .m-node-check.doing { background: #fff; }
  .m-node-main { flex: 1; min-width: 0; }
  .m-node-main b { display: block; font-size: 13px; }
  .m-node-main span { display: block; font-size: 11px; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .m-node-when { font-size: 11px; opacity: .95; white-space: nowrap; }
  .m-nodes-empty { font-size: 12px; opacity: .9; padding: 4px 0; }
  .m-span-card { margin: 0; padding: 12px 14px; }
  .m-span-head b { font-size: 13px; }
  .m-span-sum { font-size: 10.5px; }
  .m-list-head { display: flex; align-items: baseline; gap: 8px; margin: 2px 2px 6px; }
  .m-list-head b { font-size: 12.5px; color: var(--text-2); }
  .m-list-head span { font-size: 11px; color: var(--muted); }
  .m-card { padding: 11px 13px; }
  .m-card-next { display: block; margin-top: 7px; font-size: 11.5px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
  .m-card-next .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
  .m-card-next.ok { color: #0f9d76; }
  .m-empty { font-size: 12px; color: var(--muted); padding: 16px 0; text-align: center; }
}
@media (max-width: 720px) and (orientation: portrait) {
  .m-span-head { flex-wrap: nowrap; }
  .m-span-head b { flex: 0 0 auto; }
  .m-span-head span { flex: 1; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .m-span-axis { height: 16px; }
  .m-span-tick { font-size: 9.5px; white-space: nowrap; }
  .m-span-tick:first-child { transform: none; }
  .m-span-tick:last-child { transform: translateX(-100%); }
  .m-span-today { z-index: 0; }
  .m-span-lane { z-index: 2; }
  .m-span-today span { display: none !important; }
  .m-span-bar { padding-right: 22px; z-index: 3; }
  .m-span-bar span { padding-right: 2px; }
  .m-hero-title { line-height: 1.22; }
  .m-node-when { flex: 0 0 auto; margin-left: 2px; }
  .m-node-main span { padding-right: 4px; }
  .m-list-head { flex-wrap: nowrap; }
}
@media (max-width: 720px) and (orientation: portrait) {
  /* 任务栏 = 节点 + 地点 两卡片依次显示 */
  body[data-m-tab="tasks"] .tl-card { display: none !important; }
  body[data-m-tab="tasks"] .side { display: flex !important; flex-direction: column; }
  body[data-m-tab="tasks"] .side .card { display: block !important; }
  body[data-m-tab="timeline"] .tl-card, body[data-m-tab="timeline"] .side { display: block; }
  body[data-m-tab="timeline"] .side { display: none !important; }

  /* 时间跨度卡片：更清晰的层次 */
  .m-span-card { padding: 14px; }
  .m-span-head { align-items: center; gap: 8px; }
  .m-span-head b { font-size: 14px; }
  .m-span-today-chip { margin-left: auto; padding: 2px 8px; border-radius: 999px; background: rgba(255, 122, 122, .14); color: #d64545; font-size: 10.5px; font-weight: 700; white-space: nowrap; }
  .m-span-range { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
  .m-span { margin-top: 14px; }
  .m-span-axis { height: 18px; border-bottom: 1px dashed var(--line-soft); margin-bottom: 6px; }
  .m-span-tick { font-size: 9px; color: var(--muted); padding-bottom: 4px; }
  .m-span-lane { height: 20px; margin-top: 5px; }
  .m-span-bar { height: 20px; border-radius: 999px; padding: 0 10px 0 12px; font-size: 9.5px; box-shadow: 0 2px 6px rgba(23, 35, 66, .12); }
  .m-span-bar::before { content: ""; position: absolute; left: 5px; top: 50%; width: 4px; height: 4px; margin-top: -2px; border-radius: 50%; background: rgba(255,255,255,.85); }
  .m-span-edge::after { right: 4px; top: 5px; bottom: 5px; width: 1.5px; }
  .m-span-sum { margin-top: 8px; font-size: 10px; }
  /* 任务栏标题间距 */
  body[data-m-tab="tasks"] .side .card + .card { margin-top: 10px; }
  body[data-m-tab="tasks"] .card-head h2 { font-size: 14px; }
}

/* 我的页面 */
.m-me-page { position: fixed; inset: 0; z-index: 120; background: var(--bg); display: flex; flex-direction: column; }
.m-me-page[hidden] { display: none !important; }
.me-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px calc(10px + env(safe-area-inset-top)); border-bottom: 1px solid var(--line); background: var(--surface); }
.me-head b { font-size: 16px; }
.me-back { margin-left: auto; width: 32px; height: 32px; border: 0; border-radius: 50%; background: var(--hover); color: var(--text-2); font-size: 15px; }
.me-body { flex: 1; overflow: auto; padding: 14px 16px calc(30px + env(safe-area-inset-bottom)); }
.me-account { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.me-avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 18px; font-weight: 700; color: #fff; background: linear-gradient(135deg, #5b6cff, #8b7bff); }
.me-acc-main { flex: 1; min-width: 0; }
.me-acc-main b { display: block; font-size: 15px; }
.me-acc-main span { display: block; margin-top: 2px; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.me-role { font-size: 10.5px; padding: 3px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.me-sec { margin-top: 18px; }
.me-sec-title { font-size: 11.5px; font-weight: 700; color: var(--muted); margin: 0 2px 8px; }
.me-wss, .me-themes, .me-motions { display: flex; flex-wrap: wrap; gap: 8px; }
.me-ws, .me-theme, .me-motion { padding: 9px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 12.5px; color: var(--text-2); }
.me-ws.on, .me-theme.on, .me-motion.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.me-row { width: 100%; display: flex; align-items: center; gap: 10px; padding: 14px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-size: 13.5px; color: var(--text); margin-bottom: 8px; }
.me-row i { font-style: normal; width: 22px; text-align: center; }
.me-row span { flex: 1; text-align: left; }
.me-row b { color: var(--muted); font-weight: 400; }
.me-logout { width: 100%; margin-top: 18px; padding: 13px; border-radius: 12px; border: 1px solid rgba(214, 69, 69, .3); background: rgba(214, 69, 69, .06); color: #d64545; font-size: 14px; font-weight: 600; }
.me-ver { margin-top: 18px; text-align: center; font-size: 10.5px; color: var(--line); }

/* 手机端管理后台：全屏 + 页签横滑 */
@media (max-width: 720px) and (orientation: portrait) {
  .feat-admin-modal.modal { padding: 0; align-items: stretch; }
  .feat-admin-modal .modal-card { width: 100%; max-width: 100%; height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .feat-admin-tabs { overflow-x: auto; flex-wrap: nowrap; }
  .feat-admin-tabs::-webkit-scrollbar { display: none; }
  .feat-admin-tab { flex: 0 0 auto; padding: 9px 14px; }
  .feat-admin-body { padding: 12px; }
}

/* v3.51 手机首页极简 */
@media (max-width: 720px) and (orientation: portrait) {
  .top-actions .btn.primary#btnNew, .topbar .brand-text p { display: none !important; }
  .brand-text h1 { font-size: 15.5px; }
  .topbar { padding: 8px 12px; }
  .m-hero { padding: 14px 15px 12px; }
  .m-hero-title { font-size: 19px; }
  .m-hero-sub { margin-top: 4px; font-size: 11.5px; }
  .m-nodes-more { margin-top: 6px; align-self: flex-start; border: 0; background: transparent; color: #fff; opacity: .9; font-size: 12px; padding: 4px 2px; }
  .m-card { padding: 10px 12px; }
  .m-card-top b { font-size: 14px; }
  .m-card-sub { margin-top: 3px; font-size: 11px; }
  .m-list-head b { font-size: 12px; }
  .m-list-head span { font-size: 10.5px; }
  /* 两栏导航更宽松 */
  .m-tabbar { padding-top: 8px; }
  .m-tab span { font-size: 11px; }
}
/* v3.56 修复 scope chips 被旧白色规则覆盖 */
@media (max-width: 720px) and (orientation: portrait) {
  .m-top .m-scope button { color: var(--text-2) !important; background: transparent !important; }
  .m-top .m-scope button.on { color: var(--accent) !important; background: var(--surface) !important; font-weight: 700; box-shadow: 0 2px 8px rgba(23,35,66,.08); }
  .m-top { background: var(--surface) !important; }
  .m-nodes .m-node { color: var(--text) !important; }
  .m-nodes .m-node-main b { color: var(--text) !important; }
  .m-nodes .m-node-main span, .m-nodes .m-node-when { color: var(--muted) !important; }
  .m-nodes .m-node-check { border-color: var(--line) !important; }
  .m-nodes-more { color: var(--accent) !important; }
}

/* 我的页：分组操作按钮 */
@media (max-width: 720px) and (orientation: portrait) {
  .me-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
  .me-mini { padding: 9px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 12px; color: var(--text-2); }
  .me-mini.accent { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); font-weight: 600; }
  .me-ws.on::after { content: " ✓"; }
}
/* 未登录时不显示任何新建按钮（新版手机 FAB 在 #mApp 内，仅登录后存在） */
@media (max-width: 720px) and (orientation: portrait) {
  .m-fab { display: none !important; }
}
