/* ============================================================
   三道报账 v1.5.0 - 弹窗样式（统一升级版 2026-08-02）
   统一外观 + 滚动 + 拖拽 + 缩放支持
   ============================================================ */
/* ===== 遮罩层 ===== */
.hx-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: hx-fade-in 0.15s ease;
  backdrop-filter: blur(2px);
}

@keyframes hx-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ===== 通用弹窗 ===== */
.hx-modal {
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  animation: hx-modal-in 0.2s ease;
  max-height: 88vh;
  min-width: 320px;
  width: 860px;          /* v2.0.4 统一默认宽度（王总要求弹窗大小一致） */
  max-width: 96vw;
  border: 1px solid rgba(255,255,255,0.2);
  position: relative;
  overflow: hidden;
}

@keyframes hx-modal-in {
  /* 🛠️ 2026-08-26 王总：弹窗内表头 sticky 不固定——动画 transform 残留会让 position:sticky 失效，只保留淡入 */
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ===== 标题栏（渐变深蓝 + 白字 + 拖拽区）===== */
.hx-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: linear-gradient(135deg, #0F3460, #1A5276);
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: move;
  user-select: none;
  flex-shrink: 0;
  border-bottom: 2px solid rgba(255,255,255,0.12);
}

/* 标题栏窗口控制按钮组 */
.hx-modal-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.hx-modal-ctrl {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: rgba(255,255,255,0.12);
  cursor: pointer;
  font-size: 13px;
  color: #fff;
  border-radius: 6px;
  transition: all 0.15s;
  line-height: 1;
}
.hx-modal-ctrl:hover { background: rgba(255,255,255,0.28); }

.hx-modal-close {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: rgba(255,255,255,0.12);
  cursor: pointer;
  font-size: 14px;
  color: #fff;
  border-radius: 6px;
  transition: all 0.15s;
}
.hx-modal-close:hover { background: #E74C3C; color: #fff; }

/* ===== 主体（统一上下滚动）===== */
.hx-modal-body {
  padding: 16px 18px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;
  background: #FAFBFD;
  scrollbar-width: thin;
  scrollbar-color: #B0BEC5 #E8ECF1;
}
.hx-modal-body::-webkit-scrollbar { width: 8px; }
.hx-modal-body::-webkit-scrollbar-track { background: #E8ECF1; border-radius: 4px; }
.hx-modal-body::-webkit-scrollbar-thumb { background: #B0BEC5; border-radius: 4px; }
.hx-modal-body::-webkit-scrollbar-thumb:hover { background: #90A4AE; }

/* ===== 底部操作栏 ===== */
.hx-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid #E8ECF1;
  background: #ffffff;
  flex-shrink: 0;
}

/* ===== 缩放手柄（右下角）===== */
.hx-modal-resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 18px;
  height: 18px;
  cursor: nwse-resize;
  z-index: 10;
  background: linear-gradient(135deg, transparent 50%, #90A4AE 50%, #90A4AE 60%, transparent 60%);
  border-bottom-right-radius: 12px;
  opacity: 0.55;
}
.hx-modal-resize-handle:hover { opacity: 1; background: linear-gradient(135deg, transparent 50%, #0F3460 50%, #0F3460 60%, transparent 60%); }

/* ===== 全屏态（🛠️ 2026-08-23 王总：全屏必须真全屏——原来写死 96vw/92vh 且 !important 顶掉 JS 的 100vw/100vh，全屏后底面留白、内容区狭小；改 fixed 铺满全屏）===== */
.hx-modal.is-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  margin: 0 !important;
  border-radius: 0 !important;
  transform: none !important;
  z-index: 100001 !important;
  display: flex;
  flex-direction: column;
}
/* 全屏时内容区撑满（覆盖内联 max-height:78vh/70vh 等限制） */
.hx-modal.is-fullscreen .hx-modal-body {
  max-height: none !important;
  height: auto !important;
  flex: 1 1 auto !important;
  overflow-y: auto;
}
/* 🛠️ 2026-08-23 王总：驾驶舱 detailPopup 内容区写死 max-height:45vh，全屏后弹窗铺满但内容区只有45vh导致底部大片空白——全屏时解除限制+flex撑满，还原时自动恢复 */
.hx-modal.is-fullscreen .dp-body,
#detailPopup.is-fullscreen .dp-body,
#payableDetailPopup.is-fullscreen .dp-body,
#projDetailPopup.is-fullscreen .dp-body,
#projOutPopup.is-fullscreen .dp-body {
  max-height: none !important;
  height: auto !important;
  flex: 1 1 auto !important;
  overflow-y: auto;
}
.dp-body {
  flex: 0 1 auto;
}

/* ===== 危险确认弹窗 ===== */
.hx-modal-danger {
  width: 460px;
  min-height: 220px;
}
.hx-modal-danger .hx-modal-header {
  background: linear-gradient(135deg, #C0392B, #E74C3C);
  color: #fff;
  border-radius: 14px 14px 0 0;
}
.hx-modal-icon { font-size: 20px; margin-right: 8px; }

/* ===== 各类弹窗尺寸（v2.0.4 统一 860px，大小一致；danger 确认框保持窄）===== */
.hx-modal-customer,
.hx-modal-prepayment,
.hx-modal-payable,
.hx-modal-driver,
.hx-modal-detail { width: 860px; max-width: 96vw; }

/* ===== 弹窗内表单 ===== */
.hx-modal .hx-form-group { margin-bottom: 10px; }
.hx-modal .hx-form-row { grid-template-columns: 1fr 1fr; gap: 10px; }
/* ============================================================
 * 弹窗内部通用美化（第二步 2026-08-02）
 * 纯CSS兜底：统一弹窗内裸元素样式，不侵入JS逻辑
 * ============================================================ */

/* 弹窗内所有 input/select/textarea（包括没写类名的裸元素）统一美化 */
.hx-modal-body input[type="text"],
.hx-modal-body input[type="number"],
.hx-modal-body input[type="date"],
.hx-modal-body input[type="time"],
.hx-modal-body input[type="password"],
.hx-modal-body select,
.hx-modal-body textarea {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid #D5D8DC;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: #ffffff;
  color: #2C3E50;
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.hx-modal-body textarea { height: auto; min-height: 60px; padding: 8px 10px; resize: vertical; }
.hx-modal-body input:focus,
.hx-modal-body select:focus,
.hx-modal-body textarea:focus {
  outline: none;
  border-color: #0F3460;
  box-shadow: 0 0 0 2px rgba(15, 52, 96, 0.12);
}

/* 弹窗内 label 统一 */
.hx-modal-body label {
  font-size: 12px;
  font-weight: 600;
  color: #455A64;
  display: inline-block;
  margin-bottom: 4px;
}

/* 弹窗内表格统一（明细/列表类）——只作用于裸表格，不覆盖 .hx-table */
.hx-modal-body table:not(.hx-table) {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
}
.hx-modal-body table:not(.hx-table) thead th {
  background: #F0F4F8;
  color: #546E7A;
  font-weight: 600;
  padding: 8px 6px;
  border-bottom: 1px solid #DDE4EA;
  text-align: center;
  white-space: nowrap;
}
.hx-modal-body table:not(.hx-table) tbody td {
  padding: 6px;
  border-bottom: 1px solid #F0F0F0;
  color: #37474F;
}
.hx-modal-body table:not(.hx-table) tbody tr:hover { background: #F8FAFC; }

/* 弹窗内 KPI 小卡片统一 */
.hx-modal-body [class*="hx-stat-card"],
.hx-modal-body .hx-kpi-box {
  border-radius: 10px;
  border: 1px solid #E3EAF0;
}

/* 弹窗底部按钮统一间距 */
.hx-modal-footer .hx-btn,
.hx-modal-body .hx-btn {
  border-radius: 6px;
  font-size: 13px;
  padding: 7px 16px;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}
.hx-modal-footer .hx-btn-primary { background: #0F3460; color: #fff; }
.hx-modal-footer .hx-btn-primary:hover { background: #1A5276; }
.hx-modal-footer .hx-btn-secondary { background: #E8ECF1; color: #333; }
.hx-modal-footer .hx-btn-secondary:hover { background: #D5D8DC; }
.hx-modal-footer .hx-btn-danger { background: #E74C3C; color: #fff; }
.hx-modal-footer .hx-btn-danger:hover { background: #C0392B; }
.hx-modal-footer .hx-btn-success { background: #27AE60; color: #fff; }
.hx-modal-footer .hx-btn-success:hover { background: #229954; }

/* 弹窗内两列表单统一间距 */
.hx-modal-body .hx-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* 弹窗内分隔线统一 */
.hx-modal-body hr {
  border: none;
  border-top: 1px solid #E8ECF1;
  margin: 14px 0;
}

/* 弹窗内说明文字统一 */
.hx-modal-body .hx-muted,
.hx-modal-body [style*="color:#888"],
.hx-modal-body [style*="color:#999"] {
  color: #78909C !important;
  font-size: 12px;
}
