/* Mole Console 移动端适配 —— 桌面端样式不受影响（媒体查询内规则只作用于窄屏）

   通用修正：顶栏在放不下时横向滑动，而不是把整页撑出横向滚动条。
   上游 fleet 样式在 900~1180px 区间会出现这个横向溢出问题。 */
.topbar { min-width: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.topbar::-webkit-scrollbar { display: none; }
.topbar > * { flex: none; }

/* 页头工具条：放不下就换行，不要把整页撑宽 */
.page-head .row { flex-wrap: wrap; min-width: 0; }
.page-head .toolbar { flex-wrap: wrap; justify-content: flex-end; min-width: 0; }

/* 断点 820px：手机 / 竖屏平板走底部导航，跨列卡片全部单列 */

@media (max-width: 820px) {

  /* ---------------------------------------------- 骨架：侧栏 → 底部导航 */
  .app { display: block; height: auto; min-height: 100dvh; }

  .rail {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    width: 100%; height: auto; flex-direction: row; align-items: center;
    padding: 7px 10px calc(7px + env(safe-area-inset-bottom));
    gap: 0; z-index: 200;
    background: var(--bg-top);              /* 实色，避免内容从底部导航透出来 */
    border-top: 1px solid var(--line);
    box-shadow: 0 -8px 26px -14px rgba(16, 24, 40, .22);
  }
  .rail .logo { display: none; }

  .rail-nav {
    flex-direction: row; align-items: center; justify-content: space-between;
    width: 100%; margin: 0; padding: 0;
    background: transparent; border: 0; box-shadow: none; gap: 2px;
    overflow: visible; border-radius: 0;
  }
  .nav-sep { width: 1px; height: 20px; align-self: center; margin: 0 5px; flex: none; }
  .nav-btn { width: auto; height: 46px; flex: 1 1 0; min-width: 0; border-radius: 13px; }
  .nav-btn svg { width: 20px; height: 20px; }
  .nav-btn.on { box-shadow: 0 6px 14px -6px rgba(245, 51, 63, .6); }
  .nav-btn .tip { display: none; }          /* 触屏没有 hover，去掉浮层提示 */
  .nav-live { position: absolute; top: 6px; right: 8px; }

  .main { height: 100dvh; padding: 12px 12px 0; gap: 12px; }
  .scroll { padding: 2px 0 86px; }          /* 给底部导航留出空间 */

  /* ---------------------------------------------- 顶栏：单行横向滑动 */
  .topbar {
    flex-wrap: nowrap; gap: 8px; padding-bottom: 5px;
    -webkit-overflow-scrolling: touch;
  }
  .topbar::-webkit-scrollbar { display: none; }

  .wordmark { font-size: 15px; flex: none; gap: 4px; padding-right: 0; }
  .wordmark .arrow { display: none; }

  .pod { flex: none; padding: 6px 12px 6px 6px; border-radius: 14px; gap: 8px; }
  .pod .ic { width: 30px; height: 30px; border-radius: 10px; }
  .pod .ic svg { width: 15px; height: 15px; }
  .pod .k { font-size: 9px; letter-spacing: .08em; }
  .pod .v { font-size: 13.5px; margin-top: 1px; }
  .pod .v small { font-size: 10px; margin-left: 2px; }

  .top-right { margin-left: 0; gap: 8px; flex: none; }
  .risk { padding: 6px 11px; min-width: 0 !important; border-radius: 13px; gap: 1px; }
  .risk .k { font-size: 9.5px; }
  .risk .v { font-size: 12.5px; gap: 6px; }
  .risk .up-arrow { display: none; }
  .ring { width: 9px; height: 9px; border-width: 2px; }
  .theme-btn { width: 38px; height: 38px; border-radius: 12px; }
  .theme-btn svg { width: 17px; height: 17px; }

  /* ---------------------------------------------- 页头 */
  .page-head { margin: 4px 0 14px; }
  .page-head .row { flex-wrap: wrap; align-items: flex-start; gap: 8px; }
  .page-head h1 { font-size: 26px; letter-spacing: -.03em; }
  .page-head p { font-size: 12.5px; margin-top: 5px; line-height: 1.45; }
  .count-badge { margin-bottom: 2px; font-size: 12.5px; }
  .toolbar {
    width: 100%; margin-left: 0; margin-bottom: 0;
    overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none;
    padding-bottom: 2px;
  }
  .toolbar::-webkit-scrollbar { display: none; }
  .toolbar > * { flex: none; }
  .chip { padding: 9px 14px; font-size: 12.5px; }
  .btn-dark { padding: 10px 17px; font-size: 12.5px; }

  /* ---------------------------------------------- 卡片与栅格 */
  :root { --gap-lg: 12px; --gap-md: 10px; }
  .bento { gap: 12px; }
  .card { padding: 17px 15px; border-radius: 20px; }
  .card.pad-lg { padding: 17px 15px; }
  .card-h { margin-bottom: 12px; gap: 8px; }
  .card-h h3 { font-size: 15px; }
  .card-h .sub, .card-h .r .tiny { font-size: 11.5px; }

  .bignum { font-size: 40px; gap: 6px; }
  .bignum small { font-size: 14px; }
  .bignum.sm { font-size: 26px; }
  .bignum.sm small { font-size: 12.5px; }
  .card.tall-num .bignum { font-size: 42px; }

  .g-2, .g-3, .g-4 { grid-template-columns: minmax(0, 1fr); }
  .kv .k { font-size: 11px; }
  .kv .v { font-size: 13.5px; }
  .divider { margin: 12px 0; }

  .gauge-wrap { flex-direction: column; align-items: center; gap: 12px; }
  .gauge-wrap > div[style*="flex:1"] { width: 100%; }
  .gauge { width: 124px; height: 124px; }
  .gauge .g-v { font-size: 24px; }
  .gauge .g-k { font-size: 9.5px; }
  .gauge-wrap .kv { display: flex; flex-direction: row; align-items: baseline; justify-content: space-between; }
  .gauge-wrap .kv .v { font-size: 14px; }

  /* 卡片内的行列表：窄屏改为上下堆叠，避免数值被挤断 */
  .row-item { padding: 11px 13px; grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .row-item > div[style*="margin-left:auto"] { text-align: left !important; }
  .rows .row-item[style*="display:flex"] { flex-wrap: wrap; gap: 8px; }
  .svc { padding: 16px 15px; border-radius: 20px; }
  .svc-actions { margin-left: 0; margin-top: 8px; width: 100%; }
  .svc-actions .chip, .svc-actions .btn-dark { flex: 1; justify-content: center; }
  .svc-foot { flex-wrap: wrap; }

  /* ---------------------------------------------- 终端 */
  .term-wrap { height: calc(100dvh - 300px); min-height: 260px; border-radius: 14px; padding: 8px 8px; }
  .term-bar { gap: 8px; padding-top: 10px; }
  .term-quick {
    flex-wrap: nowrap; overflow-x: auto; width: 100%;
    scrollbar-width: none; padding-bottom: 3px;
  }
  .term-quick::-webkit-scrollbar { display: none; }
  .term-quick .chip { flex: none; font-size: 11px; padding: 8px 11px; }
  .term-out { font-size: 11.5px; padding: 12px; max-height: 46vh; }
  .alert-banner { font-size: 12px; padding: 10px 12px; flex-wrap: wrap; }

  /* ---------------------------------------------- 弹层与提示 */
  .sheet { width: 94vw; padding: 18px 16px; border-radius: 22px; max-height: 82vh; }
  .sheet-h h2 { font-size: 16.5px; }
  .toast {
    left: 12px; right: 12px; width: auto; transform: translateY(14px);
    bottom: calc(84px + env(safe-area-inset-bottom));
    text-align: center; font-size: 12.5px; padding: 12px 16px;
  }
  .toast.on { transform: none; }
}

/* 超窄屏（iPhone SE 等）再压一档 */
@media (max-width: 430px) {
  .page-head h1 { font-size: 23px; }
  .bignum { font-size: 34px; }
  .card.tall-num .bignum { font-size: 36px; }
  .card { padding: 15px 13px; }
  .wordmark { font-size: 13px; }
  .pod { padding: 5px 10px 5px 5px; gap: 7px; }
  .pod .ic { width: 27px; height: 27px; }
  .pod .v { font-size: 12.5px; }
  .pod .v small { font-size: 9.5px; }
  .nav-btn svg { width: 19px; height: 19px; }
  .gauge { width: 112px; height: 112px; }
  .term-quick .chip { font-size: 10.5px; padding: 7px 10px; }
}
