/* ==========================================================================
   V21.45 网页端适老化样式层（Readability & Touch-target 优化）
   --------------------------------------------------------------------------
   目标：中老年用户也能看清、点准。只调整「视觉」——字号、行高、对比度、
        按钮/输入框尺寸、间距、换行与横向滚动。
   约束：不改 DOM 结构、不改事件绑定、不改业务流程；不涉及小程序与后端。
   加载顺序：在 bolian-v15-account-timeline.css 与 v17-route.css 之后引入，
            以便在不修改原文件的前提下统一收口（同特异性后者生效）。
   ========================================================================== */

:root {
  /* —— 字号层级（正文 16 / 表格 15 / 说明 14 起）—— */
  --by-fs-body: 16px;
  --by-fs-body-lg: 17px;
  --by-fs-table: 15px;
  --by-fs-label: 15px;
  --by-fs-note: 14px;
  --by-fs-page-title: 26px;
  --by-fs-card-title: 20px;
  --by-fs-hint: 14px;

  /* —— 可点击区域尺寸 —— */
  --by-h-btn: 44px;
  --by-h-btn-primary: 48px;
  --by-h-input: 44px;
  --by-radius: 10px;
  --by-radius-lg: 14px;
  --by-gap: 12px;

  /* —— 颜色：保留原品牌色系，仅提升文字对比度 —— */
  --by-ink: #16232f;
  --by-ink-soft: #3d4f5c;
  --by-muted: #5c6c78;
  --by-line: #dbe3e9;
  --by-brand: #0b7a4b;
  --by-brand-navy: #14283b;
  --by-accent: #c2610a;
  --by-focus: #1d5fd0;
  --by-topbar-h: 76px;
}

/* ————————————————— 1. 基础排版 ————————————————— */
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", Arial, sans-serif;
  font-size: var(--by-fs-body);
  line-height: 1.65;
  color: var(--by-ink);
  -webkit-text-size-adjust: 100%;
}

p, li, label, span, small {
  line-height: 1.6;
}

/* 长标题、长部件名、批次号：允许换行，避免溢出或遮挡。
   注意：不给 td/th 强制断词，否则「托盘表编号」「涂装代码」这类编号会被拆成两行。 */
b, strong, .block-title, .panel-title h2, .page-head h1,
.tb-center h1, .stat-link, .batch-map-pop {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* 部件明细列多（11 列），给定最小宽度后由 .table-wrap 横向滚动，避免列被压扁换行 */
.batch-detail-page .table-wrap table {
  min-width: 1240px;
}

/* 关键列给足宽度：部件名 / 托盘表编号 / 涂装代码 / 流程状态 / 图纸 / 绘图 */
.batch-detail-page .table-wrap table th:nth-child(2),
.batch-detail-page .table-wrap table td:nth-child(2) { min-width: 120px; }
.batch-detail-page .table-wrap table th:nth-child(4),
.batch-detail-page .table-wrap table td:nth-child(4) { min-width: 68px; }
.batch-detail-page .table-wrap table th:nth-child(7),
.batch-detail-page .table-wrap table td:nth-child(7) { min-width: 112px; }
.batch-detail-page .table-wrap table th:nth-child(9),
.batch-detail-page .table-wrap table td:nth-child(9) { min-width: 150px; }
.batch-detail-page .table-wrap table th:nth-child(10),
.batch-detail-page .table-wrap table td:nth-child(10) { min-width: 108px; }
.batch-detail-page .table-wrap table th:nth-child(11),
.batch-detail-page .table-wrap table td:nth-child(11) { min-width: 126px; }

/* ————————————————— 2. 顶栏 / 侧栏导航 ————————————————— */
.web-topbar {
  min-height: var(--by-topbar-h);
  height: auto;
  padding: 12px 24px;
  gap: 16px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  font-size: 18px;
  border-radius: var(--by-radius);
}

.tb-center h1 {
  font-size: var(--by-fs-page-title);
  letter-spacing: 2px;
}

.tb-center small {
  font-size: var(--by-fs-note);
  color: #c3d2e0;
  letter-spacing: .5px;
  margin-top: 4px;
}

.tb-user {
  gap: 10px;
}

.tb-user i {
  min-width: 38px;
  height: 38px;
  font-size: 16px;
}

.tb-user b {
  font-size: var(--by-fs-body);
}

.tb-user small {
  font-size: var(--by-fs-note);
  color: #c3d2e0;
}

.logout-btn {
  min-height: 42px;
  padding: 0 18px;
  font-size: var(--by-fs-body);
  border-radius: var(--by-radius);
}

.admin-layout {
  grid-template-columns: 238px 1fr;
  min-height: calc(100vh - var(--by-topbar-h));
}

aside {
  padding: 18px 14px;
}

nav button {
  height: 50px;
  margin: 4px 0;
  padding: 0 16px;
  font-size: var(--by-fs-body);
  border-radius: var(--by-radius);
  font-weight: 600;
  color: var(--by-ink-soft);
}

nav button span {
  width: 30px;
  font-size: 20px;
}

nav button.active {
  font-weight: 700;
}

nav button em {
  font-size: 13px;
  padding: 3px 9px;
}

.admin-layout aside nav .nav-sub {
  gap: 4px;
}

.admin-layout aside nav .nav-sub-item {
  min-height: 42px;
  font-size: var(--by-fs-label);
  padding: 10px 12px 10px 44px;
  border-radius: var(--by-radius);
  color: var(--by-ink-soft);
}

/* ————————————————— 3. 页面标题与工作区 ————————————————— */
.workspace {
  padding: 26px 30px 56px;
}

.page-head {
  margin-bottom: 22px;
  gap: 16px;
}

.page-head p {
  font-size: var(--by-fs-note);
  color: var(--by-muted);
}

.page-head h1 {
  font-size: var(--by-fs-page-title);
  line-height: 1.25;
}

/* ————————————————— 4. 卡片 / 面板 / 详情区块 ————————————————— */
.panel {
  border-radius: var(--by-radius-lg);
}

.panel-title {
  min-height: 74px;
  padding: 16px 20px;
  gap: 14px;
  flex-wrap: wrap;
}

.panel-title h2 {
  font-size: var(--by-fs-card-title);
  line-height: 1.3;
}

.panel-title span {
  font-size: var(--by-fs-note);
  color: var(--by-muted);
}

.detail-block {
  padding: 20px;
  margin-bottom: 20px;
  border-radius: var(--by-radius-lg);
}

.block-title {
  margin-bottom: 14px;
  gap: 10px;
}

.block-title b {
  font-size: var(--by-fs-body-lg);
}

.block-title span {
  font-size: var(--by-fs-note);
  color: var(--by-muted);
}

/* 工作台统计卡片 */
.stats {
  gap: 16px;
  margin-bottom: 22px;
}

.stats article {
  padding: 20px;
  gap: 15px;
  border-radius: var(--by-radius-lg);
}

.stats small {
  font-size: 15px;
  color: var(--by-muted);
}

.stats strong {
  font-size: 32px;
  line-height: 1.2;
}

.stats p {
  font-size: 13.5px;
  color: var(--by-muted);
  margin-top: 3px;
}

.stat-icon {
  width: 50px;
  height: 50px;
  font-size: 20px;
  border-radius: var(--by-radius);
}

/* ————————————————— 5. 表格 ————————————————— */
table {
  font-size: var(--by-fs-table);
}

th {
  padding: 14px 12px;
  font-size: 14.5px;
  font-weight: 700;
  color: #44555f;
  background: #f5f8f7;
  white-space: nowrap;
}

td {
  padding: 15px 12px;
  line-height: 1.55;
}

td small {
  margin-top: 4px;
  font-size: 13.5px;
  color: #5f6f7c;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.batches .table-wrap table {
  min-width: 1000px;
}

/* 批次信息表（键值表） */
.kv-table td {
  padding: 11px 12px;
  font-size: 15px;
}

.kv-table td:first-child {
  width: 150px;
  font-size: 15px;
  color: var(--by-muted);
}

/* 空状态与提示 */
.empty {
  font-size: var(--by-fs-table) !important;
  color: var(--by-muted) !important;
  padding: 54px 24px !important;
  line-height: 1.7;
}

.stage-empty,
.drawing-missing {
  font-size: var(--by-fs-note);
  color: var(--by-muted);
}

/* ————————————————— 6. 按钮与可点击元素 ————————————————— */
button {
  font-size: var(--by-fs-body);
  border-radius: var(--by-radius);
}

.primary,
.mini-primary {
  min-height: var(--by-h-btn-primary);
  padding: 0 24px;
  font-size: 17px;
  font-weight: 700;
  border-radius: var(--by-radius);
  background: var(--by-accent);
  color: #fff;
}

.primary:hover,
.mini-primary:hover {
  background: #a95208;
}

.primary:focus-visible,
.mini-primary:focus-visible,
.outline:focus-visible,
button:focus-visible {
  outline: 3px solid rgba(29, 95, 208, .45);
  outline-offset: 2px;
}

.primary:disabled,
.mini-primary:disabled {
  background: #b9c3ca;
  color: #fff;
  cursor: not-allowed;
  opacity: 1;
}

.outline {
  min-height: var(--by-h-btn);
  padding: 12px 18px;
  font-size: var(--by-fs-body);
  border-radius: var(--by-radius);
  color: #33454f;
  border-color: #c3cfd6;
}

.outline:hover {
  background: #f3f8f6;
  border-color: #8fc8a9;
}

.link-btn {
  min-height: 40px;
  padding: 6px 12px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 8px;
}

.link-btn:hover {
  background: #eef8f2;
}

.muted-link {
  color: var(--by-muted);
}

.modal-actions button {
  min-height: var(--by-h-btn);
  padding: 0 22px;
  font-size: var(--by-fs-body);
  border-radius: var(--by-radius);
}

.modal-actions .primary {
  background: var(--by-accent);
  border-color: var(--by-accent);
}

/* 批次工具条按钮 */
.sort-switch {
  border-radius: var(--by-radius);
}

.sort-switch button {
  min-height: 42px;
  padding: 8px 18px;
  font-size: 15px;
  color: var(--by-ink-soft);
}

.batch-export,
.batch-pick-toggle {
  min-height: 42px;
  padding: 10px 14px;
  font-size: 15px;
  font-weight: 700;
  border-radius: var(--by-radius);
}

.batch-tools {
  gap: 10px;
}

/* 状态标签：更清晰的文字与更宽的点击/阅读面积 */
.status {
  font-size: 14px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 14px;
  line-height: 1.4;
  color: #46555f;
}

.status.待处理 { color: #46555f; background: #e6ebee; }
.status.加工中,
.status.生产中 { color: #8f4f0c; background: #fdeed9; }
.status.运输中 { color: #0f6a60; background: #dff0ed; }
.status.已完成 { color: #1f6b47; background: #e2f2e8; }

/* ————————————————— 7. 表单控件 ————————————————— */
input,
select,
textarea {
  font-size: var(--by-fs-body);
  color: var(--by-ink);
}

input::placeholder,
textarea::placeholder {
  color: #7b8a95;
  opacity: 1;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #7fb3f5;
  box-shadow: 0 0 0 3px rgba(45, 108, 255, .18);
}

.modal input,
.modal select {
  height: 46px;
  font-size: var(--by-fs-body);
  border-radius: 9px;
}

.modal textarea {
  font-size: var(--by-fs-body);
  border-radius: 9px;
  line-height: 1.6;
}

.modal label {
  gap: 8px;
  margin-bottom: 16px;
  font-size: var(--by-fs-label);
  font-weight: 700;
  color: var(--by-ink-soft);
}

/* 搜索框（列表页 / 明细页） */
.search {
  height: var(--by-h-input);
  width: 290px;
  border-radius: var(--by-radius);
  color: #64727d;
}

.search input {
  font-size: 15px;
  padding-left: 10px;
}

.big-search {
  height: 54px;
  border-radius: var(--by-radius);
}

.big-search input {
  font-size: var(--by-fs-body);
}

/* 列表页搜索条（结构在 JS 的 listSearchBox 中） */
.by-list-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: #fff;
  border-bottom: 1px solid #e5eaed;
  flex-wrap: wrap;
}

.by-list-search > .by-search-icon {
  color: #64727d;
  font-size: 17px;
  line-height: 1;
}

.by-list-search > input[type="search"] {
  flex: 1 1 260px;
  max-width: 460px;
  min-width: 0;
  height: var(--by-h-input);
  border: 1px solid #c3cfd6;
  border-radius: var(--by-radius);
  padding: 0 14px;
  font-size: var(--by-fs-body);
  outline: none;
  background: #fff;
}

.by-list-search > .by-search-clear {
  flex: none;
  min-height: 42px;
  padding: 0 16px;
  font-size: var(--by-fs-body);
  border: 1px solid #c3cfd6;
  border-radius: var(--by-radius);
  background: #fff;
  color: var(--by-ink-soft);
  cursor: pointer;
}

.by-list-search > .by-search-clear:hover {
  background: #f2f6f8;
}

.by-list-search > .by-search-spacer {
  flex: 1;
}

/* ————————————————— 8. 批次详情 / 流程 ————————————————— */
.detail-head {
  gap: 14px 18px;
}

.detail-title h2 {
  line-height: 1.25;
}

.detail-title small {
  font-size: var(--by-fs-note);
  color: var(--by-muted);
}

.detail-actions-grid > .outline {
  font-size: var(--by-fs-body);
  min-height: 44px;
}

/* 流程时间线：节点更大、文字更清楚 */
.timeline {
  padding: 0 16px 6px;
}

.timeline > div {
  min-height: 62px;
  gap: 13px;
}

.timeline > div:not(:last-child):before {
  top: 30px;
  left: 15px;
  height: 30px;
}

.timeline i {
  width: 30px;
  height: 30px;
  font-size: 13px;
  font-weight: 700;
}

.timeline b {
  font-size: 15px;
  line-height: 1.45;
}

.timeline small {
  font-size: 13.5px;
  color: var(--by-muted);
  margin-top: 2px;
}

.flow-node {
  padding: 6px 8px;
  border-radius: var(--by-radius);
}

.flow-node.node-selected {
  background: #ddf3ec;
  box-shadow: inset 0 0 0 3px #6fc7b2;
}

/* ————————————————— 9. 弹窗 ————————————————— */
.modal {
  padding: 26px;
  border-radius: 16px;
}

.modal-head h2 {
  font-size: 24px;
  line-height: 1.3;
}

.modal-head small {
  font-size: var(--by-fs-note);
  color: #0d7568;
  line-height: 1.6;
}

.modal-head > button {
  width: 42px;
  height: 42px;
  min-width: 42px;
  font-size: 22px;
  line-height: 1;
}

.modal-actions {
  gap: 12px;
  padding-top: 18px;
  flex-wrap: wrap;
}

/* ————————————————— 10. 登录页 ————————————————— */
.login-card {
  width: 400px;
  padding: 40px 34px;
  border-radius: 18px;
}

.login-card h1 {
  font-size: 30px;
  letter-spacing: 1px;
}

.login-sub {
  font-size: 15px;
  color: var(--by-muted);
  line-height: 1.7;
  margin-bottom: 22px;
}

.login-card form {
  gap: 16px;
}

.login-card label {
  font-size: var(--by-fs-label);
  color: var(--by-ink-soft);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-card input {
  height: 48px;
  padding: 0 14px;
  font-size: 17px;
  border-radius: var(--by-radius);
  border-color: #c3cfd6;
}

.login-card button[type=submit] {
  height: 52px;
  font-size: 18px;
  font-weight: 800;
  border-radius: var(--by-radius);
  letter-spacing: 2px;
  background: #2d6cff;
}

.login-card button[type=submit]:hover {
  background: #1f5ae0;
}

.login-error {
  font-size: var(--by-fs-table);
  line-height: 1.7;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fdecea;
  color: #a8271a;
  border: 1px solid #f2c3bc;
}

/* ————————————————— 11. 批次定位地图 ————————————————— */
.batch-map-block .block-title b {
  font-size: var(--by-fs-body-lg);
}

.batch-map-block .block-title span {
  font-size: var(--by-fs-note);
  color: var(--by-muted);
}

.batch-map-empty {
  font-size: var(--by-fs-table);
  line-height: 1.75;
  color: #52626d;
}

.batch-map-nav {
  gap: 10px;
  margin-bottom: 14px;
}

.batch-map-nav-item {
  max-width: 260px;
  padding: 10px 14px;
  font-size: 14.5px;
  border-radius: var(--by-radius);
}

.batch-map-nav-item b {
  font-size: 15px;
}

.batch-map-nav-item small {
  font-size: 13px;
  color: var(--by-muted);
}

.batch-map-marker {
  min-width: 34px;
  height: 34px;
  font-size: 14px;
}

.batch-map-pop {
  min-width: 240px;
  max-width: 340px;
  padding: 14px 16px;
  font-size: 15px;
  line-height: 1.6;
}

.batch-map-pop-head {
  font-size: 16px;
}

.batch-map-pop-head span {
  font-size: 13.5px;
  color: var(--by-muted);
}

.batch-map-pop-line b {
  font-size: 15px;
}

.batch-map-pop-line em {
  font-size: 15px;
}

.batch-map-pop-row small {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--by-muted);
}

/* ————————————————— 12. 响应式：窄屏不挤压、不横向溢出 ————————————————— */
@media (max-width: 1200px) {
  .workspace { padding: 22px 22px 52px; }
  .batches .table-wrap table { min-width: 940px; }
}

@media (max-width: 900px) {
  :root { --by-fs-body: 15.5px; --by-fs-table: 14.5px; }
  /* 侧栏在窄屏隐藏时，网格必须回到单列（否则左侧 238px 空白会挤压内容） */
  .admin-layout { grid-template-columns: 1fr; }
  .workspace { padding: 18px 16px 48px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .panel-title { padding: 14px 16px; min-height: 64px; }
  .detail-block { padding: 16px; }
  .page-head.dashboard-head h1 { font-size: 40px; }
  .login-card { width: 100%; padding: 32px 24px; }
  .search { width: 100%; }
  .by-list-search > input[type="search"] { flex: 1 1 100%; max-width: none; }
}

/* 窄屏详情页：标题不再强制单行，键值表按比例分配，避免内容被压成竖排 */
@media (max-width: 760px) {
  .detail-title-center h2 { flex-wrap: wrap; gap: 4px 16px; }
  .detail-title-center .detail-ship-no,
  .detail-title-center .detail-batch-no {
    font-size: 20px;
    min-width: 0;
    white-space: normal;
    word-break: break-word;
  }
  .detail-title-center .detail-batch-no { flex-wrap: wrap; }
  .kv-table td { font-size: 15px; }
  .kv-table td:first-child { width: 34%; white-space: normal; }
  .kv-table td:last-child { word-break: break-word; }
}

@media (max-width: 640px) {
  .tb-center h1 { font-size: 20px; letter-spacing: 1px; }
  .tb-center small { display: none; }
  .web-topbar { padding: 10px 14px; gap: 10px; }
  .tb-user b { font-size: 15px; }
  .logout-btn { padding: 0 14px; font-size: 15px; }
  .stats { grid-template-columns: 1fr; }
  .modal { padding: 18px; }
  .modal-head h2 { font-size: 20px; }
  .modal-actions button { flex: 1 1 100%; }
  .detail-actions-grid { grid-template-columns: 1fr !important; justify-content: stretch !important; width: 100%; }
  .detail-actions-grid > * { grid-area: auto !important; width: 100% !important; margin: 0 0 10px !important; }
  .detail-actions-grid .detail-back { font-size: 20px; padding: 12px 16px; }
  .batch-map-nav-item { max-width: 100%; flex: 1 1 100%; }
}
/* ===== V21.47 部件明细：横向滚动时「序号」与「部件」两列固定在左侧 ===== */
.batch-detail-page .table-wrap table th:nth-child(1),
.batch-detail-page .table-wrap table td:nth-child(1) {
  position: sticky;
  left: 0;
  z-index: 3;
  width: 64px;
  min-width: 64px;
  max-width: 64px;
  background: #fff;
}

.batch-detail-page .table-wrap table th:nth-child(2),
.batch-detail-page .table-wrap table td:nth-child(2) {
  position: sticky;
  left: 64px;
  z-index: 3;
  background: #fff;
  box-shadow: 8px 0 8px -6px rgba(16, 40, 28, .18);
}

.batch-detail-page .table-wrap table th:nth-child(1),
.batch-detail-page .table-wrap table th:nth-child(2) {
  background: #f5f8f7;
}

.batch-detail-page .table-wrap tbody tr:hover td:nth-child(1),
.batch-detail-page .table-wrap tbody tr:hover td:nth-child(2) {
  background: #f4faf9;
}

@media (max-width: 640px) {
  .batch-detail-page .table-wrap table th:nth-child(1),
  .batch-detail-page .table-wrap table td:nth-child(1) {
    width: 52px;
    min-width: 52px;
    max-width: 52px;
  }
  .batch-detail-page .table-wrap table th:nth-child(2),
  .batch-detail-page .table-wrap table td:nth-child(2) {
    left: 52px;
  }
}