/* 宝助台 · 移动端适配
   取向：适老化 + 一屏一任务。
   - 手机上是一列流，不并排（并排在窄屏上必然挤成一团）
   - 按钮加大到手指好按的尺寸（最小 44px）
   - 字号整体上调，弱光/户外也能看清
   - 左侧业务线列表折叠成抽屉，不占首屏
   桌面端不受影响：所有规则都包在 @media 里 */

/* ============ 手机：顶栏 ============ */
@media (max-width: 860px) {
  :root {
    --mob-topbar-h: 56px;
  }

  html, body {
    font-size: 17px;                 /* 桌面 15px → 手机 17px */
    -webkit-text-size-adjust: 100%;
  }

  header.topbar {
    height: var(--mob-topbar-h);
    padding: 0 12px;
    gap: 8px;
    position: sticky;
    top: 0;
  }

  header.topbar .brand {
    font-size: 17px;
    letter-spacing: 1px;
    gap: 6px;
  }
  header.topbar .brand small { display: none; }   /* 手机上不占地方 */
  header.topbar .brand img { width: 24px; height: 24px; border-radius: 5px; }

  header.topbar button {
    padding: 9px 14px;
    font-size: 15px;
    min-height: 40px;
  }

  /* 顶栏在手机上只留：图标 + 最重要的一两个按钮 */
  header.topbar #btn-verify { display: none; }   /* 总检在手机上没用 */
}

/* ============ 手机：主体单列 ============ */
@media (max-width: 860px) {
  main {
    flex-direction: column;
    height: auto;
    min-height: calc(100% - var(--mob-topbar-h));
    padding-bottom: 76px;             /* 给底部操作条留位 */
  }

  /* 业务线列表：横向滚动的胶囊条，不占竖向空间 */
  aside.lines {
    width: 100%;
    flex: none;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 8px 10px;
    display: flex;
    flex-direction: row;
    gap: 7px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    background: var(--paper);
    position: sticky;
    top: var(--mob-topbar-h);
    z-index: 20;
  }
  aside.lines::-webkit-scrollbar { display: none; }

  aside .ln-title { display: none; }  /* 标题在手机上没意义 */

  aside .ln {
    flex: none;
    padding: 7px 14px;
    border-radius: 15px;
    border: 1px solid var(--line);
    background: var(--bg);
    font-size: 15px;
    white-space: nowrap;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
  }
  aside .ln.on {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
  }
  aside .ln i, aside .ln em { display: none; }   /* 手机上不显示计数小字 */

  /* 工作区：单列全宽 */
  section.work {
    width: 100%;
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px 12px 20px;
  }
}

/* ============ 手机：卡片与表格 ============ */
@media (max-width: 860px) {
  /* 表格在手机上横滚会很难受，改成卡片式逐行展示 */
  .tbl {
    display: block;
    overflow-x: visible;
    border: none;
  }
  .tbl thead { display: none; }
  .tbl tr {
    display: block;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 10px;
    padding: 10px 12px;
    background: var(--paper);
    box-shadow: var(--shadow);
  }
  .tbl td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    border: none;
    padding: 5px 0;
    text-align: right;
  }
  .tbl td::before {
    content: attr(data-l);
    flex: none;
    text-align: left;
    color: var(--sub);
    font-size: 14px;
  }
  .tbl td:first-child {
    font-weight: 600;
    border-bottom: 1px dashed var(--line);
    padding-bottom: 8px;
    margin-bottom: 4px;
  }
  .tbl td:first-child::before { display: none; }
  .tbl td:first-child {
    display: block;
    text-align: left;
  }

  /* 交付物卡片：手机上撑满 */
  .dlv, .card, .panel {
    margin-bottom: 10px;
    padding: 12px;
  }

  /* 状态色块要点得着 */
  .pill, .tag, .badge {
    font-size: 13px;
    padding: 3px 9px;
  }
}

/* ============ 手机：按钮加大 ============ */
@media (max-width: 860px) {
  button, .btn {
    min-height: 44px;
    padding: 11px 18px;
    font-size: 16px;
    border-radius: 8px;
  }

  /* 次要按钮在手机上不占一整行时也要能点 */
  .tbl button, .dlv button, .row button {
    min-height: 40px;
    padding: 9px 14px;
    font-size: 15px;
  }

  input, textarea, select {
    font-size: 16px;          /* 16px 以下 iOS 会自动放大页面，禁掉 */
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 8px;
  }
  textarea { min-height: 88px; line-height: 1.6; }

  /* 表单一列，标签在上 */
  .field { margin-bottom: 14px; }
  .field label {
    display: block;
    margin-bottom: 6px;
    font-size: 15px;
    color: var(--sub);
  }
}

/* ============ 手机：弹窗全屏化 ============ */
@media (max-width: 860px) {
  dialog {
    width: 100vw !important;
    max-width: 100vw !important;
    height: auto;
    max-height: 92vh;
    margin: auto;
    border-radius: 14px 14px 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
  }
  dialog::backdrop { background: rgba(29, 33, 41, .5); }
  .dlg-body { padding: 14px 14px 20px; }
  .dlg-foot {
    position: sticky;
    bottom: 0;
    background: var(--paper);
    padding: 12px 14px;
    border-top: 1px solid var(--line);
  }
  .dlg-foot button { flex: 1; }
}

/* ============ 手机：底部固定操作条 ============ */
@media (max-width: 860px) {
  .mob-bar {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 40;
    background: var(--paper);
    border-top: 1px solid var(--line);
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    gap: 8px;
    box-shadow: 0 -2px 12px rgba(29, 33, 41, .08);
  }
  .mob-bar button { flex: 1; }
  .mob-bar button.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
}

/* 桌面端不显示手机专属元素 */
.mob-bar { display: none; }
.mob-only { display: none; }

@media (max-width: 860px) {
  .mob-only { display: block; }
  .mob-bar { display: flex; }
  /* 桌面端隐藏的元素在手机上显示 */
  .desk-only { display: none !important; }
}

/* ============ 平板 ============ */
@media (min-width: 861px) and (max-width: 1180px) {
  html, body { font-size: 16px; }
  aside.lines { width: 168px; }
}

/* ============ 登录页 ============ */
.login-page {
  position: fixed;
  inset: 0;
  background: linear-gradient(160deg, #1f4e5f 0%, #17414f 55%, #0f2f3a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.login-card {
  background: var(--paper);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
  width: 100%;
  max-width: 380px;
  padding: 30px 26px 24px;
}
.login-logo {
  display: block;
  width: 76px; height: 76px;
  margin: 0 auto 14px;
  border-radius: 18px;
  box-shadow: 0 6px 20px rgba(23, 118, 245, .3);
}
.login-title {
  text-align: center;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 3px;
  margin: 0 0 4px;
}
.login-sub {
  text-align: center;
  color: var(--sub);
  font-size: 13px;
  margin: 0 0 22px;
}
.login-card .field { margin-bottom: 14px; }
.login-card .field label {
  display: block;
  font-size: 14px;
  color: var(--sub);
  margin-bottom: 5px;
}
.login-card input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-size: 16px;
}
.login-card input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.login-err {
  color: var(--danger);
  font-size: 14px;
  min-height: 20px;
  margin: 4px 0 10px;
}
.login-btn {
  width: 100%;
  padding: 13px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
}
.login-btn:disabled { opacity: .6; }
.login-foot {
  margin-top: 16px;
  text-align: center;
  font-size: 12px;
  color: var(--faint);
}
