/* 响应式覆盖层：平板 + 手机适配（2026-11-30）
   隔离原则：本文件只写媒体查询覆盖，不改 app.css / app.js / v-white.css 本体；
   在 index.html 与 v-white.html 的样式表最后引入，同特异性下本文件胜出。
   断点：≤1100 平板横/小笔记本（侧栏自动收成 68 图标栏，与手动收起同形态）
         ≤860  平板竖（指标 2×2、低区堆叠）
         ≤640  手机（底部固定导航条、主数字 40 档、表格内部横滚）
   深色令牌已在 app.css / v-white.css 成对，本层只动布局数值，不碰颜色。 */

/* ================= ≤1100px：平板横屏 / 小笔记本 ================= */
@media (max-width:1100px){
  .shell{gap:16px;padding:16px}
  .main{gap:16px}
  .skeleton{gap:16px;padding:16px}
  /* 中区双列 → 单列：图表全宽在上、平台占比在下，不挤 */
  .grid-mid{grid-template-columns:1fr}
  /* 低区（账户表 + 留资）先保持双列，到 860 再堆叠 */
  .grid-low{grid-template-columns:1.5fr 1fr}
  /* 主卡指标保持 4 列横排，数字降一档 */
  .stat-row{grid-template-columns:repeat(4,1fr);gap:0}
  .stat{padding:0 14px}
  .stat-value{font-size:24px;line-height:30px}
  .stat-value .cur-s{font-size:15px;vertical-align:4px}
}

/* 平板区间（641–1100）：侧栏自动收成 68px 图标栏，形态与 body.side-collapsed 手动收起完全一致；
   ≤640 不在此列，走底部导航条 */
@media (min-width:641px) and (max-width:1100px){
  .sidebar{display:flex;width:68px;flex-basis:68px;padding:22px 10px 16px}
  .brand{justify-content:center;padding:2px 0 20px}
  .brand-text,.nav-item>span,.nav-badge,.side-user>div{display:none}
  .nav-item{justify-content:center;padding:0}
  .side-user{justify-content:center;padding:0}
  .sk-side{width:68px;flex-basis:68px}
  /* 悬停名牌胶囊（data-tip 由 app.js 从导航文字自动填充，与手动收起态同一形态） */
  .nav-item::after{
    content:attr(data-tip);position:absolute;left:calc(100% + 14px);top:50%;
    transform:translate(-4px,-50%);background:var(--anchor-bg);color:var(--anchor-text);
    padding:6px 12px;border-radius:999px;font-size:12px;line-height:16px;font-weight:600;letter-spacing:.15px;
    white-space:nowrap;opacity:0;pointer-events:none;z-index:80;
    box-shadow:0 10px 24px rgba(0,0,0,.25);
    transition:opacity 150ms ease,transform 150ms ease;
  }
  .nav-item:hover::after{opacity:1;transform:translate(0,-50%)}
}

/* ================= ≤860px：平板竖屏 ================= */
@media (max-width:860px){
  /* 主卡指标改 2×2：奇数项去左分隔线与左内距，行间留白 */
  .stat-row{grid-template-columns:repeat(2,1fr);gap:20px 0}
  .stat{padding:0 16px}
  .stat:nth-child(odd){border-left:none;padding-left:0}
  /* 账户表与留资列表上下堆叠 */
  .grid-low{grid-template-columns:1fr}
  /* 顶栏允许换行，分段控件与日夜开关不溢出 */
  .topbar{flex-wrap:wrap;row-gap:10px}
  .topbar-left{flex-wrap:wrap;row-gap:6px}
  .page-title{font-size:26px;line-height:34px}
  .seg-btn{padding:5px 12px}
  /* 主卡按钮组可折到标题下方 */
  .hero-top{flex-wrap:wrap}
  .hero-actions{padding-top:2px}
  .card{padding:22px 20px}
}

/* ================= ≤640px：手机 ================= */
@media (max-width:640px){
  .shell{padding:12px 12px 96px;gap:14px}
  .main{gap:14px}
  .grid-mid,.grid-low{gap:14px}

  /* 侧栏 → 底部固定导航条（只留图标横排，拇指够得着；含数据大屏共 7 项）
     选择器带 body.side-collapsed 一份：防桌面端存下的收起状态把底栏压回 68 宽 */
  .sidebar,body.side-collapsed .sidebar{
    display:flex; /* 覆盖 app.css ≤1100 的 display:none，底栏必须显形 */
    position:fixed;top:auto;left:0;right:0;bottom:0;z-index:60;
    width:auto;flex:none;height:auto;
    flex-direction:row;align-items:center;
    padding:6px 6px calc(6px + env(safe-area-inset-bottom,0px));
    border-radius:20px 20px 0 0;
  }
  .brand,.side-foot{display:none}
  .nav{flex-direction:row;flex:1;justify-content:space-between;gap:0}
  .nav-item{height:48px;padding:0 9px;justify-content:center;border-radius:12px}
  .nav-item>span{display:none}
  /* 计数徽章缩成图标右上角小标，不占横排宽度 */
  .nav-badge{position:absolute;top:0;right:0;margin:0;padding:0 5px}
  /* 触屏无悬停：关掉收起态名牌胶囊，防点按残留 */
  body.side-collapsed .nav-item::after{display:none}
  /* 顶栏收放按钮在手机上无对象（导航已在底部），隐藏省位 */
  .side-trigger{display:none}

  /* 顶栏：标题降档，右侧控件组换行到第二行靠右，不溢出 */
  .page-title{font-size:24px;line-height:32px}
  .topbar-right{margin-left:auto}
  .seg-btn{padding:5px 11px;font-size:13px}

  /* 卡片内距收紧到 16px */
  .card{padding:20px 16px}
  .hero{padding:22px 16px 18px}
  /* 主数字降到 40 档 */
  .hero-number{font-size:40px;line-height:1.08}
  .hero-number .cur{font-size:24px;vertical-align:6px}
  .hero-sub{margin-top:6px}
  /* 指标 2×2 沿用 860 档，列内距再收一点 */
  .stat{padding:0 12px}
  .stat:nth-child(odd){padding-left:0}
  .spark{height:24px;margin-top:8px}

  /* 图表卡收高，图例可换行 */
  .chart-card{height:300px}
  .legend{flex-wrap:wrap;gap:6px 12px}
  .card-head{flex-wrap:wrap}

  /* 表格改卡内横向滚动：整表成滚动容器，单元格不换行保列宽，整页不横滚；
     网格项必须放行 min-width:0，否则表格的最小内容宽会把整列撑出屏幕 */
  .grid-mid>.card,.grid-low>.card{min-width:0}
  .acct-table{display:block;overflow-x:auto;max-width:100%;-webkit-overflow-scrolling:touch;padding-bottom:4px}
  .acct-table th,.acct-table td{white-space:nowrap}

  /* 留资行：产品名可省略，徽章不被挤出 */
  .lead-top{flex-wrap:wrap}
  .lead-prod{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:150px}

  /* 骨架屏同形态：无侧栏条，行改竖排 */
  .skeleton{padding:12px;gap:14px}
  .sk-side{display:none}
  .sk-row{flex-direction:column;gap:14px}
  .sk-row .w300{width:auto;flex:none}
  .sk-row .grow{flex:none;height:190px}
}
