/* ============================================
   Yasen OA — 移动端响应式样式
   适用于 Android / iOS (Capacitor) 及移动浏览器
   在 style.css 之后加载，覆盖桌面布局
   ============================================ */

/* ---- iOS 安全区域 CSS 变量 ---- */
:root {
  /* 与 style.css 保持一致（移动端后加载，显式重复避免主题覆盖时丢失） */
  --font-sans: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei UI', 'Microsoft YaHei', 'Heiti SC', sans-serif;
  --safe-area-top: env(safe-area-inset-top, 0px);
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --safe-area-left: env(safe-area-inset-left, 0px);
  --safe-area-right: env(safe-area-inset-right, 0px);
  --mobile-bottom-nav-height: 60px;
}

/* ============================================
   平板断点 (768px ~ 1024px)
   ============================================ */
@media (max-width: 1024px) {
  :root {
    --milestone-sidebar-width: 180px;
  }

  .project-nav-bar {
    padding: 6px 12px;
  }

  .view-panel {
    padding: 16px;
  }

  .workbench-region.workbench-project,
  .workbench-region.workbench-external {
    padding: 14px;
  }

  .workbench-personal-grid--project,
  .workbench-personal-grid--external {
    gap: 8px;
  }

  .stats-two-col {
    gap: 12px;
  }
}

/* ============================================
   手机断点 (< 768px) — 核心移动端样式
   ============================================ */
@media (max-width: 768px) {

  /* ---- 全局基础 ---- */
  html {
    font-size: 13px;
  }

  body {
    overflow: hidden;
    -webkit-overflow-scrolling: touch;
    -webkit-tap-highlight-color: transparent;
    padding-bottom: calc(var(--mobile-bottom-nav-height) + var(--safe-area-bottom));
  }

  /* ---- 顶部栏 ---- */
  #app-header {
    height: 48px;
    padding: 0 12px;
  }

  .logo-img {
    height: 24px;
    max-width: 100px;
  }

  .logo-divider {
    height: 18px;
  }

  .logo-subtitle {
    font-size: 0.72rem;
    letter-spacing: 1px;
  }

  .header-center {
    display: none;
  }

  .user-avatar {
    width: 30px;
    height: 30px;
    font-size: 0.78rem;
  }

  .user-switcher select {
    font-size: 0.8rem;
    padding: 4px 8px;
    max-width: 80px;
  }

  .user-role-badge {
    display: none;
  }

  .user-info-block {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  /* ---- 左侧图标导航栏 → 隐藏（由底部导航取代） ---- */
  .icon-sidebar {
    display: none !important;
  }

  /* ---- 里程碑侧栏 → 滑出式抽屉 ---- */
  .milestone-sidebar {
    position: fixed;
    left: 0;
    top: 48px;
    bottom: calc(var(--mobile-bottom-nav-height) + var(--safe-area-bottom));
    width: 280px !important;
    min-width: 280px !important;
    z-index: 900;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
    border-right: 1px solid rgba(30,58,95,0.12);
  }

  .milestone-sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.15);
  }

  .milestone-sidebar.collapsed {
    width: 280px !important;
    min-width: 280px !important;
    padding: 0;
    border-right: none;
  }

  .milestone-expand-btn {
    display: none !important;
  }

  .milestone-toggle-btn {
    display: none;
  }

  .milestone-sidebar-header {
    padding: 12px 14px 8px;
  }

  /* 里程碑抽屉遮罩层 */
  .mobile-drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    top: 48px;
    bottom: calc(var(--mobile-bottom-nav-height) + var(--safe-area-bottom));
    background: rgba(0,0,0,0.4);
    z-index: 899;
    backdrop-filter: blur(2px);
  }

  .mobile-drawer-overlay.active {
    display: block;
  }

  /* ---- 主内容区 ---- */
  #app-main {
    height: calc(100vh - 48px - var(--mobile-bottom-nav-height) - var(--safe-area-bottom));
    flex-direction: column;
  }

  .main-content {
    width: 100%;
    flex: 1;
    min-height: 0;
  }

  /* ---- 横向项目导航栏 ---- */
  .project-nav-bar {
    padding: 4px 10px;
    min-height: 38px;
    gap: 6px;
  }

  .project-nav-item {
    padding: 4px 10px;
    font-size: 0.74rem;
    border-radius: 16px;
  }

  .project-nav-item .nav-label {
    max-width: 100px;
  }

  .project-nav-item .nav-owner {
    display: none;
  }

  .project-nav-actions {
    display: none !important;
  }

  .btn-icon-small {
    width: 26px;
    height: 26px;
  }

  /* ---- 视图面板通用 ---- */
  .view-panel {
    padding: 12px;
  }

  .view-panel h2 {
    font-size: 1.1rem;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .page-header .btn-primary {
    margin-left: 0 !important;
    width: 100%;
  }

  /* ============================================
     工作台（会议视图） — 最复杂的适配
     ============================================ */

  /* 双栏 → 单栏 + 标签切换 */
  .workbench-split {
    flex-direction: column;
    gap: 0;
    margin: 0;
  }

  .workbench-region.workbench-project,
  .workbench-region.workbench-external {
    flex: none;
    width: 100%;
    padding: 12px;
    overflow-y: auto;
    border: none;
  }

  .workbench-region.workbench-external {
    border-left: none;
    border-top: 1px solid rgba(30,58,95,0.08);
  }

  /* 移动端区域标签切换器 */
  .mobile-region-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid rgba(30,58,95,0.08);
    background: var(--bg-card);
    flex-shrink: 0;
  }

  .mobile-region-tab {
    flex: 1;
    padding: 10px 8px;
    text-align: center;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    border: none;
    background: none;
    cursor: pointer;
    position: relative;
    font-family: inherit;
    transition: color 0.2s;
  }

  .mobile-region-tab.active {
    color: var(--gold);
  }

  .mobile-region-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    right: 20%;
    height: 2.5px;
    background: var(--gold);
    border-radius: 2px 2px 0 0;
  }

  .workbench-region.mobile-hidden {
    display: none !important;
  }

  /* 区域标签栏标题（桌面版的标签说明在移动端简化） */
  .workbench-region-label-bar {
    margin-bottom: 10px;
    padding-bottom: 6px;
  }

  .workbench-region-sub {
    display: none;
  }

  /* 四宫格 → 单列或两列 */
  .workbench-personal-grid,
  .workbench-personal-grid--project,
  .workbench-personal-grid--external {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 8px;
    max-height: none;
  }

  .wb-panel {
    min-height: 120px;
    max-height: 200px;
  }

  .wb-panel-hd {
    padding: 8px 10px;
    font-size: 0.78rem;
  }

  .wb-panel-body {
    padding: 6px 8px;
    font-size: 0.75rem;
  }

  /* 会议详情区域 */
  .workbench-meeting-block {
    margin-top: 12px;
  }

  .workbench-sub-label {
    font-size: 0.82rem;
    margin-bottom: 8px;
  }

  .meeting-info-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .meeting-info-header h2 {
    font-size: 1rem;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .meeting-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
  }

  .meeting-actions .btn-secondary,
  .meeting-actions .btn-primary,
  .meeting-actions .btn-close-meeting,
  .meeting-actions .btn-attachment {
    font-size: 0.72rem;
    padding: 6px 10px;
  }

  .meeting-actions .btn-secondary span,
  .meeting-actions .btn-primary span,
  .meeting-actions .btn-close-meeting span {
    font-size: 0.72rem;
  }

  .meeting-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .meta-item {
    font-size: 0.78rem;
  }

  .meta-item label {
    font-size: 0.72rem;
  }

  /* 外部工具栏 */
  .workbench-external-toolbar {
    flex-wrap: wrap;
    gap: 6px;
  }

  .workbench-external-toolbar .btn-secondary {
    font-size: 0.75rem;
    padding: 6px 10px;
  }

  /* "未选择会议"提示 */
  .no-meeting-selected {
    padding: 24px 12px;
  }

  .placeholder-icon {
    width: 48px;
    height: 48px;
  }

  .placeholder-content h3 {
    font-size: 1rem;
  }

  .placeholder-content p {
    font-size: 0.8rem;
  }

  /* ============================================
     数据表格 — 横向滚动 + 关键列优先
     ============================================ */

  .todo-section,
  .step-section {
    overflow: visible;
  }

  .todo-section table,
  .dashboard-table-wrap table {
    min-width: 700px;
  }

  .todo-section,
  .dashboard-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .data-table {
    font-size: 0.75rem;
  }

  .data-table th {
    font-size: 0.7rem;
    padding: 8px 6px;
    white-space: nowrap;
  }

  .data-table td {
    padding: 8px 6px;
    font-size: 0.75rem;
  }

  /* 步骤表格 */
  .step-content {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .step-table {
    min-width: 600px;
  }

  /* ============================================
     个人工作台 (Dashboard)
     ============================================ */
  .dashboard-header h2 {
    font-size: 1.1rem;
    margin-bottom: 8px;
  }

  .dashboard-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .stat-card {
    padding: 10px;
  }

  .stat-number {
    font-size: 1.3rem;
  }

  .stat-label {
    font-size: 0.7rem;
  }

  .dashboard-motto {
    padding: 10px;
    margin: 10px 0;
  }

  .dashboard-motto p {
    font-size: 0.72rem;
    line-height: 1.6;
  }

  .filter-bar {
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
  }

  .filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }

  .filter-chip {
    font-size: 0.72rem;
    padding: 4px 10px;
  }

  .sort-select {
    font-size: 0.78rem;
  }

  .sort-select select {
    width: 100%;
    padding: 6px 8px;
  }

  /* 工作台表格也需要横向滚动 */
  .dashboard-table-wrap {
    margin: 0 -12px;
    padding: 0 12px;
  }

  /* ============================================
     项目管理
     ============================================ */
  .project-cards {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .project-card {
    padding: 14px;
  }

  .project-card-header h3 {
    font-size: 0.92rem;
  }

  .project-card-actions {
    flex-wrap: wrap;
    gap: 6px;
  }

  .project-card-actions button {
    font-size: 0.72rem;
    padding: 5px 10px;
  }

  /* ============================================
     项目外事务
     ============================================ */
  .affairs-toolbar {
    flex-direction: column;
    gap: 8px;
  }

  .affairs-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .affairs-filters .filter-select {
    flex: 1;
    min-width: 100px;
    font-size: 0.78rem;
  }

  .affairs-list {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .affair-card {
    padding: 12px;
  }

  /* ============================================
     归档管理
     ============================================ */
  #archiveFilterBar {
    flex-direction: column;
    gap: 8px;
  }

  #archiveFilterBar select,
  #archiveFilterBar input {
    width: 100%;
    font-size: 0.82rem;
  }

  .archive-list {
    grid-template-columns: 1fr;
  }

  /* ============================================
     统计分析
     ============================================ */
  .stats-summary-cards {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .stats-two-col {
    flex-direction: column;
    gap: 12px;
  }

  .stats-panel {
    min-width: 0;
  }

  .stats-panel-title {
    font-size: 0.88rem;
  }

  .stats-kpi-strip {
    flex-direction: column;
    gap: 8px;
  }

  /* ============================================
     索引矩阵
     ============================================ */
  .index-matrix-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -12px;
    padding: 0 12px;
  }

  .index-toolbar {
    flex-wrap: wrap;
    gap: 6px;
  }

  /* ============================================
     课堂
     ============================================ */
  .classroom-header {
    flex-direction: column;
    gap: 8px;
  }

  .classroom-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .classroom-header h2 {
    font-size: 1.1rem;
  }

  .classroom-sub {
    font-size: 0.78rem;
  }

  /* ============================================
     设置
     ============================================ */
  .settings-section {
    padding: 14px;
  }

  .settings-section h3 {
    font-size: 0.95rem;
  }

  .theme-switch-row {
    flex-wrap: wrap;
    gap: 8px;
  }

  .member-list {
    gap: 6px;
  }

  .member-tag {
    font-size: 0.78rem;
    padding: 4px 10px;
  }

  .add-member-row,
  .lifecycle-add-row {
    flex-direction: column;
    gap: 8px;
  }

  .add-member-row input,
  .lifecycle-add-row input {
    width: 100%;
  }

  .add-member-row .btn-primary,
  .lifecycle-add-row .btn-primary {
    width: 100%;
  }

  .lifecycle-item {
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px 10px;
  }

  .workflow-canvas {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
  }

  .workflow-add-row {
    flex-direction: column;
    gap: 6px;
  }

  .workflow-add-row input,
  .workflow-add-row select,
  .workflow-add-row button {
    width: 100%;
  }

  .operator-team-block {
    padding: 10px;
  }

  /* 数据管理按钮 */
  .settings-section > .btn-danger,
  .settings-section > .btn-secondary {
    display: block;
    width: 100%;
    margin-bottom: 8px;
    text-align: center;
  }

  /* ============================================
     内嵌编辑视图（项目/事务）
     ============================================ */
  .inline-edit-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .inline-edit-header h2 {
    font-size: 1rem;
  }

  .inline-edit-body .form-row {
    flex-direction: column;
    gap: 10px;
  }

  .inline-edit-body .form-group {
    width: 100%;
  }

  .inline-edit-footer {
    flex-wrap: wrap;
    gap: 8px;
  }

  .inline-edit-footer button {
    flex: 1;
    min-width: 120px;
    text-align: center;
  }

  /* ============================================
     项目详情
     ============================================ */
  .pd-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .pd-header h2 {
    font-size: 1rem;
  }

  .pd-header-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  /* ============================================
     甘特图
     ============================================ */
  .gantt-view-body {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .gantt-view-header h2 {
    font-size: 1rem;
  }

  /* ============================================
     目标管理（只读视图）
     ============================================ */
  .obj-view-body {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* ============================================
     里程碑设立
     ============================================ */
  .ms-setup-body {
    overflow-x: auto;
  }

  /* ============================================
     弹窗（模态框）— 移动端全屏化
     ============================================ */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 92vh;
    margin: 0;
    border-radius: 16px 16px 0 0;
    animation: modalSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .modal.modal-small {
    max-height: 80vh;
  }

  .modal.modal-large {
    max-height: 95vh;
  }

  #viewAffairEdit {
    padding: 12px 10px 20px;
  }

  #viewAffairEdit .inline-edit-body {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 16px 14px 20px;
  }

  .modal.modal-objectives {
    max-height: 95vh;
  }

  @keyframes modalSlideUp {
    from {
      transform: translateY(100%);
      opacity: 0.8;
    }
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }

  .modal-header {
    padding: 14px 16px;
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-card);
  }

  .modal-header h3 {
    font-size: 1rem;
  }

  .modal-close {
    width: 32px;
    height: 32px;
    font-size: 1.2rem;
  }

  .modal-body {
    padding: 12px 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .modal-body label {
    font-size: 0.82rem;
  }

  .modal-body input,
  .modal-body select,
  .modal-body textarea {
    font-size: 16px !important;
    padding: 10px 12px;
    border-radius: 8px;
  }

  .modal-body .form-row,
  .modal-body .form-row-2 {
    flex-direction: column;
    gap: 10px;
  }

  .modal-body .form-row > div,
  .modal-body .form-row-2 > div,
  .modal-body .form-group {
    width: 100%;
  }

  .modal-footer {
    padding: 12px 16px;
    padding-bottom: calc(12px + var(--safe-area-bottom));
    position: sticky;
    bottom: 0;
    background: var(--bg-card);
    z-index: 10;
  }

  .modal-footer button {
    flex: 1;
    min-height: 42px;
    font-size: 0.88rem;
  }

  /* 参会人选择器触摸友好 */
  .participant-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .participant-tag {
    min-height: 36px;
    padding: 6px 12px;
    font-size: 0.82rem;
  }

  /* 目标管理弹窗内表格 */
  .obj-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .obj-toolbar {
    flex-wrap: wrap;
    gap: 6px;
  }

  /* ============================================
     桌面宠物 — 移动端缩小
     ============================================ */
  .pet-container {
    right: 8px !important;
    bottom: calc(var(--mobile-bottom-nav-height) + var(--safe-area-bottom) + 8px) !important;
  }

  .pet-body {
    width: 100px !important;
    height: 100px !important;
  }

  .pet-shadow {
    width: 60px;
    height: 6px;
  }

  .pet-toolbar {
    gap: 2px;
  }

  .pet-tool-btn {
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
  }

  .pet-speech {
    min-width: 100px;
    max-width: 160px;
    font-size: 0.72rem;
    padding: 6px 10px;
  }

  /* ============================================
     底部导航栏（移动端专用）
     ============================================ */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--mobile-bottom-nav-height) + var(--safe-area-bottom));
    padding-bottom: var(--safe-area-bottom);
    background: var(--bg-card);
    border-top: 1px solid rgba(30,58,95,0.08);
    box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
    z-index: 1000;
    align-items: stretch;
  }

  .mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.6rem;
    font-weight: 500;
    padding: 4px 2px;
    position: relative;
    transition: color 0.2s;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-nav-item svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
    flex-shrink: 0;
  }

  .mobile-nav-item.active {
    color: var(--gold);
  }

  .mobile-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 25%;
    right: 25%;
    height: 2.5px;
    background: var(--gold);
    border-radius: 0 0 3px 3px;
  }

  /* "更多"菜单 */
  .mobile-more-menu {
    display: none;
    position: fixed;
    bottom: calc(var(--mobile-bottom-nav-height) + var(--safe-area-bottom));
    right: 0;
    left: 0;
    background: var(--bg-card);
    border-top: 1px solid rgba(30,58,95,0.08);
    box-shadow: 0 -4px 24px rgba(0,0,0,0.12);
    border-radius: 16px 16px 0 0;
    padding: 16px;
    z-index: 999;
    animation: moreMenuUp 0.25s ease;
  }

  .mobile-more-menu.active {
    display: block;
  }

  @keyframes moreMenuUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
  }

  .mobile-more-menu-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
  }

  .mobile-more-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 4px;
    border: none;
    background: var(--bg-hover);
    border-radius: 10px;
    cursor: pointer;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.68rem;
    font-weight: 500;
    transition: all 0.15s;
  }

  .mobile-more-item:active {
    transform: scale(0.95);
    background: var(--gold-glow);
    color: var(--gold);
  }

  .mobile-more-item svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
  }

  /* 里程碑抽屉开关按钮（移动端在顶部栏右边显示） */
  .mobile-milestone-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--gold-border);
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    color: var(--gold);
    margin-right: 8px;
    flex-shrink: 0;
  }

  .mobile-milestone-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
  }

  .mobile-milestone-btn.active {
    background: var(--gold);
    color: #fff;
  }

  /* ============================================
     按钮触摸优化 — 最小 44px 触控区域
     ============================================ */
  .btn-primary,
  .btn-secondary,
  .btn-danger {
    min-height: 40px;
    padding: 8px 14px;
    font-size: 0.82rem;
    border-radius: 8px;
  }

  .btn-primary.btn-small,
  .btn-secondary.btn-small {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 0.75rem;
  }

  .btn-back-meeting {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 0.78rem;
  }

  /* ============================================
     Toast 通知 — 移动端位置调整
     ============================================ */
  .toast-container {
    bottom: calc(var(--mobile-bottom-nav-height) + var(--safe-area-bottom) + 12px);
    left: 12px;
    right: 12px;
  }

  .toast {
    font-size: 0.82rem;
    padding: 10px 14px;
    border-radius: 10px;
  }

  /* ============================================
     风险预警与健康面板
     ============================================ */
  .risk-alert-bar {
    font-size: 0.78rem;
    padding: 8px 10px;
  }

  .project-health-panel {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .health-card {
    min-width: 240px;
  }

  /* 管辖范围 */
  .dashboard-scope-bar {
    font-size: 0.75rem;
    padding: 8px 10px;
    flex-wrap: wrap;
  }

  /* ============================================
     附件区域
     ============================================ */
  .attachment-list {
    grid-template-columns: 1fr;
  }

  .attachment-item {
    font-size: 0.78rem;
  }

  /* ============================================
     申报 vs 核实对比面板
     ============================================ */
  .sr-vs-panel {
    flex-direction: column;
    gap: 8px;
  }

  .sr-vs-panel > div {
    width: 100%;
  }

  /* ============================================
     内联编辑行（待办/步骤表格内）
     ============================================ */
  .inline-input,
  .inline-select {
    font-size: 14px !important;
    min-height: 36px;
  }

  /* ============================================
     进度条
     ============================================ */
  .meeting-progress-strip {
    padding: 10px;
    font-size: 0.78rem;
  }

  /* ============================================
     宠物 AI 对话面板 — 移动端全屏底部抽屉
     ============================================ */
  .pet-chat-panel {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    max-height: 75vh !important;
    min-height: 50vh !important;
    border-radius: 16px 16px 0 0 !important;
    resize: none !important;
    z-index: 10000 !important;
    animation: petChatSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  }

  @keyframes petChatSlideUp {
    from { transform: translateY(100%); opacity: 0.8; }
    to   { transform: translateY(0); opacity: 1; }
  }

  .pet-chat-header {
    padding: 12px 14px;
    cursor: default;
  }

  .pet-chat-title {
    font-size: 0.9rem;
  }

  .pet-chat-close {
    width: 34px;
    height: 34px;
    font-size: 1.3rem;
  }

  .pet-chat-messages {
    padding: 12px;
  }

  .pet-chat-bubble {
    max-width: 90%;
    font-size: 0.82rem;
    padding: 10px 14px;
  }

  .pet-chat-input {
    font-size: 16px !important;
    padding: 10px 14px;
  }

  .pet-chat-input-row {
    padding: 10px 14px;
    padding-bottom: calc(10px + var(--safe-area-bottom));
  }

  .pet-chat-send {
    width: 38px;
    height: 38px;
    font-size: 1rem;
  }

  .pet-ai-actions {
    flex-wrap: wrap;
    gap: 6px;
  }

  .pet-ai-action-btn {
    font-size: 0.75rem;
    padding: 6px 10px;
    min-height: 34px;
  }

  /* ============================================
     作废记录视图
     ============================================ */
  .voided-summary {
    flex-direction: column;
    gap: 8px;
  }

  .voided-summary-card {
    width: 100%;
    padding: 8px 12px;
  }

  .voided-summary-card .vs-count {
    font-size: 1.1rem;
  }

  .voided-list-container {
    max-height: 60vh;
    margin: 0 -12px;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .voided-record-row {
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 12px;
  }

  .voided-record-row .vr-meta {
    min-width: 0;
    width: 100%;
    text-align: left;
    font-size: 0.72rem;
  }

  .voided-record-row .vr-content {
    font-size: 0.8rem;
  }

  .trash-view-hint {
    font-size: 0.8rem;
  }

  /* ============================================
     密码相关弹窗
     ============================================ */
  #modalChangePassword .modal-body input,
  #modalResetPassword .modal-body input,
  #modalResetPassword .modal-body select {
    font-size: 16px !important;
    padding: 10px 12px;
    border-radius: 8px;
  }

  .login-error {
    font-size: 0.8rem;
    padding: 8px 12px;
    border-radius: 8px;
  }
}

/* ============================================
   极窄屏幕 (< 400px)
   ============================================ */
@media (max-width: 400px) {
  .project-nav-bar {
    padding: 4px 6px;
  }

  .project-nav-item {
    font-size: 0.68rem;
    padding: 3px 8px;
  }

  .project-nav-item .nav-label {
    max-width: 80px;
  }

  .view-panel {
    padding: 8px;
  }

  .workbench-personal-grid,
  .workbench-personal-grid--project,
  .workbench-personal-grid--external {
    grid-template-columns: 1fr;
  }

  .dashboard-stats {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .stats-summary-cards {
    grid-template-columns: 1fr;
  }

  .mobile-more-menu-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .meeting-meta {
    grid-template-columns: 1fr;
  }

  .modal-body .form-row-2 {
    flex-direction: column;
  }
}

/* ============================================
   横屏模式修正
   ============================================ */
@media (max-height: 500px) and (orientation: landscape) {
  #app-header {
    height: 40px;
  }

  #app-main {
    height: calc(100vh - 40px - var(--mobile-bottom-nav-height) - var(--safe-area-bottom));
  }

  .mobile-bottom-nav {
    --mobile-bottom-nav-height: 48px;
  }

  .mobile-nav-item svg {
    width: 18px;
    height: 18px;
  }

  .mobile-nav-item span {
    display: none;
  }

  .modal {
    max-height: 95vh;
  }

  .pet-container {
    display: none;
  }
}

/* ============================================
   暗色主题下的移动端补充覆盖
   ============================================ */
@media (max-width: 768px) {
  [data-theme="dark"] .mobile-bottom-nav {
    background: var(--bg-secondary);
    border-top-color: rgba(255,255,255,0.06);
    box-shadow: 0 -2px 12px rgba(0,0,0,0.3);
  }

  [data-theme="dark"] .mobile-nav-item.active {
    color: var(--gold);
  }

  [data-theme="dark"] .mobile-more-menu {
    background: var(--bg-secondary);
    border-top-color: rgba(255,255,255,0.06);
    box-shadow: 0 -4px 24px rgba(0,0,0,0.35);
  }

  [data-theme="dark"] .mobile-more-item {
    background: var(--bg-card);
    color: var(--text-secondary);
  }

  [data-theme="dark"] .mobile-more-item:active {
    background: var(--gold-glow);
    color: var(--gold);
  }

  [data-theme="dark"] .mobile-region-tabs {
    background: var(--bg-secondary);
    border-bottom-color: rgba(255,255,255,0.06);
  }

  [data-theme="dark"] .mobile-region-tab.active {
    color: var(--gold);
  }

  [data-theme="dark"] .mobile-drawer-overlay {
    background: rgba(0,0,0,0.6);
  }

  [data-theme="dark"] .mobile-milestone-btn {
    border-color: rgba(255,255,255,0.12);
    color: var(--gold);
  }

  [data-theme="dark"] .mobile-milestone-btn.active {
    background: var(--gold);
    color: #fff;
  }

  [data-theme="dark"] .milestone-sidebar {
    border-right-color: rgba(255,255,255,0.08);
    box-shadow: none;
  }

  [data-theme="dark"] .milestone-sidebar.mobile-open {
    box-shadow: 4px 0 24px rgba(0,0,0,0.4);
  }
}

/* ============================================
   桌面端隐藏移动端专用元素
   ============================================ */
@media (min-width: 769px) {
  .mobile-bottom-nav,
  .mobile-drawer-overlay,
  .mobile-region-tabs,
  .mobile-more-menu,
  .mobile-milestone-btn {
    display: none !important;
  }
}
