* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body,
#root {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
    'PingFang SC', 'Microsoft YaHei', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 细滚动条，贴合深色侧边栏与浅色主题 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-thumb {
  background: rgba(11, 37, 71, 0.22);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(11, 37, 71, 0.38);
}
::-webkit-scrollbar-track {
  background: transparent;
}

/* 侧边栏：AntD Sider 会把内容包在 .ant-layout-sider-children 里，
   必须让它撑满高度并做 flex 列，内部菜单区才能独立滚动（整页已锁 100vh 不滚） */
.ant-layout-sider-children {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* ============================================================
   全局控件统一（输入框 / 下拉 / 日期 / 数字框 / 按钮 / 浮窗）
   高度与圆角由 main.tsx 的 AntD 主题 token 统一控制（controlHeight 34、borderRadius 6），
   此处仅补充 token 无法覆盖的浮窗结构样式，保证全系统一致。
   ============================================================ */

/* 浮窗（Modal）统一：标题栏分隔线、标题字重、内容留白、底部操作区分隔线 */
.ant-modal-header {
  border-bottom: 1px solid #f0f0f0;
  padding: 16px 24px;
  margin-bottom: 0;
}
.ant-modal-title {
  font-weight: 600;
  font-size: 16px;
  color: rgba(0, 0, 0, 0.88);
}
.ant-modal-body {
  padding: 20px 24px;
}
.ant-modal-footer {
  border-top: 1px solid #f0f0f0;
  padding: 12px 24px;
}
/* 二次确认类弹窗（Modal.confirm / Modal.warning）的图标与文字间距统一 */
.ant-modal-confirm-body .ant-modal-confirm-title {
  font-weight: 600;
}

/* 输入框 / 下拉 / 日期 / 数字框：统一圆角与边框过渡，避免各页面样式不一致 */
.ant-input,
.ant-input-number,
.ant-select-selector,
.ant-picker,
.ant-input-affix-wrapper {
  border-radius: 6px !important;
}
.ant-input:hover,
.ant-input-number:hover .ant-input-number-handler-wrap,
.ant-select:not(.ant-select-disabled):not(.ant-select-customize-input):not(.ant-select-show-arrow):hover .ant-select-selector,
.ant-picker:hover {
  border-color: #4096ff;
}
.ant-input:focus,
.ant-input-focused,
.ant-input-number-focused,
.ant-select-focused .ant-select-selector,
.ant-picker-focused {
  border-color: #1677ff !important;
  box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.1) !important;
}

/* 按钮统一：圆角由 token 控制，这里去除个别组件遗留的投影与多余过渡 */
.ant-btn {
  border-radius: 6px;
}
.ant-btn-primary,
.ant-btn-default {
  box-shadow: none;
}

/* 图纸管理：紧凑单行上传拖拽条
   （覆盖 antd Dragger 默认大号拖拽区：48px 图标 + 上下大边距，垂直占用过高导致页面空旷失衡） */
.drawing-upload-bar.ant-upload-wrapper { display: block; margin-bottom: 12px; }
.drawing-upload-bar .ant-upload-drag { height: auto !important; }
/* antd 默认在 .ant-upload.ant-upload-btn 上有 16px padding，去掉后由 container 控制紧凑高度 */
.drawing-upload-bar .ant-upload-btn {
  display: block !important;
  height: auto !important;
  padding: 0 !important;
}
.drawing-upload-bar .ant-upload-drag-container {
  display: flex !important;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 10px 16px;
}
.drawing-upload-bar p.ant-upload-drag-icon {
  margin-bottom: 0 !important;
  line-height: 1;
}
.drawing-upload-bar p.ant-upload-drag-icon .anticon { font-size: 20px !important; }
.drawing-upload-bar p.ant-upload-text {
  margin: 0 !important;
  font-size: 13px !important;
}
.drawing-upload-bar p.ant-upload-hint {
  margin: 0 !important;
  font-size: 12px !important;
}

/* ============================================================
   列表协调基线（cozy-table）
   加在表格根节点上即可：长文本自动换行、不再用省略号截断，
   单元格顶部对齐（换行后多行内容不会互相挤压），表头保持单行居中。
   全系统列表统一加此 class，保证观感一致。
   ============================================================ */
.cozy-table .ant-table-cell {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  vertical-align: top;
}
.cozy-table .ant-table-thead > tr > th {
  white-space: nowrap;
  vertical-align: middle;
}

/* 详情面板（主从布局右栏）字数多时保持可读行高 */
.cozy-detail .ant-descriptions-item-content {
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* ============================================================
   移动端响应式（仅 ≤768px 生效，桌面 ≥992px 视图完全不变）
   原则：小屏把所有栅格堆叠为单列、弹窗占满屏宽、控件触控友好；
   桌面端（lg+）维持原有三列/多列布局与固定弹窗宽度。
   ============================================================ */
@media (max-width: 768px) {
  /* 所有栅格在手机上堆叠为单列（不影响桌面多列布局） */
  .ant-col {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    width: 100% !important;
  }

  /* 弹窗占满手机屏宽，避免溢出与错位 */
  .ant-modal {
    max-width: calc(100vw - 16px) !important;
    margin: 8px auto !important;
    top: 8px !important;
    padding-bottom: 8px !important;
  }
  .ant-modal-body { padding: 16px !important; }
  .ant-modal-header { padding: 12px 16px !important; }
  .ant-modal-footer { padding: 10px 16px !important; }

  /* 抽屉菜单容器去内边距（菜单本身已带） */
  .ant-drawer-body { padding: 0 !important; }

  /* 卡片内边距收敛 */
  .ant-card-body { padding: 14px !important; }

  /* 表单：标签与控件上下堆叠更清晰，间距收敛 */
  .ant-form-item { margin-bottom: 12px; }
  .ant-form-item-label { padding: 0 0 4px; line-height: 1.4; text-align: left; }
  .ant-form-item-label > label { height: auto; }

  /* 详情描述列表字号/内边距收敛，避免溢出 */
  .ant-descriptions-bordered .ant-descriptions-item-label,
  .ant-descriptions-bordered .ant-descriptions-item-content { padding: 8px 10px !important; }

  /* 统计数字在手机上不要过大 */
  .ant-statistic-content { font-size: 20px !important; }

  /* 表格容器允许横向滚动（已有 scroll x 的表） */
  .ant-table-wrapper { overflow-x: auto; }

  /* 顶部按钮组允许换行，避免顶栏溢出 */
  .ant-layout-header .ant-space { flex-wrap: wrap; row-gap: 8px; }
}
