/* ══════════════════════════════════════
   全局样式 — 商务沉稳风格（低饱和、柔和阴影）
   ══════════════════════════════════════ */

:root {
  --primary-color: #4DB6AC;
  --primary-hover: #3D9E94;
  --primary-light: #E0F2F1;
  --secondary-color: #616161;
  --success-color: #2E7D32;
  --warning-color: #E65100;
  --danger-color: #C62828;
  --text-primary: #212121;
  --text-secondary: #616161;
  --text-tertiary: #9E9E9E;
  --bg-page: #FAFAFA;
  --bg-card: #ffffff;
  --border-color: #E0E0E0;
  --border-light: #EEEEEE;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.08);
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC',
    'Microsoft YaHei', sans-serif;
  overflow: hidden;
  color: var(--text-primary);
  background: var(--bg-page);
}

#root {
  height: 100vh;
  overflow: hidden;
}

/* ── Ant Design Layout ── */
.ant-layout {
  height: 100%;
}

/* ── Focus 样式 ── */
*:focus-visible {
  outline: 2px solid rgba(77, 182, 172, 0.4);
  outline-offset: 2px;
  border-radius: 2px;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid rgba(77, 182, 172, 0.4);
  outline-offset: 2px;
}

/* ── 侧边栏菜单 ── */
.ant-menu-item {
  border-radius: var(--radius-md) !important;
  margin: 2px 8px !important;
  transition: background-color 0.15s ease, color 0.15s ease !important;
}

.ant-menu-item:hover {
  background-color: var(--primary-light) !important;
  color: var(--primary-color) !important;
}

.ant-menu-item-selected {
  background-color: var(--primary-light) !important;
  color: var(--primary-color) !important;
  font-weight: 600;
  position: relative;
}

.ant-menu-item-selected::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--primary-color);
  border-radius: 0 3px 3px 0;
}

/* ── 侧边栏折叠过渡 ── */
.ant-layout-sider {
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* ── 内容区域 ── */
.ant-layout-content {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.ant-layout-content > div {
  flex: 1;
  min-height: 0;
}

/* ── 全局按钮过渡（轻微，不做位移/缩放） ── */
.ant-btn {
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease !important;
}

/* ── 卡片全局样式（柔和阴影，无位移） ── */
.ant-card {
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease !important;
}

.ant-card:hover {
  box-shadow: var(--shadow-md);
}

/* ── 表格样式 ── */
.ant-table-thead > tr > th {
  background: #FAFAFA !important;
  font-weight: 600 !important;
  color: var(--text-secondary) !important;
  font-size: 13px !important;
}

.ant-table-tbody > tr > td {
  transition: background 0.15s ease !important;
}

/* ── 输入框 ── */
.ant-input,
.ant-input-affix-wrapper,
.ant-select-selector {
  transition: all 0.2s ease !important;
}

/* ── 滚动条 ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a0aec0;
}

/* ══════════════════════════════════════
   待办事项横向卡片
   ══════════════════════════════════════ */
.todo-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 8px;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.todo-card:hover {
  border-color: var(--border-color);
  box-shadow: var(--shadow-sm);
}

/* 逾期 */
.todo-card-overdue {
  background: #fbf5f5;
  border-color: #ecd4d4;
  box-shadow: inset 3px 0 0 0 var(--danger-color);
}

/* 即将到期 */
.todo-card-approaching {
  background: #fdf9f3;
  border-color: #f0e0c8;
  box-shadow: inset 3px 0 0 0 var(--warning-color);
}

.todo-card-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.todo-card-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

/* 项目详情事项表格：逾期行 */
.task-row-overdue > td {
  background: #fbf5f5 !important;
}

/* ══════════════════════════════════════
   移动端响应式（< 768px）
   ══════════════════════════════════════ */
@media (max-width: 768px) {
  .ant-layout-sider {
    display: none;
  }

  .ant-modal {
    max-width: 100vw !important;
    margin: 0 !important;
    padding: 0 !important;
    top: 0 !important;
    height: 100vh;
  }
  /* 手机端弹窗：内容区自己滚，底部按钮常驻可见（否则字段一多，保存按钮被挤到屏幕外） */
  .ant-modal-content {
    border-radius: 0 !important;
    height: 100vh;
    display: flex;
    flex-direction: column;
  }
  .ant-modal-body {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .ant-modal-header,
  .ant-modal-footer {
    flex: 0 0 auto;
  }

  .ant-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .ant-card {
    margin-bottom: 8px;
  }

  .ant-input-affix-wrapper {
    max-width: 140px !important;
  }

  .ant-layout-header {
    padding: 0 12px !important;
    gap: 8px !important;
  }

  .ant-layout-content {
    padding: 12px !important;
  }

  .ant-drawer-body .ant-menu {
    width: 100%;
  }

  .overview-stat-block {
    flex: 1 1 100% !important;
    min-width: unset !important;
  }

  /* ══════════════════════════════════════════════════════════
     V3.5.0 移动端精修（2026-10-21）
     只在 ≤768px 生效，桌面端布局一点不动
     ══════════════════════════════════════════════════════════ */

  /* 底部安全区：iPhone 刘海屏/全面屏，避免底部 Tab 栏被 Home 指示条压住 */
  .ant-layout-content.mobile-safe-area {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* 触控尺寸：所有图标按钮 ≥ 44×44（Apple HIG 最小点击区） */
  .touch-target,
  .todo-card-actions .ant-btn,
  .project-card .ant-btn,
  .mobile-tabbar .ant-btn {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* 页面级主要按钮（非 small）也抬到 44，避免手指点不中 */
  .ant-layout-content .ant-btn:not(.ant-btn-sm),
  .ant-modal .ant-btn {
    min-height: 44px;
  }

  /* 待办卡片：手机上按钮换行到下一行，避免挤压标题 */
  .todo-card {
    flex-wrap: wrap;
  }
  .todo-card-actions {
    gap: 2px;
    width: 100%;
    justify-content: flex-end;
    margin-top: 4px;
    border-top: 1px dashed #edf2f7;
    padding-top: 4px;
  }

  /* 项目卡片：手机端单列（一屏一张） */
  .project-card-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
  .project-card .ant-card-body {
    padding: 14px !important;
  }

  /* 详情页分段控件占满宽 */
  .mobile-segmented {
    background: #fff;
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 12px;
    border: 1px solid #e2e8f0;
  }
  .mobile-segmented .ant-segmented {
    width: 100%;
  }
  .mobile-segmented .ant-segmented-item {
    flex: 1;
    text-align: center;
  }

  /* 顶部工具条：手机上允许换行、控件占满宽 */
  .mobile-toolbar > * {
    flex: 1 1 100% !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  /* 新建/编辑弹窗：底部按钮贴安全区 */
  .ant-modal-footer {
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)) !important;
    position: sticky;
    bottom: 0;
    background: #fff;
    z-index: 2;
  }

  /* 详情页头部按钮组换行 */
  .mobile-header-actions {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
  }

  /* 折叠次要字段的区块 */
  .form-collapse-secondary .ant-collapse-header {
    padding: 10px 12px !important;
    font-size: 13px;
    color: #4a5568 !important;
  }
}


/* 中等屏幕（平板） */
@media (max-width: 992px) and (min-width: 769px) {
  .ant-layout-content {
    padding: 16px !important;
  }
}
/* Page transition animations */
@keyframes pageFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-transition {
  animation: pageFadeIn 0.3s ease-in-out;
  min-height: 100%;
}

/* Skeleton loading pulse */
@keyframes skeletonPulse {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

.skeleton-loading {
  animation: skeletonPulse 1.5s ease-in-out infinite;
}
