@media (max-width: 640px) {
  .bento-grid { grid-template-columns: 1fr; }
  .span-2, .row-2 { grid-column: span 1; grid-row: span 1; }
  .kanban { grid-template-columns: 1fr; }
  .links-grid { grid-template-columns: 1fr; }
  .proj-metrics { grid-template-columns: repeat(2, 1fr); }
  .zone-head { align-items: flex-start; }
  .divider-chip { font-size: 11px; padding: 5px 12px; }
}

/* 同步徽标 */
.sync-badge { display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px; border: 2px solid var(--border);
  background: var(--glass); box-shadow: 3px 3px 0 var(--border);
  font-size: 12px; font-weight: 700; }
.sync-label { display: none; }
@media (min-width: 540px) { .sync-label { display: inline; } }
.sync-synced { color: var(--good); }
.sync-saving { color: var(--accent2); }
.sync-offline { color: var(--warn); }
.sync-conflict { color: var(--accent1); }
.sync-local { color: var(--muted); }

/* 触屏：44px 最小可点 + 取消高亮 + 防 iOS 输入框放大 */
@media (hover: none) and (pointer: coarse) {
  html { -webkit-tap-highlight-color: transparent; }
  body { overscroll-behavior-y: contain; }
  .glass-btn, .glass-btn-sm, button, .check, .kanban-task { min-height: 44px; }
  .inp { font-size: 16px !important; }
  .quick-link { min-height: 56px; }
}
@supports (padding: max(0px)) {
  .glass-ai { padding-bottom: max(20px, env(safe-area-inset-bottom)); }
  .ai-input { padding-bottom: max(8px, env(safe-area-inset-bottom)); }
}
@media (max-width: 640px) {
  header {
    position: sticky; top: 0; z-index: 50;
    padding-top: max(10px, env(safe-area-inset-top));
    padding-bottom: 10px;
    background: linear-gradient(180deg, var(--bg) 70%, transparent);
    backdrop-filter: blur(10px);
  }
  .logo-chip { width: 38px !important; height: 38px !important; font-size: 18px !important; }
  h1 { font-size: 16px !important; }
  header p { font-size: 11px !important; }
  .project-card, .account-card { padding: 16px !important; }
  .proj-title { font-size: 18px !important; }
  .kanban {
    display: flex; gap: 12px;
    overflow-x: auto; scroll-snap-type: x mandatory;
    margin: 0 -16px; padding: 4px 16px 12px;
    -webkit-overflow-scrolling: touch;
  }
  .kanban-col { flex: 0 0 85%; scroll-snap-align: start; min-width: 85%; }
  .glass-ai {
    top: auto !important; bottom: 0; left: 0; right: 0;
    width: 100% !important; max-width: 100% !important; height: 90vh !important;
    border-radius: 24px 24px 0 0 !important;
    transform: translateY(100%) !important;
  }
  .glass-ai.open { transform: translateY(0) !important; }
  .glass-ai::before {
    content: ''; display: block; width: 40px; height: 4px;
    background: var(--border); border-radius: 2px; margin: 8px auto 4px;
  }
  .note-tools { flex-wrap: wrap; }
  .note-tools .inp { width: 100% !important; }
}
.inp, textarea { font-size: 14px; }
@media (min-width: 540px) { .inp, textarea { font-size: 13px; } }

/* v2 移动端：底部主导航 + 单列项目工作区 */
@media (max-width: 900px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  .topbar { grid-template-columns: 1fr; min-height: 64px; padding: max(9px,env(safe-area-inset-top)) 14px 8px; }
  .desktop-nav { display: none; }
  .top-actions { display: none; }
  .brand h1 { font-size: 15px !important; }.brand p{font-size:8px!important}.logo-chip{width:38px;height:38px;font-size:18px}
  .main-wrap { width: min(100% - 24px, 720px); padding-top: 15px; padding-bottom: calc(105px + env(safe-area-inset-bottom)); }
  .command-hero { align-items: stretch; flex-direction: column; padding: 23px; }
  .command-hero h2 { font-size: 27px; }.hero-capture{min-width:0;width:100%}
  .dashboard-grid,.overview-lower,.review-grid,.project-grid,.account-grid{grid-template-columns:1fr}
  .project-summary-grid,.review-stats{grid-template-columns:repeat(2,1fr)}
  .record-lanes{grid-template-columns:1fr;background:transparent}.record-lane{border-top:1px solid var(--border);min-height:90px}
  .milestone-grid{grid-template-columns:1fr}.prep-list{grid-template-columns:1fr}
  .function-head{align-items:flex-start}.function-actions{flex-direction:column;align-items:flex-end}.function-actions .soft-badge{display:none}
  .project-hero{align-items:flex-start}.project-hero-main{align-items:flex-start}.project-hero h2{font-size:22px}.project-score strong{font-size:28px}.project-score span{display:none}.project-emoji.large{width:48px;height:48px;font-size:24px}
  .page-heading,.section-heading{flex-direction:column;align-items:flex-start}.source-pill{margin-top:4px}.section-heading h2,.page-heading h2{font-size:24px}
  .command-hero h2,.hero-copy{overflow-wrap:anywhere}
  .modal-mask{align-items:end;padding:0}.quick-modal,.record-modal{max-height:92vh;overflow-y:auto;border-radius:26px 26px 0 0;padding:23px;padding-bottom:max(23px,env(safe-area-inset-bottom));box-shadow:0 -12px 30px rgba(35,20,40,.18)}
  .form-grid{grid-template-columns:1fr}.quick-textarea{min-height:150px}
  .mobile-nav{position:fixed;left:10px;right:10px;bottom:max(10px,env(safe-area-inset-bottom));z-index:80;display:grid;grid-template-columns:repeat(5,1fr);align-items:end;height:66px;padding:6px;border:2px solid var(--border);border-radius:22px;background:color-mix(in srgb,var(--glass) 94%,transparent);box-shadow:0 8px 28px rgba(35,20,40,.18);backdrop-filter:blur(18px)}
  .mobile-nav button{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;height:50px;border:0;border-radius:15px;background:transparent;color:var(--muted);font-weight:900}.mobile-nav button>span{font-size:17px}.mobile-nav small{font-size:8px}.mobile-nav button.active{color:var(--accent1);background:color-mix(in srgb,var(--accent1) 10%,transparent)}.mobile-nav .capture{align-self:center;width:51px;height:51px;margin:-23px auto 0;border:3px solid var(--bg);border-radius:18px;background:linear-gradient(135deg,var(--accent1),var(--accent2));color:#fff;box-shadow:4px 5px 0 rgba(255,93,162,.24);transform:rotate(-4deg)}.mobile-nav .capture span{font-size:28px}.mobile-nav i{position:absolute;top:2px;right:10px;display:grid;place-items:center;min-width:16px;height:16px;padding:0 4px;border-radius:99px;background:var(--pop);color:#3d2b3d;font-size:8px;font-style:normal}
}

@media (max-width: 520px) {
  .panel{padding:17px}.command-hero{padding:20px}.project-card,.account-card{padding:18px!important}
  .project-title-row h3{font-size:19px}.project-percent{font-size:27px}.project-facts{gap:14px;flex-wrap:wrap}.next-strip{align-items:flex-start}
  .project-summary-grid{grid-template-columns:1fr 1fr}.summary-tile{padding:12px}.summary-tile:nth-child(2){grid-column:span 2}
  .review-stats>div{padding:13px}.review-stats strong{font-size:23px}
  .inbox-panel{padding:4px 13px}.inbox-action{display:none}.inbox-icon{width:36px;height:36px}
  .record-footer{align-items:flex-end}.record-footer .modal-actions{flex-wrap:wrap}
}
