/* ===================== CSS 变量 ===================== */
:root {
  --bg-app: #f6f7f9; --bg-surface: #ffffff; --bg-hover: #f3f4f6; --bg-selected: #e8eaf0;
  --text-primary: #1f2937; --text-secondary: #6b7280; --text-muted: #9ca3af;
  --border: #e5e7eb; --border-light: #f0f1f3;
  --accent: #6554c0; --accent-light: #f4f3ff; --accent-hover: #5848a6;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04); --shadow-md: 0 4px 12px rgba(0,0,0,0.08); --shadow-lg: 0 12px 32px rgba(0,0,0,0.12);
  --radius: 8px; --radius-sm: 4px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  --header-h: 56px;
}
[data-theme="dark"] {
  --bg-app: #16171a; --bg-surface: #1e1f23; --bg-hover: #28292e; --bg-selected: #2d2e35;
  --text-primary: #e5e7eb; --text-secondary: #9ca3af; --text-muted: #6b7280;
  --border: #2e2f35; --border-light: #25262b;
  --accent: #8b7cf6; --accent-light: #2a2742; --accent-hover: #9d8cf6;
  --shadow-md: 0 4px 12px rgba(0,0,0,0.3); --shadow-lg: 0 12px 32px rgba(0,0,0,0.4);
}

/* ===================== Reset & Base ===================== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); background: var(--bg-app); color: var(--text-primary); font-size: 14px; overflow: hidden; height: 100vh; height: 100dvh; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: var(--border); }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* ===================== Loading ===================== */
.loading-overlay { position: fixed; inset: 0; background: rgba(255,255,255,0.6); display: none; align-items: center; justify-content: center; z-index: 9000; }
[data-theme="dark"] .loading-overlay { background: rgba(22,23,26,0.6); }
.loading-overlay.show { display: flex; }
.spinner { width: 36px; height: 36px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===================== Auth Screen ===================== */
.auth-screen { display: none; position: fixed; inset: 0; flex-direction: column; align-items: center; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); z-index: 5000; overflow-y: auto; }
.auth-screen.show { display: flex; }
.auth-main { width: 100%; min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 16px; box-sizing: border-box; }
.auth-card { background: var(--bg-surface); border-radius: 16px; padding: 32px 24px; width: 400px; max-width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,0.2); flex-shrink: 0; }
.auth-logo { text-align: center; margin-bottom: 24px; }
.auth-logo svg { width: 40px; height: 40px; color: var(--accent); }
.auth-logo h1 { font-size: 24px; font-weight: 700; color: var(--accent); margin-top: 8px; }
.auth-logo p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.auth-tabs { display: flex; gap: 4px; background: var(--bg-app); border-radius: 8px; padding: 4px; margin-bottom: 20px; }
.auth-tabs button { flex: 1; padding: 9px; border-radius: 6px; font-size: 14px; font-weight: 500; color: var(--text-secondary); transition: all 0.15s; }
.auth-tabs button.active { background: var(--bg-surface); color: var(--accent); box-shadow: var(--shadow-sm); }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form input { padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-app); color: var(--text-primary); font-size: 16px; transition: all 0.15s; }
.auth-form input:focus { outline: none; border-color: var(--accent); background: var(--bg-surface); box-shadow: 0 0 0 3px var(--accent-light); }
.auth-form button { padding: 12px; background: var(--accent); color: #fff; border-radius: 8px; font-size: 15px; font-weight: 600; margin-top: 4px; transition: background 0.15s; }
.auth-form button:active { transform: scale(0.98); }
.auth-form button:hover { background: var(--accent-hover); }
.auth-error { color: #e2435c; font-size: 12px; text-align: center; min-height: 16px; }
.reg-code-row { display: flex; gap: 8px; }
.reg-code-row input { flex: 1; min-width: 0; }
.reg-code-row button { flex-shrink: 0; padding: 0 14px; background: var(--bg-hover); color: var(--text-secondary); border: 1px solid var(--border); border-radius: 8px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.reg-code-row button:active { transform: scale(0.98); }
.reg-code-row button:hover:not(:disabled) { background: var(--accent-light); color: var(--accent); }
.reg-code-row button:disabled { opacity: 0.5; cursor: not-allowed; }
.auth-forgot-row { display: flex; justify-content: flex-end; margin: -4px 0 0; }
.auth-forgot-row a { font-size: 12px; color: var(--accent); text-decoration: none; }
.auth-forgot-row a:hover { text-decoration: underline; }
.auth-form-title { font-size: 16px; font-weight: 600; color: var(--text-primary); text-align: center; margin-bottom: 4px; }
.auth-back-row { text-align: center; margin-top: 4px; }
.auth-back-row a { font-size: 12px; color: var(--text-muted); text-decoration: none; }
.auth-back-row a:hover { color: var(--accent); text-decoration: underline; }
.auth-demo { margin-top: 16px; padding: 10px 14px; background: var(--bg-app); border-radius: 8px; font-size: 12px; color: var(--text-muted); text-align: center; line-height: 1.6; }
.auth-demo b { color: var(--text-secondary); }
.auth-appeal-row { text-align: center; margin-top: 12px; font-size: 12px; color: var(--text-muted); }
.auth-appeal-row a { color: var(--accent); text-decoration: none; }
.auth-appeal-row a:hover { text-decoration: underline; }

/* ===================== App Layout ===================== */
#app { display: none; flex-direction: column; height: 100vh; height: 100dvh; padding-bottom: 0; box-sizing: border-box; }
#app.show { display: flex; }

/* ===================== Header ===================== */
.app-header { display: flex; flex-direction: column; background: var(--bg-surface); border-bottom: 1px solid var(--border); flex-shrink: 0; z-index: 100; }
.header-row { display: flex; align-items: center; gap: 8px; padding: 0 12px; }
.header-row-top { height: 50px; }
.header-row-bottom { height: 52px; border-top: 1px solid var(--border-light); }
.header-row-right { margin-left: auto; display: flex; align-items: center; gap: 4px; }

.logo { display: flex; align-items: center; gap: 6px; font-size: 17px; font-weight: 700; color: var(--accent); white-space: nowrap; }
.logo svg { width: 20px; height: 20px; }

.mobile-menu-btn { display: none; width: 36px; height: 36px; align-items: center; justify-content: center; border-radius: 6px; color: var(--text-secondary); }
.mobile-menu-btn svg { width: 22px; height: 22px; }
.mobile-menu-btn:active { background: var(--bg-hover); }

.project-selector { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 8px; cursor: pointer; transition: background 0.15s, box-shadow 0.15s, border-color 0.15s; white-space: nowrap; background: var(--bg-hover); border: 1px solid var(--border-light); }
.project-selector:hover { background: var(--bg-app); box-shadow: 0 1px 5px rgba(0,0,0,0.08); border-color: var(--accent); }
.project-selector:active { transform: translateY(1px); }
.project-selector .proj-icon { width: 15px; height: 15px; color: var(--accent); flex-shrink: 0; }
.project-selector .pn { font-size: 13px; font-weight: 600; max-width: 140px; overflow: hidden; text-overflow: ellipsis; color: var(--text-primary); }
.project-selector .chevron { width: 14px; height: 14px; color: var(--accent); flex-shrink: 0; transition: transform 0.15s; }
.project-selector:hover .chevron { transform: translateY(1px); }

.view-switcher { display: flex; background: var(--bg-app); border-radius: var(--radius-sm); padding: 3px; }
.view-switcher button { padding: 6px 14px; font-size: 13px; font-weight: 500; border-radius: 3px; color: var(--text-secondary); transition: all 0.15s; }
.view-switcher button.active { background: var(--bg-surface); color: var(--accent); box-shadow: var(--shadow-sm); }
.view-switcher button:active { color: var(--accent); }

.toolbar { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.search-box { position: relative; width: 180px; }
.search-box input { width: 100%; padding: 7px 28px 7px 32px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-app); color: var(--text-primary); font-size: 13px; transition: all 0.15s; box-sizing: border-box; }
.search-box input:focus { outline: none; border-color: var(--accent); background: var(--bg-surface); }
.search-box svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--text-muted); pointer-events: none; }
[data-theme="dark"] .search-box svg { color: var(--text-secondary); }
.search-clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; border: none; border-radius: 50%; background: var(--text-muted); color: #fff; font-size: 12px; line-height: 1; display: none; align-items: center; justify-content: center; cursor: pointer; padding: 0; opacity: 0.7; transition: opacity 0.15s; }
.search-clear:hover { opacity: 1; }
.search-clear.show { display: flex; }
[data-theme="dark"] .search-clear { background: var(--text-secondary); }

.filter-select { padding: 7px 28px 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-app); color: var(--text-primary); font-size: 13px; cursor: pointer; appearance: none; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%236b7280' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
[data-theme="dark"] .filter-select { background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%239ca3af' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E"); }
.filter-select:focus { outline: none; border-color: var(--accent); }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; transition: all 0.15s; white-space: nowrap; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:active { transform: scale(0.96); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-danger { background: #fee2e2; color: #dc2626; }
.btn-danger:hover { background: #fecaca; }
[data-theme="dark"] .btn-danger { background: #7f1d1d; color: #fca5a5; }
.btn-icon { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: var(--radius-sm); color: var(--text-secondary); transition: all 0.15s; position: relative; flex-shrink: 0; }
.btn-icon:active { background: var(--bg-hover); }
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-icon svg { width: 18px; height: 18px; }
.badge-count { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; background: var(--accent); color: #fff; border-radius: 8px; font-size: 10px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
/* 导出下拉菜单 */
.export-dropdown { position: relative; display: inline-flex; }
.btn-outline { background: var(--bg-surface); color: var(--text-primary); border: 1px solid var(--border); gap: 6px; }
.btn-outline:hover { background: var(--bg-hover); }
.btn-outline svg { width: 16px; height: 16px; }
.export-caret { width: 14px !important; height: 14px !important; transition: transform 0.15s; }
.export-dropdown.open .export-caret { transform: rotate(180deg); }
.export-menu { position: absolute; top: calc(100% + 6px); right: 0; min-width: 180px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-md); padding: 4px; z-index: 60; display: none; }
.export-dropdown.open .export-menu { display: block; }
.export-menu button { display: block; width: 100%; text-align: left; padding: 9px 12px; font-size: 13px; color: var(--text-primary); background: none; border: none; border-radius: var(--radius-sm); cursor: pointer; }
.export-menu button:hover { background: var(--bg-hover); color: var(--accent); }

/* 添加任务下拉（任务 / 里程碑） */
.add-task-dropdown { position: relative; display: inline-flex; }
.add-task-dropdown .btn-primary { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.add-task-caret-btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border-left: 1px solid rgba(255,255,255,0.28); padding-left: 8px; padding-right: 8px; margin-left: 0; }
.add-task-caret { width: 13px !important; height: 13px !important; transition: transform 0.15s; }
.add-task-dropdown.open .add-task-caret { transform: rotate(180deg); }
.add-task-menu { position: absolute; top: calc(100% + 6px); left: 0; min-width: 180px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-md); padding: 4px; z-index: 60; display: none; }
.add-task-dropdown.open .add-task-menu { display: block; }
.add-task-menu button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 9px 12px; font-size: 13px; color: var(--text-primary); background: none; border: none; border-radius: var(--radius-sm); cursor: pointer; }
.add-task-menu button:hover { background: var(--bg-hover); color: var(--accent); }
.add-task-menu button svg { width: 15px; height: 15px; flex-shrink: 0; }

.user-btn { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 20px; cursor: pointer; transition: background 0.15s; flex-shrink: 0; }
.user-btn:active { background: var(--bg-hover); }
.user-btn:hover { background: var(--bg-hover); }
.user-btn .avatar { width: 28px; height: 28px; font-size: 12px; }
.user-btn .un { font-size: 12px; font-weight: 500; white-space: nowrap; }

.avatar { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: #fff; flex-shrink: 0; }

/* ===================== Main Content ===================== */
.main-content { flex: 1; overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
.view-panel { flex: 1; overflow: hidden; display: none; flex-direction: column; min-height: 0; }
.view-panel.active { display: flex; }
#calendar-view { overflow-y: auto; padding: 12px 14px; }
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-btn { height: 32px; min-width: 32px; padding: 0 10px; border: 1px solid var(--border); background: var(--bg-surface); color: var(--text); border-radius: 8px; cursor: pointer; font-size: 15px; }
.cal-btn:hover { border-color: var(--accent); }
.cal-period { font-size: 15px; font-weight: 500; margin-left: 6px; color: var(--text); }
.cal-tools { display: flex; align-items: center; gap: 10px; }
.cal-seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.cal-seg-btn { height: 32px; padding: 0 14px; border: none; background: var(--bg-surface); color: var(--text-muted); cursor: pointer; font-size: 13px; }
.cal-seg-btn.active { background: var(--accent); color: #fff; }
.cal-grid { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--bg-surface); flex-shrink: 0; }
.cal-weekhead { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--border); }
.cal-wd { text-align: center; padding: 8px 0; font-size: 12px; color: var(--text-muted); }
.cal-weekrow { position: relative; display: block; border-bottom: 1px solid var(--border); }
.cal-cells { display: grid; grid-template-columns: repeat(7, 1fr); min-height: 100%; }
.cal-weekrow:last-child { border-bottom: none; }
.cal-cell { position: relative; border-right: 1px solid var(--border); min-height: 42px; padding: 4px 4px 6px; }
.cal-cell:last-child { border-right: none; }
.cal-cell.cal-weekend { background: rgba(125,125,125,0.06); }
.cal-cell.cal-out .cal-cellnum { color: var(--text-muted); opacity: 0.5; }
.cal-cell.cal-today { background: rgba(56,189,248,0.10); }
.cal-cell.cal-today .cal-cellnum { color: #38bdf8; font-weight: 700; }
.cal-cell.cal-drop { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-cellnum { font-size: 12px; color: var(--text); line-height: 18px; }
.cal-add { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border: none; background: transparent; color: var(--text-muted); font-size: 15px; line-height: 1; border-radius: 4px; cursor: pointer; opacity: 0; transition: opacity 0.1s; }
.cal-cell:hover .cal-add { opacity: 1; }
.cal-add:hover { background: var(--accent); color: #fff; }
.cal-barlayer { position: absolute; inset: 0; pointer-events: none; }
.cal-bar { position: absolute; pointer-events: auto; height: 16px; border-radius: 8px; padding: 0 8px; font-size: 11px; color: #fff; cursor: grab; display: flex; align-items: center; overflow: hidden; box-sizing: border-box; white-space: nowrap; }
.cal-bar:active { cursor: grabbing; }
.cal-bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-ms { background: transparent !important; color: #ef4444; font-size: 16px; width: 18px; transform: translateX(-50%); display: flex; align-items: center; justify-content: center; pointer-events: auto; cursor: grab; }
.cal-year { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--bg-surface); flex-shrink: 0; }
.cal-monthrow { display: flex; border-bottom: 1px solid var(--border); }
.cal-monthrow:last-child { border-bottom: none; }
.cal-monthlabel { width: 46px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--text-muted); border-right: 1px solid var(--border); }
.cal-monthbody { position: relative; flex: 1; min-width: 0; }
.cal-monthgrid { display: grid; }
.cal-monthgrid .cal-cell { border-right: 1px solid var(--border); min-height: 30px; padding: 0; }
.cal-monthgrid .cal-cell:last-child { border-right: none; }
.cal-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin-top: 14px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-surface); font-size: 12px; color: var(--text); }
.cal-legend-title { font-weight: 700; color: var(--text-muted); margin-right: 2px; }
.cal-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend-dot { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex-shrink: 0; }

/* ===================== Table View ===================== */
.group-header { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--bg-surface); border-bottom: 1px solid var(--border-light); flex-shrink: 0; flex-wrap: wrap; }
.group-color-bar { width: 3px; height: 18px; background: var(--accent); border-radius: 2px; flex-shrink: 0; }
.group-name { font-weight: 600; font-size: 14px; }
.group-count { font-size: 12px; color: var(--text-muted); background: var(--bg-hover); padding: 1px 8px; border-radius: 10px; }
.group-progress { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); }
.progress-bar { width: 80px; height: 6px; background: var(--bg-hover); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: #00c875; border-radius: 3px; transition: width 0.3s; }

.table-wrapper { flex: 1; overflow: auto; background: var(--bg-surface); -webkit-overflow-scrolling: touch; }
.task-table { width: 100%; border-collapse: collapse; table-layout: fixed; min-width: 900px; }
.task-table th, .task-table td { padding: 0; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
.task-table thead th { position: sticky; top: 0; z-index: 10; background: var(--bg-surface); border-bottom: 2px solid var(--border); height: 40px; text-align: left; font-size: 12px; font-weight: 600; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-table thead th .resize-handle { position: absolute; right: 0; top: 0; bottom: 0; width: 6px; cursor: col-resize; z-index: 11; transition: background 0.15s; }
.task-table thead th .resize-handle:hover, .task-table thead th .resize-handle.resizing { background: var(--accent); }
.resize-tooltip { position: fixed; z-index: 1000; background: #1f2937; color: #fff; font-size: 11px; padding: 4px 8px; border-radius: 4px; pointer-events: none; opacity: 0; transition: opacity 0.15s; white-space: nowrap; }
.resize-tooltip.show { opacity: 1; }
[data-theme="dark"] .resize-tooltip { background: #e5e7eb; color: #1f2937; }
.task-table thead th.sortable { cursor: pointer; user-select: none; }
.task-table thead th.sortable:active { color: var(--accent); }
.task-table thead th .th-inner { display: flex; align-items: center; gap: 4px; padding: 0 10px; height: 100%; }
.sort-arrow { width: 12px; height: 12px; opacity: 0.6; }
.task-table thead th.sort-active { color: var(--accent); background: var(--bg-hover); }
.task-table thead th.sort-active .sort-arrow { opacity: 1; color: var(--accent); }
.task-row { transition: background 0.1s; }
/* 表格行拖拽指示：用 box-shadow 避免行高跳动 */
.task-row.dragging { opacity: 0.4; }
.task-row.drop-before { box-shadow: inset 0 3px 0 0 #2f80ed; }
.task-row.drop-after { box-shadow: inset 0 -3px 0 0 #2f80ed; }
.task-row.drop-inside { box-shadow: inset 0 0 0 2px #2f80ed; background: rgba(47,128,237,0.10); }
.task-row { cursor: grab; }
.task-row:active { cursor: grabbing; }
.task-row:active { background: var(--bg-hover); }
.task-row:hover { background: var(--bg-hover); }
.task-row.selected { background: var(--bg-selected); }
.task-row.done .cell-task-name { color: var(--text-muted); text-decoration: line-through; }

/* 表格分组 — Monday 风格板块化设计 */
.task-group-header td { padding: 0; background: var(--bg-app); border: none; cursor: pointer; user-select: none; position: relative; }
.task-group-header .group-inner { display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px 10px; position: relative; }
/* 已完成分区头部：与任务行 caret/任务名对齐（caret 对齐任务 caret，标题对齐任务名） */
.task-group-header[data-group="done"] .group-inner { padding-left: 22px; gap: 4px; }
.task-group-header[data-group="done"] .group-title { color: var(--text-secondary); }
/* 组间间距：在组头行下方留出间隔 */
.task-group-header { margin-bottom: 0; }
.task-group-header + tr { margin-top: 0; }
/* 用 group-add-row 底部边距模拟组间分隔 */
.group-add-row { border-bottom: 8px solid transparent !important; }
.group-add-row:last-child { border-bottom: none !important; }
.task-group-header .group-toggle { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; color: var(--text-secondary); transition: transform 0.15s; flex-shrink: 0; }
.task-group-header.collapsed .group-toggle { transform: rotate(-90deg); }
.task-group-header .group-title { font-size: 13px; font-weight: 600; color: var(--text-primary); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-group-header .group-count { font-size: 12px; color: var(--text-muted); background: var(--bg-surface); padding: 1px 6px; border-radius: 10px; border: 1px solid var(--border-light); flex-shrink: 0; }
.task-group-header:hover td { background: var(--bg-hover); }
/* 小圆点保留但缩小，作为辅助标识（done 分区已移除圆点，保持简洁） */
.task-group-header .group-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.task-group-header.collapsed[data-group="undone"] ~ .group-undone { display: none; }
.task-group-header.collapsed[data-group="done"] ~ .group-done { display: none; }
/* 已完成分区的规则备注（解释为何部分已完成项不在该区） */
.group-note { font-size: 12px; color: var(--text-muted); padding: 2px 22px 10px; line-height: 1.5; }
/* 挂靠已完成标记：任务本身已完成，但上级任务尚未完成，故保留在上方分组 */
.pinned-tag { font-size: 11px; color: #b45309; background: #fef3c7; border: 1px solid #fde68a; padding: 1px 6px; border-radius: 6px; flex-shrink: 0; white-space: nowrap; font-weight: 500; }
.cell-inner { padding: 8px 10px; display: flex; align-items: center; min-height: 48px; }

.col-tree { width: auto; min-width: 240px; position: relative; }
.col-created { display: none; } .col-owner { width: 120px; }
.col-status { width: 110px; } .col-start { width: 110px; } .col-due { width: 110px; }
.col-priority { width: 90px; } .col-timeline { width: 220px; }
.col-updated { width: 100px; } .col-comments { width: 70px; } .col-actions { width: 44px; }

.cell-check { display: flex; justify-content: center; }
.cell-check input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.col-tree input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
.col-tree .cell-inner { padding-left: 0; gap: 4px; }
.col-tree .cell-task-name { flex: 1; }
.tree-gutter { position: relative; flex-shrink: 0; height: 100%; min-height: 48px; }
.tree-rail { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.tree-line { stroke: var(--border); stroke-width: 2; vector-effect: non-scaling-stroke; }
.tree-caret { width: 18px; height: 18px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; border: none; background: transparent; color: var(--text-secondary); cursor: pointer; border-radius: 4px; padding: 0; transition: background 0.12s, color 0.12s; }
.tree-caret:hover { background: var(--bg-hover); color: var(--text-primary); }
.tree-caret svg { width: 14px; height: 14px; }
.tree-caret-spacer { width: 18px; height: 18px; flex-shrink: 0; display: inline-block; }
.task-row.is-sub { background: color-mix(in srgb, var(--accent) 4%, transparent); }
.subitem-header-row td { padding: 0; background: var(--bg-app); border-bottom: 1px solid var(--border-light); }
.subitem-inner { display: flex; align-items: center; gap: 8px; padding: 6px 12px; }
.subitem-label { font-size: 11px; font-weight: 700; color: var(--text-muted); }
.subitem-count { font-size: 11px; color: var(--text-muted); background: var(--bg-hover); padding: 1px 6px; border-radius: 10px; }
.subitem-add { font-size: 12px; color: var(--accent); background: transparent; border: none; cursor: pointer; padding: 2px 6px; border-radius: 4px; }
.subitem-add:hover { background: var(--bg-hover); }
.cell-task-name { font-weight: 500; font-size: 14px; cursor: pointer; outline: none; word-break: break-word; flex: 1; }
.ms-tag { color: var(--accent); font-size: 13px; margin-right: 4px; vertical-align: middle; }
.cell-task-name[contenteditable="true"] { background: var(--accent-light); border-radius: 3px; padding: 2px 4px; }

.user-cell { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.user-cell .avatar { width: 24px; height: 24px; font-size: 11px; }
.user-cell .un { font-size: 12px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-cell.unassigned .un { color: var(--text-muted); }

.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 600; cursor: pointer; transition: opacity 0.15s; white-space: nowrap; }
.status-pill:active { opacity: 0.82; }
.status-pill:hover { opacity: 0.82; }
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.s-not_started { background: #e8eaed; color: #676879; } .s-not_started .dot { background: #c4c4c4; }
.s-working_on_it { background: #fde8c2; color: #8a5b00; } .s-working_on_it .dot { background: #fdab3d; }
.s-stuck { background: #fdd0d6; color: #b91c1c; } .s-stuck .dot { background: #e2435c; }
.s-done { background: #c8f0d4; color: #166534; } .s-done .dot { background: #00c875; }
[data-theme="dark"] .s-not_started { background: #3a3b3f; color: #9ca3af; }
[data-theme="dark"] .s-working_on_it { background: #5a410f; color: #fbbf24; }
[data-theme="dark"] .s-stuck { background: #5c1219; color: #fca5a5; }
[data-theme="dark"] .s-done { background: #15451f; color: #86efac; }

.priority-cell { cursor: pointer; }
.priority-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; }
.priority-badge .dot { width: 10px; height: 10px; border-radius: 50%; }
.p-urgent { color: #d6394b; } .p-urgent .dot { background: #d6394b; }
.p-high { color: #f0883e; } .p-high .dot { background: #f0883e; }
.p-normal { color: #e8b339; } .p-normal .dot { background: #e8b339; }
.p-low { color: #9aa0a6; } .p-low .dot { background: #9aa0a6; }

/* 日期列 pill 药丸样式 */
.start-cell, .due-cell { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 8px; border-radius: 12px; font-size: 13px; cursor: pointer; white-space: nowrap; transition: background 0.15s; user-select: none; line-height: 1.4; }
.start-cell:hover, .due-cell:hover { background: var(--bg-hover); }
.start-cell::before, .due-cell::before { content: ''; display: inline-block; width: 14px; height: 14px; flex-shrink: 0; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: center; background-size: contain; }
/* 开始日期：蓝灰色调 */
.start-cell { background: rgba(99,102,241,0.08); color: #5b5fc7; }
.start-cell.empty { background: transparent; color: var(--text-muted); opacity: 0.5; }
.start-cell.empty::before { opacity: 0.3; }
/* 完成日期：状态色编码 */
.due-cell { color: #4f46e5; background: rgba(79,70,229,0.08); }
.due-cell.overdue { color: #e2435c; background: rgba(226,67,92,0.10); font-weight: 600; }
.due-cell.soon { color: #fdab3d; background: rgba(253,171,61,0.10); font-weight: 500; }
.due-cell.empty { background: transparent; color: var(--text-muted); opacity: 0.5; }
.due-cell.warn { color: #e2913a; font-weight: 600; }
.due-cell.warn::after { content: " ⚠"; font-size: 11px; }
/* dark theme 适配 */
[data-theme="dark"] .start-cell { background: rgba(99,102,241,0.14); color: #818cf8; }
[data-theme="dark"] .start-cell::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E"); }
[data-theme="dark"] .due-cell { background: rgba(79,70,229,0.14); color: #a5b4fc; }
[data-theme="dark"] .due-cell.overdue { background: rgba(226,67,92,0.18); color: #f87171; }
[data-theme="dark"] .due-cell.soon { background: rgba(253,171,61,0.16); color: #fbbf24; }
.planmode-hint { display: block; margin-top: 5px; font-size: 12px; line-height: 1.4; color: var(--text-muted); }
.notify-group { margin-bottom: 12px; }
.notify-hint { display: block; margin-top: 4px; font-size: 12px; line-height: 1.4; color: var(--text-muted); font-weight: 400; }
.notify-row { display: flex; gap: 8px; align-items: center; }
.notify-row input[type="datetime-local"] { flex: 1; min-width: 0; }
.btn-notify-clear { flex-shrink: 0; padding: 7px 12px; border: 1px solid var(--border); background: transparent; color: var(--text-secondary); border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; font-family: var(--font); }
.btn-notify-clear:hover { border-color: var(--accent); color: var(--accent); }
.notify-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.notify-preset { padding: 5px 10px; border: 1px solid var(--border); background: transparent; color: var(--text-secondary); border-radius: var(--radius-sm); font-size: 12px; cursor: pointer; font-family: var(--font); transition: all 0.12s; }
.notify-preset:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.notify-preset:disabled { opacity: 0.42; cursor: not-allowed; }
.notify-preset.active { border-color: var(--accent); background: var(--accent-light); color: var(--accent); }
#notify-preset-hint { margin-top: 8px; margin-bottom: 0; }
.ph-badge { display: inline-block; margin-left: 4px; padding: 0 5px; font-size: 11px; line-height: 16px; border: 1px dashed var(--text-muted); color: var(--text-muted); border-radius: 3px; vertical-align: middle; }
.invite-input-wrapper button.btn-ph { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.invite-input-wrapper button.btn-ph:hover { border-color: var(--accent); color: var(--accent); }
.avatar-ph { opacity: 0.75; border: 1px dashed var(--text-muted); }

.timeline-cell { padding: 0 !important; }
.timeline-bar-container { position: relative; width: 100%; height: 28px; background: var(--bg-app); border-radius: var(--radius-sm); overflow: hidden; cursor: pointer; }
[data-theme="dark"] .timeline-bar-container { background: #28292e; }
.timeline-bar { position: absolute; top: 4px; height: 20px; border-radius: 4px; min-width: 8px; display: flex; align-items: center; padding: 0 6px; font-size: 10px; font-weight: 600; color: #fff; overflow: visible; white-space: nowrap; transition: opacity 0.15s; }
.timeline-bar-label { position: absolute; top: 0; left: 50%; transform: translateX(-50%); height: 100%; display: flex; align-items: center; white-space: nowrap; pointer-events: none; }
.timeline-bar.label-outside .timeline-bar-label { left: 100%; transform: none; padding-left: 6px; color: var(--text-primary); }
.timeline-bar.label-left .timeline-bar-label { left: auto; right: 100%; transform: none; padding-right: 6px; padding-left: 0; color: var(--text-primary); }
.timeline-bar:hover { opacity: 0.85; }
.timeline-bar.tb-not_started { background: #c4c4c4; color: #555; }
.timeline-bar.tb-working_on_it { background: #fdab3d; }
.timeline-bar.tb-stuck { background: #e2435c; }
.timeline-bar.tb-done { background: #00c875; }
.timeline-today { position: absolute; top: 0; width: 2px; height: 100%; background: var(--accent); z-index: 2; }
.timeline-today::after { content: ''; position: absolute; top: -2px; left: -3px; width: 8px; height: 8px; background: var(--accent); border-radius: 50%; }
.timeline-empty { text-align: center; color: var(--text-muted); font-size: 13px; }

.updated-cell { font-size: 12px; color: var(--text-muted); }
.comments-cell { cursor: pointer; }
.comments-cell .cell-inner { width: 100%; justify-content: center; }
.comments-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 12px; font-size: 12px; color: var(--text-muted); transition: all 0.15s; }
.comments-badge.has { background: var(--accent-light); color: var(--accent); }
.comments-badge:active { background: var(--bg-hover); }
.comments-badge:hover { background: var(--bg-hover); }
.comments-badge svg { width: 14px; height: 14px; }

.row-actions { opacity: 0; transition: opacity 0.15s; display: flex; gap: 2px; }
.task-row:hover .row-actions { opacity: 1; }
.row-actions button { display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 4px; color: var(--text-muted); }
.row-actions button:active { background: var(--bg-selected); color: #e2435c; }
.row-actions svg { width: 14px; height: 14px; }

.add-row-btn { display: flex; align-items: center; gap: 6px; padding: 10px 16px; font-size: 13px; color: var(--accent); font-weight: 500; transition: background 0.1s; }
.add-row-btn:active { background: var(--bg-hover); }
.add-row-btn svg { width: 16px; height: 16px; }

.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 20px; color: var(--text-muted); text-align: center; }
.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: 0.4; }
.empty-state h3 { font-size: 16px; font-weight: 600; margin-bottom: 4px; color: var(--text-secondary); }
.empty-state p { font-size: 13px; margin-bottom: 16px; }

/* ===================== Kanban View ===================== */
.kanban-scroll { flex: 1; overflow-x: auto; overflow-y: hidden; padding: 12px; -webkit-overflow-scrolling: touch; }
.kanban-board { display: flex; gap: 12px; height: 100%; min-width: max-content; }
.kanban-column { display: flex; flex-direction: column; width: 280px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); flex-shrink: 0; transition: border-color 0.15s; }
.kanban-column.drag-over { border-color: var(--accent); background: var(--accent-light); }
.kanban-col-header { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border-light); flex-shrink: 0; }
.kanban-col-header .dot { width: 10px; height: 10px; border-radius: 50%; }
.kanban-col-title { font-weight: 600; font-size: 13px; }
.kanban-col-count { font-size: 11px; font-weight: 600; color: var(--text-muted); background: var(--bg-hover); padding: 1px 7px; border-radius: 10px; }
.kanban-cards { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; min-height: 80px; }
.kanban-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; cursor: grab; transition: all 0.15s; position: relative; }
.kanban-card:active { cursor: grabbing; }
.kanban-card:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.kanban-card.dragging { opacity: 0.4; cursor: grabbing; }
.kanban-card.done .card-title { text-decoration: line-through; color: var(--text-muted); }
.card-priority-bar { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.card-priority-bar.urgent { background: #d6394b; } .card-priority-bar.high { background: #f0883e; } .card-priority-bar.normal { background: #e8b339; } .card-priority-bar.low { background: #9aa0a6; }
.card-title { font-size: 13px; font-weight: 500; margin-bottom: 8px; word-break: break-word; line-height: 1.4; }
.card-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-meta .avatar { width: 22px; height: 22px; font-size: 10px; }
.card-due { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 3px; }
.card-due.overdue { color: #e2435c; } .card-due.soon { color: #fdab3d; }
.card-due svg { width: 11px; height: 11px; }
.card-comments { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 2px; }
.card-comments svg { width: 12px; height: 12px; }
.card-creator { margin-left: auto; display: flex; align-items: center; }
.card-creator .avatar { width: 18px; height: 18px; font-size: 9px; border: 1.5px solid var(--bg-surface); }
.kanban-empty-col { text-align: center; padding: 20px 8px; font-size: 12px; color: var(--text-muted); border: 1px dashed var(--border); border-radius: var(--radius-sm); }

/* ===================== Dashboard ===================== */
.dashboard-view { flex: 1; overflow-y: auto; padding: 16px; -webkit-overflow-scrolling: touch; }
.dashboard-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.dashboard-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.dashboard-card .label { font-size: 12px; color: var(--text-secondary); font-weight: 500; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.dashboard-card .value { font-size: 28px; font-weight: 700; color: var(--text-primary); }
.dashboard-card .dot { width: 8px; height: 8px; border-radius: 50%; }
.dashboard-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.chart-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; min-height: 300px; }
.chart-card .chart-title { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.chart-wrapper { position: relative; height: 240px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; font-size: 12px; color: var(--text-secondary); }
.chart-legend-item { display: flex; align-items: center; gap: 4px; }
.chart-legend-color { width: 10px; height: 10px; border-radius: 50%; }

@media (max-width: 1024px) {
  .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-charts { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .dashboard-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .dashboard-card { padding: 12px; }
  .dashboard-card .value { font-size: 22px; }
  .chart-card { min-height: 260px; }
  .chart-wrapper { height: 200px; }
}

/* ===================== Modal ===================== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: none; align-items: center; justify-content: center; z-index: 1000; opacity: 0; transition: opacity 0.2s; padding: 16px; }
.modal-overlay.show { display: flex; opacity: 1; }
.modal { background: var(--bg-surface); border-radius: 12px; width: 560px; max-width: 100%; max-height: 90vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); transform: scale(0.96); transition: transform 0.2s; }
.modal-overlay.show .modal { transform: scale(1); }
/* 桌面端启用拖拽后，弹窗改为 fixed 定位并脱离 flex 居中 */
.modal.modal-drag-enabled { position: fixed; transform: scale(1); transition: transform 0.2s, left 0s, top 0s; }
.modal.modal-drag-enabled.dragging { transition: none; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 16px 36px; border-bottom: 1px solid var(--border-light); flex-shrink: 0; cursor: move; user-select: none; -webkit-user-select: none; position: relative; }
.modal-header::before { content: "\22EE\22EE"; position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 12px; letter-spacing: 1px; line-height: 1; pointer-events: none; opacity: 0.7; }
.modal-header h2 { font-size: 16px; font-weight: 600; }
.modal-close { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 4px; color: var(--text-muted); font-size: 22px; position: relative; z-index: 2; cursor: pointer; }
[data-theme="dark"] .modal-close { color: var(--text-secondary); }
.modal-close:active { background: var(--bg-hover); color: var(--text-primary); }
/* 里程碑分组卡片 */
.milestone-section { border: 1px solid var(--border-light); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 16px; background: var(--bg-app); }
.milestone-toggle { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.check-inline { display: flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 600; font-size: 13px; user-select: none; -webkit-user-select: none; }
.check-inline input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.milestone-desc { font-size: 12px; color: var(--text-muted); }
.milestone-constraint-row { display: none; gap: 14px; margin-top: 12px; }
.milestone-section.is-milestone .milestone-constraint-row { display: flex; }
.milestone-section.is-milestone { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--bg-app)); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; -webkit-overflow-scrolling: touch; }
.modal-footer { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-top: 1px solid var(--border-light); flex-shrink: 0; gap: 10px; }
/* 项目设置：开关行 */
.setting-row { display: flex; align-items: flex-start; gap: 14px; padding: 4px 0 8px; }
.setting-text { flex: 1; min-width: 0; }
.setting-title { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 5px; }
.setting-desc { font-size: 12px; line-height: 1.6; color: var(--text-secondary); }
.setting-switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; margin-top: 2px; cursor: pointer; }
.setting-switch input { opacity: 0; width: 0; height: 0; }
.setting-slider { position: absolute; inset: 0; background: var(--border, #c4c4c4); border-radius: 22px; transition: background .18s; }
.setting-slider::before { content: ''; position: absolute; width: 18px; height: 18px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: transform .18s; }
.setting-switch input:checked + .setting-slider { background: var(--accent, #6554c0); }
.setting-switch input:checked + .setting-slider::before { transform: translateX(18px); }
.mobile-create-project-btn { display: none; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-app); color: var(--text-primary); font-size: 14px; transition: border-color 0.15s; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--accent); background: var(--bg-surface); }
/* 负责人下拉内联创建占位人时的输入框（与 select 视觉对齐）*/
.edit-owner-inline { width: 100%; padding: 10px 12px; border: 1px solid var(--accent); border-radius: var(--radius-sm); background: var(--bg-app); color: var(--text-primary); font-size: 14px; outline: none; box-shadow: 0 0 0 3px var(--accent-light); }
.form-group input[type="date"]::-webkit-calendar-picker-indicator, input[type="datetime-local"]::-webkit-calendar-picker-indicator { background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E"); background-size: 16px; background-position: center; background-repeat: no-repeat; width: 16px; height: 16px; cursor: pointer; }
[data-theme="dark"] .form-group input[type="date"]::-webkit-calendar-picker-indicator, input[type="datetime-local"]::-webkit-calendar-picker-indicator { background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23e5e7eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E"); }
.form-row { display: flex; gap: 14px; }
.form-row .form-group { flex: 1; }
.created-by-display { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--bg-app); border-radius: var(--radius-sm); }
.created-by-display .avatar { width: 28px; height: 28px; font-size: 12px; }
.created-by-display span { font-size: 13px; }

.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-app);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
}
.form-group textarea:focus { outline: none; border-color: var(--accent); }
.form-group textarea::placeholder { color: var(--text-muted); }
[data-theme="dark"] ::placeholder { color: var(--text-secondary); opacity: 1; }

.comments-section { margin-top: 8px; }
.comments-section h3 { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.comments-list { display: flex; flex-direction: column; gap: 10px; max-height: 240px; overflow-y: auto; margin-bottom: 12px; -webkit-overflow-scrolling: touch; }
.comment-item { display: flex; gap: 10px; padding: 10px; background: var(--bg-app); border-radius: var(--radius-sm); }
.comment-item .avatar { width: 28px; height: 28px; font-size: 11px; }
.comment-body { flex: 1; }
.comment-meta { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.comment-author { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.comment-time { font-size: 11px; color: var(--text-muted); }
.comment-text { font-size: 13px; color: var(--text-primary); line-height: 1.4; word-break: break-word; }
.comment-input-wrapper { display: flex; gap: 8px; align-items: center; }
.comment-input-wrapper .avatar { width: 28px; height: 28px; font-size: 11px; }
.comment-input-wrapper input { flex: 1; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-app); color: var(--text-primary); font-size: 14px; }
.comment-input-wrapper input:focus { outline: none; border-color: var(--accent); }
.comment-input-wrapper button { padding: 10px 16px; background: var(--accent); color: #fff; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; white-space: nowrap; }
.comment-input-wrapper button:active { transform: scale(0.96); }
.comments-empty { text-align: center; color: var(--text-muted); font-size: 12px; padding: 16px; }

/* Members modal */
.invite-section { margin-bottom: 20px; }
.invite-input-wrapper { display: flex; gap: 8px; }
.invite-input-wrapper input { flex: 1; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-app); color: var(--text-primary); font-size: 14px; }
.invite-input-wrapper input:focus { outline: none; border-color: var(--accent); }
.invite-input-wrapper button { padding: 10px 16px; background: var(--accent); color: #fff; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; white-space: nowrap; }
.invite-input-wrapper button:active { transform: scale(0.96); }
.members-list { display: flex; flex-direction: column; gap: 8px; }
.member-item { display: flex; align-items: center; gap: 12px; padding: 10px; background: var(--bg-app); border-radius: var(--radius-sm); }
.member-item .avatar { width: 36px; height: 36px; font-size: 14px; }
.member-info { flex: 1; min-width: 0; }
.member-name { font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.member-account { font-size: 11px; color: var(--text-muted); word-break: break-all; }
.role-tag { font-size: 10px; padding: 1px 6px; border-radius: 8px; background: var(--accent-light); color: var(--accent); font-weight: 600; }
.member-role { flex-shrink: 0; }
.role-select { padding: 5px 8px; font-size: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-surface); color: var(--text-primary); cursor: pointer; }
.member-actions { flex-shrink: 0; }
.member-remove { padding: 5px 10px; font-size: 12px; border: 1px solid var(--danger, #e5484d); color: var(--danger, #e5484d); background: transparent; border-radius: var(--radius-sm); cursor: pointer; }
.member-remove:hover { background: var(--danger, #e5484d); color: #fff; }
.members-footer { display: flex; justify-content: flex-end; padding-top: 12px; margin-top: 8px; border-top: 1px solid var(--border); }
.btn-ghost-danger { color: var(--danger, #e5484d); border: 1px solid var(--border); background: transparent; }
.btn-ghost-danger:hover { background: var(--danger, #e5484d); color: #fff; }
.invite-revoke { margin-left: 6px; padding: 2px 8px; font-size: 11px; border: 1px solid var(--border); background: transparent; color: var(--text-muted); border-radius: 6px; cursor: pointer; }
.invite-revoke:hover { border-color: var(--danger, #e5484d); color: var(--danger, #e5484d); }
.pending-header { font-size: 12px; font-weight: 600; color: var(--text-secondary); margin: 16px 0 8px; }
.pending-invite-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; background: var(--bg-app); border-radius: var(--radius-sm); font-size: 12px; }
.pending-status { color: var(--text-muted); font-size: 11px; }

/* ===================== Popover ===================== */
.popover { position: fixed; z-index: 2000; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-md); padding: 4px; display: none; min-width: 160px; max-height: 320px; overflow-y: auto; }
.popover.show { display: block; animation: popIn 0.12s ease; }
@keyframes popIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.popover-item { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px; cursor: pointer; transition: background 0.1s; width: 100%; text-align: left; }
.popover-item:active { background: var(--bg-hover); }
.popover-item:hover { background: var(--bg-hover); }
.popover-item .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.popover-item .mini-avatar { width: 20px; height: 20px; border-radius: 50%; font-size: 10px; font-weight: 600; color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.popover-item.active { background: var(--accent-light); color: var(--accent); }
.popover-sep { border-top: 1px solid var(--border-light); margin: 4px 0; }
.popover-item.danger { color: #e2435c; }
.popover-rename-btn { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 4px; color: var(--text-muted); opacity: 0; transition: opacity 0.12s, background 0.12s, color 0.12s; flex-shrink: 0; }
.popover-project-row:hover .popover-rename-btn { opacity: 1; }
.popover-rename-btn:hover { background: var(--bg-hover); color: var(--accent); }
.popover-project-row.renaming { background: var(--bg-hover); }
/* 日期选择器 popover */
#date-picker-popover { width: 320px; max-height: 90vh; padding: 0; }
.dp-wrap { padding: 8px 10px; position: relative; }
.dp-close { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; border: none; background: transparent; color: var(--text-muted); font-size: 18px; line-height: 1; border-radius: 4px; cursor: pointer; z-index: 2; }
.dp-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.dp-input { width: 100%; box-sizing: border-box; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; font-family: inherit; background: var(--bg-surface); color: var(--text-primary); outline: none; }
.dp-input::-webkit-calendar-picker-indicator { opacity: 0.65; cursor: pointer; }
[data-theme="dark"] .dp-input::-webkit-calendar-picker-indicator { filter: invert(1); opacity: 0.85; }
.dp-input:focus { border-color: var(--accent); }
.dp-actions { display: flex; gap: 8px; margin-top: 8px; }
.dp-btn { flex: 1; padding: 6px 0; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; background: var(--bg-surface); color: var(--text-primary); cursor: pointer; transition: background 0.1s; font-family: inherit; }
.dp-btn:hover { background: var(--bg-hover); }
.dp-btn.dp-clear { color: #e2435c; }
.dp-btn.dp-confirm { background: #5b5fc7; color: #fff; border-color: #5b5fc7; font-weight: 600; }
.dp-btn.dp-confirm:hover { background: #484bb3; }
/* 双日期 popover (timeline) */
.dp-label { cursor: move; font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; user-select: none; -webkit-user-select: none; touch-action: none; position: relative; padding-left: 18px; }
.dp-label::before { content: '⋮⋮'; position: absolute; left: 2px; top: 50%; transform: translateY(-50%); font-size: 11px; color: var(--text-muted); letter-spacing: -2px; opacity: 0.7; }
.dp-label:hover { color: var(--accent); }
.dp-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.dp-row label { font-size: 12px; color: var(--text-secondary); min-width: 32px; flex-shrink: 0; }
.dp-row .dp-input { flex: 1; min-width: 0; }

/* 自绘日历网格 */
.dp-cal { margin-top: 6px; }
.dp-header { display: flex; align-items: center; justify-content: space-between; padding: 4px 0; }
.dp-header button { background: none; border: none; cursor: pointer; padding: 4px 8px; border-radius: 4px; color: var(--text-secondary); font-size: 14px; }
.dp-header button:hover { background: var(--bg-hover); color: var(--text-primary); }
.dp-header span { font-weight: 600; font-size: 13px; color: var(--text-primary); }
.dp-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 11px; color: var(--text-muted); padding: 4px 0 2px; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-day { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 6px; font-size: 13px; cursor: pointer; border: none; background: transparent; color: var(--text-primary); transition: all 0.1s; font-family: inherit; }
.dp-day:hover { background: var(--bg-hover); }
.dp-day.dp-other-month { color: var(--text-muted); opacity: 0.4; }
.dp-day.dp-today { font-weight: 700; position: relative; }
.dp-day.dp-today::after { content: ''; position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%); width: 4px; height: 4px; border-radius: 50%; background: #5b5fc7; }
.dp-day.dp-selected { background: #5b5fc7 !important; color: #fff !important; font-weight: 600; }
.dp-day.dp-selected:hover { background: #484bb3 !important; }
.dp-day.dp-in-range { background: rgba(91,95,199,0.12); border-radius: 0; }
.dp-day.dp-range-start { border-radius: 6px 0 0 6px; background: rgba(91,95,199,0.2); }
.dp-day.dp-range-end { border-radius: 0 6px 6px 0; background: rgba(91,95,199,0.2); }
.popover-rename-input { width: 100%; padding: 4px 6px; border: 1px solid var(--accent); border-radius: 4px; font-size: 14px; background: var(--bg-surface); color: var(--text-primary); outline: none; font-family: inherit; }

/* ===================== 快速评论浮层 ===================== */
#quick-comment-popover { width: 320px; max-height: 70vh; padding: 0; overflow: hidden; }
#quick-comment-popover.show { display: flex; flex-direction: column; }
.qc-header { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--border-light); }
.qc-open-task { flex: 1; min-width: 0; text-align: left; background: transparent; border: none; color: var(--text-primary); font-size: 13px; font-weight: 600; cursor: pointer; padding: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qc-open-task:hover { color: var(--accent); }
.qc-close { width: 22px; height: 22px; flex-shrink: 0; border: none; border-radius: 50%; background: transparent; color: var(--text-muted); font-size: 16px; line-height: 1; cursor: pointer; transition: background 0.15s, color 0.15s; }
.qc-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.qc-list { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 10px; max-height: calc(70vh - 110px); -webkit-overflow-scrolling: touch; }
.qc-input { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-top: 1px solid var(--border-light); }
.qc-input .avatar { width: 28px; height: 28px; font-size: 11px; flex-shrink: 0; }
.qc-input .qc-text { flex: 1; min-width: 0; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-app); color: var(--text-primary); font-size: 14px; font-family: inherit; }
.qc-input .qc-text:focus { outline: none; border-color: var(--accent); }
.qc-input .qc-send { padding: 9px 14px; background: var(--accent); color: #fff; border: none; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; white-space: nowrap; cursor: pointer; }
.qc-input .qc-send:active { transform: scale(0.96); }

/* ===================== Context Menu ===================== */
.context-menu { position: fixed; z-index: 2500; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); padding: 6px; display: none; min-width: 200px; max-height: calc(100vh - 16px); overflow-y: auto; }
.context-menu-close { position: absolute; top: 6px; right: 6px; width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; border: none; border-radius: 50%; background: transparent; color: var(--text-muted); font-size: 15px; line-height: 1; cursor: pointer; transition: background 0.15s, color 0.15s; }
.context-menu-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.context-menu-item:first-of-type { padding-right: 30px; }
.context-menu.show { display: block; animation: popIn 0.12s ease; }
.context-menu-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm); font-size: 13px; cursor: pointer; transition: background 0.1s; color: var(--text-primary); user-select: none; }
.context-menu-item:hover { background: var(--bg-hover); }
.context-menu-item:active { background: var(--bg-selected); }
.context-menu-item svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--text-secondary); }
.context-menu-item.danger { color: #e2435c; }
.context-menu-item.danger svg { color: #e2435c; }
.context-menu-item.disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
.set-parent-search { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-input); color: var(--text-primary); font-size: 13px; margin-bottom: 10px; box-sizing: border-box; }
.set-parent-list { max-height: 50vh; overflow-y: auto; }
.set-parent-item { display: flex; align-items: center; padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--text-primary); }
.set-parent-item:hover { background: var(--bg-hover); }
.set-parent-item.disabled { opacity: 0.35; cursor: not-allowed; pointer-events: none; }
.set-parent-item .lv { white-space: pre; }
.set-parent-empty { padding: 14px 10px; color: var(--text-muted); font-size: 13px; }
.context-menu-separator { height: 1px; background: var(--border-light); margin: 5px 6px; }

/* ===================== Toast ===================== */
.toast-container { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 3000; display: flex; flex-direction: column; gap: 8px; align-items: center; width: 90%; max-width: 400px; }
.toast { padding: 10px 20px; background: var(--text-primary); color: var(--bg-surface); border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; box-shadow: var(--shadow-md); opacity: 0; transform: translateY(10px); transition: all 0.25s; text-align: center; }
.toast.show { opacity: 1; transform: translateY(0); }

/* ===================== Snackbar（Gmail 风格：即时操作 + 撤销） ===================== */
/* bottom 52px：避开桌面端底部 app-footer（约 35px 高，z-index 100） */
.snackbar-host { position: fixed; bottom: 52px; left: 50%; transform: translateX(-50%); z-index: 3100; width: 92%; max-width: 460px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.snackbar {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 12px 8px 12px 16px; overflow: hidden;
  background: var(--bg-surface); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md); pointer-events: auto;
  opacity: 0; transform: translateY(16px);
  transition: opacity .22s ease, transform .22s cubic-bezier(.4,0,.2,1);
}
.snackbar.show { opacity: 1; transform: translateY(0); }
.snackbar-icon { flex: 0 0 auto; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 12px; line-height: 1; }
.snackbar-icon.danger { background: rgba(239,68,68,.14); }
.snackbar-icon.info { background: rgba(91,95,199,.14); }
.snackbar-msg { flex: 1 1 auto; min-width: 0; font-size: 13px; font-weight: 500; line-height: 1.45; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.snackbar-action {
  flex: 0 0 auto; padding: 6px 14px; border: none; border-radius: 6px; cursor: pointer;
  background: transparent; color: var(--accent); font-size: 13px; font-weight: 700;
  letter-spacing: .3px; transition: background .15s;
}
.snackbar-action:hover { background: var(--bg-hover); }
.snackbar-action:active { transform: scale(.96); }
.snackbar-close { flex: 0 0 auto; width: 24px; height: 24px; border: none; background: transparent; color: var(--text-muted); font-size: 16px; line-height: 1; cursor: pointer; border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; }
.snackbar-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.snackbar-progress { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--accent); width: 100%; transform-origin: left center; animation: snackbar-countdown linear forwards; }
@keyframes snackbar-countdown { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ===================== Footer ===================== */
.auth-footer { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 0; font-size: 12px; color: rgba(255,255,255,0.9); width: 100%; flex-shrink: 0; text-shadow: 0 1px 2px rgba(0,0,0,0.2); }
.auth-footer a { color: #fff; text-decoration: none; font-weight: 500; transition: color 0.15s; }
.auth-footer a:hover { color: #fff; text-decoration: underline; }
.app-footer { position: fixed; bottom: 0; left: 0; right: 0; z-index: 100; display: flex; justify-content: center; align-items: center; gap: 16px; padding: 9px 12px; font-size: 12px; font-weight: 600; color: #ffffff; background: #1f2937; border-top: 1px solid #374151; transition: transform 0.25s ease, opacity 0.2s ease, visibility 0s linear 0.25s; }
.app-footer.footer-hidden { display: none !important; }
.app-footer a { color: #ffffff; text-decoration: none; transition: opacity 0.15s; }
.app-footer a:hover { opacity: 0.85; text-decoration: underline; }

/* ===================== 甘特图 ===================== */
.gantt-container { display: flex; height: 100%; min-height: 0; position: relative; }
.gantt-left { width: 260px; flex-shrink: 0; border-right: 1px solid var(--border); background: var(--bg-surface); display: flex; flex-direction: column; overflow: hidden; }
.gantt-left-header { padding: 10px 12px; font-weight: 600; font-size: 13px; border-bottom: 1px solid var(--border); flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.gantt-left-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gantt-left-collapse, .gantt-left-expand { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-app); color: var(--text-secondary); font-size: 10px; line-height: 1; cursor: pointer; transition: all .15s; flex-shrink: 0; }
.gantt-left-collapse:hover, .gantt-left-expand:hover { background: var(--bg-hover); border-color: var(--accent); color: var(--accent); }
.gantt-left-collapse:active, .gantt-left-expand:active { transform: scale(.92); }
.gantt-left-expand { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); z-index: 20; opacity: 0; pointer-events: none; box-shadow: var(--shadow-md); }
.gantt-container.left-collapsed .gantt-left-expand { opacity: 1; pointer-events: auto; }
.gantt-tree { flex: 1; overflow-y: auto; }
.gantt-tree-row { display: flex; align-items: center; gap: 4px; font-size: 13px; padding-right: 8px; border-bottom: 1px solid var(--border-light); cursor: pointer; height: 34px; min-height: 34px; max-height: 34px; overflow: hidden; box-sizing: border-box; }
.gantt-tree-row:hover { background: var(--bg-hover); }
.gantt-caret { width: 14px; text-align: center; color: var(--text-secondary); cursor: pointer; user-select: none; flex-shrink: 0; }
.gantt-caret-spacer { width: 14px; display: inline-block; flex-shrink: 0; }
.gantt-tree-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.gantt-right { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; background: var(--bg-app); position: relative; }
.gantt-toolbar { position: relative; flex-shrink: 0; z-index: 30; display: flex; align-items: center; gap: 4px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 8px; margin: 8px 12px 0; padding: 4px 8px; box-shadow: var(--shadow-md); }
.gantt-zoom-btn { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-app); color: var(--text-primary); font-size: 16px; font-weight: 600; cursor: pointer; transition: all .15s; user-select: none; line-height: 1; }
.gantt-zoom-btn:hover { background: var(--bg-hover); border-color: var(--accent); color: var(--accent); }
.gantt-zoom-btn:active { transform: scale(.92); }
.gantt-zoom-pct { font-size: 12px; font-weight: 600; color: var(--text-secondary); min-width: 46px; text-align: center; user-select: none; }
.gantt-autofit-btn { width: auto; padding: 0 10px; font-size: 12px; letter-spacing: 0.5px; }
.gantt-link-btn { width: auto; padding: 0 10px; font-size: 12px; font-weight: 600; }
.gantt-link-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.gantt-link-chip { display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px; background: color-mix(in srgb, var(--accent) 15%, transparent); border: 1px solid var(--accent); border-radius: 12px; font-size: 11px; font-weight: 600; color: var(--accent); white-space: nowrap; cursor: pointer; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.gantt-link-chip:hover { background: color-mix(in srgb, var(--accent) 25%, transparent); }
.gantt-undo-btn, .gantt-redo-btn { width: 30px; font-size: 15px; }
.gantt-undo-btn:disabled, .gantt-redo-btn:disabled { opacity: .35; cursor: not-allowed; }
/* 依赖连线：可见细线 + 透明粗线作为点击热区 */
.gantt-dep { fill: none; stroke: #94a3b8; stroke-width: 2; pointer-events: none; transition: stroke .12s; }
.gantt-dep-hit { fill: none; stroke: transparent; stroke-width: 12; cursor: pointer; pointer-events: stroke; }
.gantt-dep-hit:hover + .gantt-dep, .gantt-dep:hover { stroke: var(--accent); stroke-width: 3; }
.gantt-dep-selected { stroke: #ef4444 !important; stroke-width: 3 !important; }
/* 连线右键/点击菜单 */
.gantt-dep-menu {
  position: fixed; z-index: 1200; min-width: 160px; background: var(--bg-app);
  border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.18);
  padding: 8px; font-size: 12px;
}
.gantt-dep-menu-info { color: var(--text-secondary); padding: 2px 6px 8px; line-height: 1.5; word-break: break-all; }
.gantt-dep-menu-del {
  width: 100%; text-align: left; border: none; background: transparent; color: #ef4444;
  padding: 7px 6px; border-radius: 6px; cursor: pointer; font-size: 12px; font-weight: 600;
}
.gantt-dep-menu-del:hover { background: rgba(239,68,68,.1); }
.gantt-colorby {
  height: 28px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg-app); color: var(--text-primary); font-size: 12px;
  padding: 0 22px 0 8px; cursor: pointer; outline: none;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23ffffff' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 10px 6px;
}
.gantt-colorby:hover { border-color: var(--accent); }
[data-theme="light"] .gantt-colorby {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%234b5563' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
}
.gantt-list-toggle { display: inline-flex; width: 28px; padding: 0; font-size: 15px; color: var(--text-secondary); }
.gantt-list-toggle:hover { color: var(--accent); border-color: var(--accent); }
.gantt-list-toggle.active { background: var(--accent); color: #fff; border-color: var(--accent); }
@media (min-width: 769px) { .gantt-list-toggle { display: none; } }
.gantt-btn-icon { display: inline-flex; align-items: center; justify-content: center; }
.gantt-btn-label { margin-left: 4px; }
/* 桌面端：收起任务树（整列消失，右侧时间轴自动占满） */
.gantt-container.left-collapsed .gantt-left { display: none; }
.gantt-colorby-prefix { font-size: 11px; color: var(--text-secondary); white-space: nowrap; user-select: none; flex-shrink: 0; }
.gantt-body.gantt-link-mode .gantt-bar,
.gantt-body.gantt-link-mode .gantt-milestone { cursor: crosshair; }
.gantt-link-source { outline: 3px solid var(--accent); outline-offset: 1px; border-radius: 3px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.gantt-timeline { flex: 1; position: relative; overflow: auto; display: flex; flex-direction: column; }
/* 电脑端鼠标拖拽平移甘特图（参考 WPS / XMind） */
.gantt-timeline.pannable { cursor: grab; user-select: none; -webkit-user-select: none; }
.gantt-timeline.pannable.panning { cursor: grabbing; }
.gantt-timeline.pannable.panning * { pointer-events: none; }
.gantt-header-row { position: sticky; top: 0; z-index: 5; flex-shrink: 0; background: var(--bg-surface); border-bottom: 1px solid var(--border); }
.gantt-months { display: flex; height: 20px; }
.gantt-month { flex-shrink: 0; font-size: 11px; font-weight: 600; color: var(--text-secondary); border-right: 1px solid var(--border-light); line-height: 20px; padding-left: 6px; box-sizing: border-box; }
.gantt-days { display: flex; height: 20px; }
.gantt-day { flex-shrink: 0; font-size: 10px; text-align: center; color: var(--text-muted); border-right: 1px solid var(--border-light); line-height: 20px; box-sizing: border-box; }
.gantt-day.weekend { background: rgba(0,0,0,0.04); }
.gantt-day.today { background: rgba(37,99,235,0.15); color: var(--accent); font-weight: 700; }
.gantt-body { position: relative; }
.gantt-svg { position: absolute; top: 0; left: 0; pointer-events: none; }
.gantt-bar { position: absolute; height: 18px; border-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,0.15); cursor: pointer; display: flex; align-items: center; overflow: hidden; }
.gantt-bar-label { font-size: 11px; color: #fff; padding: 0 6px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.gantt-bar.label-outside { overflow: visible; z-index: 2; }
.gantt-bar.label-outside .gantt-bar-label { position: absolute; left: 100%; top: 0; height: 100%; padding-left: 6px; color: var(--text-primary); background: transparent; overflow: visible; text-overflow: unset; }
.gantt-bar.point { width: 10px; height: 18px; border-radius: 5px; overflow: visible; }
.gantt-bar.point .gantt-bar-label,
.gantt-milestone .gantt-bar-label { position: absolute; left: 14px; top: 0; height: 100%; padding-left: 4px; color: var(--text-primary); background: transparent; white-space: nowrap; pointer-events: none; overflow: visible; text-overflow: unset; font-size: 11px; display: flex; align-items: center; }
.gantt-no-date { position: absolute; left: 6px; height: 18px; display: flex; align-items: center; color: var(--text-primary); font-size: 11px; white-space: nowrap; cursor: pointer; pointer-events: auto; }
.gantt-dep { fill: none; stroke: #94a3b8; stroke-width: 1.5; }
.gantt-today-line { stroke: #2563eb; stroke-width: 1.5; stroke-dasharray: 4 3; }
.rollup-badge { margin-left: 8px; font-size: 11px; color: var(--text-secondary); background: var(--bg-hover); padding: 1px 6px; border-radius: 10px; }

/* ===================== 依赖关系（任务弹窗）===================== */
.deps-section { margin-top: 14px; border-top: 1px solid var(--border-light); padding-top: 12px; }
.deps-section h3 { font-size: 13px; margin-bottom: 8px; }
.dependencies-section { padding-top: 8px; }
.deps-block { margin-top: 14px; border-top: 1px solid var(--border-light); padding-top: 12px; }
.deps-block:first-child { margin-top: 0; border-top: none; padding-top: 0; }
.deps-block h3 { font-size: 13px; margin-bottom: 8px; }
.dep-ms { color: var(--accent); margin-right: 3px; font-weight: 700; }
.deps-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.deps-empty { font-size: 12px; color: var(--text-muted); }
.dep-item { display: flex; align-items: center; gap: 8px; font-size: 12px; background: var(--bg-hover); padding: 4px 8px; border-radius: 6px; }
.dep-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dep-type { color: var(--text-secondary); font-size: 11px; }
.dep-remove { border: none; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 16px; line-height: 1; }
.dep-remove:hover { color: var(--accent); }
.deps-add { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.deps-add select, .deps-add input { padding: 4px 6px; font-size: 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-surface); color: var(--text-primary); }
.dep-pending-hint { margin-top: 8px; font-size: 12px; color: var(--accent); padding: 6px 10px; border-radius: 6px; background: rgba(127,127,127,0.12); }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; background: var(--accent); color: #fff; border: none; cursor: pointer; }
.btn-sm:hover { opacity: 0.9; }
.beian-row { display: inline-flex; align-items: center; gap: 5px; }
.beian-icon { width: 16px; height: 16px; flex-shrink: 0; }

/* ===================== Mobile Bottom Nav ===================== */
.mobile-nav { display: none; position: fixed; bottom: 0; left: 0; right: 0; height: 56px; background: var(--bg-surface); border-top: 1px solid var(--border); z-index: 210; justify-content: space-around; align-items: center; padding-bottom: env(safe-area-inset-bottom); }
.mobile-nav button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 12px; color: var(--text-muted); font-size: 10px; border-radius: 8px; }
.mobile-nav button.active { color: var(--accent); }
.mobile-nav button svg { width: 22px; height: 22px; }

/* ===================== Mobile Filter Panel ===================== */
.mobile-filter-panel { display: none; position: fixed; top: var(--header-h); left: 0; right: 0; background: var(--bg-surface); border-bottom: 1px solid var(--border); padding: 12px; gap: 8px; flex-direction: column; z-index: 90; box-shadow: var(--shadow-md); }
.mobile-filter-panel.show { display: flex; }
.mobile-filter-panel .search-box { width: 100%; }
.mobile-filter-panel .filter-select { width: 100%; }

/* ===================== Mobile Card List (2026-08-23) ===================== */
/* 卡片流容器：仅移动端显示 */
.task-cards { display: none; }
/* ⋯ 溢出菜单：仅移动端显示入口 */
.mobile-more-btn { display: none; }
/* FAB 单独样式（在 mobile-nav 内） */
.mnav-fab { position: relative; }
.mnav-fab::before {
  content: ''; position: absolute; inset: -14px; border-radius: 50%;
}
/* 长按底部 Sheet */
.mobile-sheet-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 2500; opacity: 0; transition: opacity 0.2s; }
.mobile-sheet-overlay.show { display: block; opacity: 1; }
.mobile-action-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 2501;
  background: var(--bg-surface); border-radius: 16px 16px 0 0;
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom));
  transform: translateY(110%); transition: transform 0.25s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 -8px 32px rgba(0,0,0,0.18);
  max-height: 70vh; overflow-y: auto;
}
.mobile-action-sheet.show { transform: translateY(0); }
.sheet-handle { width: 36px; height: 4px; border-radius: 2px; background: var(--border); margin: 4px auto 10px; }
.sheet-title { font-size: 13px; font-weight: 600; color: var(--text-secondary); text-align: center; margin-bottom: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-items { display: flex; flex-direction: column; gap: 2px; }
.sheet-items button {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 13px 12px; border-radius: 10px; font-size: 15px; color: var(--text-primary);
  text-align: left; background: transparent;
}
.sheet-items button:active { background: var(--bg-hover); }
.sheet-items button svg { width: 20px; height: 20px; color: var(--text-secondary); flex-shrink: 0; }
.sheet-items button.danger { color: #e2435c; }
.sheet-items button.danger svg { color: #e2435c; }
.sheet-cancel { display: block; width: 100%; padding: 13px; margin-top: 8px; border-radius: 10px; font-size: 15px; font-weight: 600; color: var(--text-secondary); background: var(--bg-app); }
.sheet-cancel:active { background: var(--bg-hover); }
/* ⋯ 菜单弹层 */
.mobile-more-menu {
  display: none; position: fixed; top: calc(var(--header-h) + 4px); right: 8px; z-index: 1200;
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 6px; min-width: 150px;
  transform: scale(0.92); transform-origin: top right; opacity: 0; pointer-events: none;
  transition: transform 0.15s, opacity 0.15s;
}
.mobile-more-menu.show { display: block; transform: scale(1); opacity: 1; pointer-events: auto; }
.mobile-more-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; border-radius: 8px; font-size: 14px; color: var(--text-primary); text-align: left;
}
.mobile-more-menu button:active { background: var(--bg-hover); }
.mobile-more-menu button svg { width: 18px; height: 18px; color: var(--text-secondary); }

/* ===================== Responsive ===================== */

/* Tablet (<= 1024px) */
@media (max-width: 1024px) {
  .search-box { width: 140px; }
  .user-btn .un { display: none; }
  .logo span { display: none; }
}

/* Mobile (<= 768px) */
@media (max-width: 768px) {
  :root { --header-h: 52px; }

  /* Header: collapse to single row on mobile */
  .app-header { }
  .header-row { padding: 0 8px; gap: 4px; }
  .header-row-top { height: var(--header-h); }
  .header-row-bottom { display: none; }
  .mobile-menu-btn { display: flex; }
  .logo svg { width: 22px; height: 22px; }
  .logo { font-size: 16px; }
  .project-selector { padding: 4px 8px; }
  .project-selector .pn { font-size: 12px; max-width: 80px; }
  .header-row-right .btn-icon span { display: none; }

  /* Show mobile elements */
  .mobile-nav { display: flex; }

  /* Adjust main content for bottom nav */
  #app { padding-bottom: 56px; }
  .main-content { padding-bottom: 0; }
  .task-cards { padding-bottom: 0; }
  /* 移动端备案 footer：默认藏在屏幕最底部，滚动到底时从底部导航下方升起 */
  .app-footer {
    bottom: 0;
    left: 0; right: 0;
    z-index: 190;
    gap: 12px; flex-wrap: wrap;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
    border-radius: 0;
    transform: translateY(100%);
  }
  .app-footer.footer-hidden { transform: translateY(100%) !important; }
  .app-footer:not(.footer-hidden) { transform: translateY(0); }
  .auth-footer { gap: 4px; }

  /* Mobile filter panel */
  .mobile-filter-panel .search-box { width: 100%; }

  /* Table - make it scrollable */
  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .task-table { min-width: 800px; }

  /* ===== 移动端卡片流（2026-08-23）：表格隐藏，卡片显示 ===== */
  body.mobile-cards .table-wrapper { display: none; }
  body.mobile-cards .task-cards {
    display: flex; flex-direction: column; flex: 1; overflow-y: auto;
    -webkit-overflow-scrolling: touch; padding: 10px 12px 150px; gap: 8px;
    background: var(--bg-app);
  }
  body.mobile-cards .group-header { padding: 8px 12px 4px; }
  body.mobile-cards .group-progress .progress-bar { width: 60px; }

  /* 单张任务卡 */
  .task-card {
    position: relative; background: var(--bg-surface); border-radius: 12px;
    padding: 0; box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light); overflow: visible;
    transition: transform 0.18s cubic-bezier(.4,0,.2,1);
    touch-action: pan-y; user-select: none; -webkit-user-select: none;
  }
  .task-card:active { background: var(--bg-hover); }
  .task-card.dragging-x { transition: none; }
  /* 项目/分组色条 */
  .task-card::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
    background: var(--card-accent, var(--border-light)); z-index: 2;
  }
  /* swipe 底层操作按钮区 */
  .task-card-swipe-bg {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: flex-end;
    padding: 0 20px; gap: 24px; border-radius: 12px; z-index: 0;
  }
  .task-card-swipe-bg.left { background: #00c875; color: #fff; justify-content: flex-start; }
  .task-card-swipe-bg.right { background: #e2435c; color: #fff; justify-content: flex-end; }
  .task-card-swipe-bg .swipe-label { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
  .task-card-swipe-bg svg { width: 18px; height: 18px; }
  .task-card-main { position: relative; z-index: 1; background: var(--bg-surface); border-radius: 12px; padding: 10px 12px 10px 15px; }
  .task-card.done .tc-title { color: var(--text-muted); text-decoration: line-through; }

  /* 第一行：勾选 + 标题 */
  .tc-row1 { display: flex; align-items: flex-start; gap: 10px; }
  .tc-check { flex-shrink: 0; margin-top: 1px; }
  .tc-check input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); }
  .tc-body { flex: 1; min-width: 0; }
  .tc-title {
    font-size: 15px; font-weight: 600; line-height: 1.35; color: var(--text-primary);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; word-break: break-word;
  }
  .tc-title .ms-tag { color: var(--accent); margin-right: 4px; }
  .tc-badges { display: flex; align-items: center; gap: 6px; margin-top: 2px; flex-wrap: wrap; }
  .tc-sub-count { font-size: 11px; color: var(--text-secondary); background: var(--bg-hover); padding: 1px 8px; border-radius: 10px; }
  .tc-comment-count { font-size: 11px; color: var(--text-secondary); display: inline-flex; align-items: center; gap: 3px; }
  .tc-comment-count svg { width: 12px; height: 12px; }

  /* 第二行：meta chips（负责人 · 状态 · 优先级 · 截止）*/
  .tc-row2 { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
  .tc-meta { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-secondary); }
  .tc-meta .avatar { width: 20px; height: 20px; font-size: 10px; }
  .tc-status-pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
  .tc-status-pill .dot { width: 7px; height: 7px; border-radius: 50%; }
  .tc-prio-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
  .tc-due { font-size: 12px; color: var(--text-secondary); display: inline-flex; align-items: center; gap: 4px; margin-left: auto; white-space: nowrap; }
  .tc-due svg { width: 13px; height: 13px; opacity: 0.7; }
  .tc-due.overdue { color: #e2435c; font-weight: 600; }
  .tc-due.soon { color: #fdab3d; font-weight: 600; }
  .tc-due.done { color: var(--text-muted); }

  /* 子任务卡（缩进 + ↳）*/
  .task-card.sub-card { margin-left: 20px; }
  .task-card.sub-card .tc-title { font-size: 13.5px; font-weight: 500; color: var(--text-secondary); }
  .task-card.sub-card .task-card-main { padding: 8px 12px 8px 15px; }
  .task-card.sub-card::before { width: 3px; opacity: 0.6; }
  .tc-sub-more {
    margin-left: 20px; padding: 8px 12px; font-size: 12.5px; color: var(--accent);
    background: transparent; border: 1px dashed var(--border); border-radius: 10px;
    display: flex; align-items: center; gap: 6px;
  }
  .tc-sub-more:active { background: var(--accent-light); }

  /* 空状态 */
  .tc-empty { text-align: center; padding: 48px 16px; color: var(--text-muted); }
  .tc-empty h3 { font-size: 15px; margin-bottom: 6px; color: var(--text-secondary); }
  .tc-empty p { font-size: 13px; }

  /* 已完成分区（移动端卡片，默认折叠） */
  .tc-done-section { margin-top: 14px; }
  .tc-done-header { display: flex; align-items: center; gap: 8px; padding: 12px 14px; cursor: pointer; user-select: none; background: var(--bg-app); border-radius: 10px; position: sticky; top: 0; z-index: 5; }
  .tc-done-caret { display: inline-flex; width: 18px; height: 18px; color: var(--text-secondary); transition: transform 0.15s; }
  .tc-done-section.collapsed .tc-done-caret { transform: rotate(-90deg); }
  .tc-done-title { font-size: 14px; font-weight: 600; color: var(--text-primary); flex: 1; }
  .tc-done-count { font-size: 12px; color: var(--text-muted); background: var(--bg-surface); padding: 1px 8px; border-radius: 10px; border: 1px solid var(--border-light); }
  .tc-done-section.collapsed .tc-done-body { display: none; }
  .tc-done-section .task-card.done { opacity: 0.7; }
  /* 移动端「已完成」区备注：对齐头部 14px 内边距 */
  .mobile-cards .group-note { padding: 4px 14px 10px; }
  .mobile-cards .pinned-tag { font-size: 10px; padding: 1px 5px; }

  /* ===== 底部 nav：4 + FAB 布局 ===== */
  .mobile-nav { justify-content: space-between; padding: 0 8px env(safe-area-inset-bottom); height: 58px; }
  .mobile-nav button { flex: 1; padding: 6px 4px; max-width: 96px; min-height: 44px; }
  .mnav-fab {
    flex: 0 0 auto; width: 54px; height: 54px; margin-top: -26px;
    background: var(--accent); color: #fff; border-radius: 50%;
    box-shadow: 0 4px 14px rgba(0,0,0,0.28);
    display: flex; align-items: center; justify-content: center;
  }
  .mnav-fab svg { width: 26px; height: 26px; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.35)); }
  .mnav-fab:active { transform: scale(0.92); background: var(--accent-hover); }

  /* ===== 头部：⋯ 按钮显示，次要按钮收纳 ===== */
  .mobile-more-btn { display: flex; }
  .mobile-more-btn.show { display: flex; }
  #members-btn, #theme-toggle, #activity-log-btn, #share-btn { display: none; }

  /* Kanban - horizontal scroll on mobile */
  .kanban-scroll { padding: 8px; }
  .kanban-column { width: 260px; }

  /* Modal - full screen on mobile */
  .modal-overlay { padding: 0; }
  .modal { width: 100%; max-width: 100%; height: 100vh; height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .modal-header { padding: 12px 16px; }
  .modal-body { padding: 16px; }
  .modal-footer { padding: 16px; flex-direction: column-reverse; gap: 12px; }
  .modal-footer .btn { width: 100%; justify-content: center; min-height: 48px; padding: 12px 16px; font-size: 15px; font-weight: 600; border-radius: 10px; }
  /* 新建项目：移动端把创建按钮放在输入框下方，避免被软键盘遮挡 */
  .mobile-create-project-btn { display: flex; width: 100%; justify-content: center; min-height: 48px; margin-top: 8px; }
  .project-modal-footer { display: none; }

  /* Form rows stack on mobile */
  .form-row { flex-direction: column; gap: 0; }

  /* 触控优化：统一 44px 最小点击/输入高度 */
  .form-group input, .form-group select, .form-group textarea { min-height: 44px; font-size: 16px; }
  .form-group input[type="date"] { min-height: 44px; }
  .btn { min-height: 44px; }
  .task-card-main { padding: 12px 14px 12px 17px; min-height: 44px; }
  .kanban-card { padding: 12px 14px; min-height: 44px; }
  .gantt-zoom-btn { width: 32px; height: 32px; }
  .table-row td { padding-top: 10px; padding-bottom: 10px; }

  /* Auth card */
  .auth-card { padding: 24px 20px; box-shadow: none; border-radius: 12px; }

  /* Group header */
  .group-header { padding: 8px 12px; }
  .group-progress { width: 100%; margin-left: 0; margin-top: 4px; }
  .progress-bar { flex: 1; width: auto; }

  /* Hide timeline column on mobile */
  .col-timeline, th.col-timeline { display: none; }

  /* Touch-friendly row actions */
  .row-actions { opacity: 1; }

  /* Toast */
  .toast-container { bottom: 70px; }
  /* Snackbar 抬到移动端底部导航之上，并留出 safe-area */
  .snackbar-host { bottom: calc(70px + env(safe-area-inset-bottom)); width: calc(100% - 20px); max-width: none; }
  .snackbar { padding: 12px 6px 12px 14px; }
  .snackbar-msg { font-size: 12.5px; }
  .snackbar-action { padding: 8px 14px; min-height: 36px; }

  /* ===== 甘特图移动端：默认隐藏左侧任务树，timeline 全宽 ===== */
  .gantt-container { position: relative; }
  .gantt-list-toggle { display: inline-flex; }
  .gantt-left { display: none; }
  .gantt-container.show-left .gantt-left {
    display: flex; position: absolute; left: 0; top: 81px; bottom: auto; height: calc(100% - 81px); width: 64%;
    z-index: 20; background: var(--bg-surface); box-shadow: var(--shadow-lg);
  }
  /* 移动端抽屉里隐藏左侧“任务/WBS”表头，否则第一行会被顶下去，和右侧甘特条不在同一水平线 */
  .gantt-container.show-left .gantt-left-header { display: none; }
  .gantt-left-collapse, .gantt-left-expand { display: none; }
  .gantt-toolbar {
    position: relative; top: auto; right: auto;
    margin: 6px 6px 0; gap: 3px; padding: 3px 5px;
    max-width: none; width: calc(100% - 12px);
    overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none;
    flex-wrap: nowrap; z-index: 30;
  }
  .gantt-toolbar::-webkit-scrollbar { display: none; }
  .gantt-zoom-btn { width: 26px; height: 26px; font-size: 14px; }
  .gantt-autofit-btn, .gantt-link-btn { width: auto; padding: 0 5px; }
  .gantt-colorby { height: 26px; font-size: 11px; padding: 0 18px 0 4px; max-width: 68px; background-position: right 5px center; }
  .gantt-colorby-prefix .lbl { display: none; }
  .gantt-zoom-pct { font-size: 11px; min-width: 40px; }
  .gantt-btn-label { display: none; }
}

/* Small mobile (<= 480px) */
@media (max-width: 480px) {
  /* Hide more columns on very small screens */
  .col-created, th.col-created,
  .col-updated, th.col-updated { display: none; }

  /* Kanban cards */
  .kanban-column { width: 240px; }

  /* Auth form font size for iOS */
  .auth-form input { font-size: 16px; }
  .form-group input, .form-group select { font-size: 16px; }
}
/* 弹窗 tab（评论 / 活动） */
.modal-tabs { display: flex; gap: 4px; margin: 4px 0 8px; border-bottom: 1px solid var(--border, #e3e3e3); }
.modal-tab { background: none; border: none; padding: 8px 14px; font-size: 13px; font-weight: 600; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; }
.modal-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.activity-section { margin-top: 8px; }
.activity-list { max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.activity-item { display: flex; gap: 10px; align-items: flex-start; }
.activity-avatar { width: 28px; height: 28px; border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; flex-shrink: 0; }
.activity-body { flex: 1; min-width: 0; }
.activity-meta { display: flex; gap: 8px; align-items: baseline; font-size: 12px; color: var(--text-secondary); }
.activity-actor { font-weight: 600; color: var(--text-primary); }
.activity-text { font-size: 13px; color: var(--text-primary); margin-top: 2px; line-height: 1.5; }
.activity-text b { font-weight: 600; }
.activity-undo { margin-top: 6px; }
.activity-empty { color: var(--text-secondary); font-size: 13px; padding: 16px 0; text-align: center; }

/* 回收站 */
.trash-header { display: flex; align-items: baseline; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.trash-header h2 { font-size: 18px; margin: 0; color: var(--text-primary); }
.trash-hint { font-size: 12px; color: var(--text-secondary); }
.trash-list { padding: 12px 20px; display: flex; flex-direction: column; gap: 8px; }
.trash-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-app); }
.trash-item-name { font-weight: 600; font-size: 14px; color: var(--text-primary); }
.trash-item-meta { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.trash-item-actions { display: flex; gap: 8px; flex-shrink: 0; }
.trash-empty { color: var(--text-secondary); font-size: 13px; padding: 32px 0; text-align: center; }
.trash-btn { color: var(--text-muted); }

/* 附件（双后端存储） */
.attachments-section { margin-top: 8px; }
.attachments-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.attachments-hint { font-size: 12px; color: var(--text-secondary); }
.attachments-list { display: flex; flex-direction: column; gap: 8px; }
.attachment-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-surface); }
.attachment-icon { font-size: 20px; width: 28px; text-align: center; flex-shrink: 0; }
.attachment-meta { flex: 1; min-width: 0; }
.attachment-name { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attachment-sub { font-size: 11.5px; color: var(--text-secondary); margin-top: 2px; }
.attachment-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.attachment-dl { font-size: 12px; font-weight: 600; color: var(--accent); text-decoration: none; }
.attachment-dl:hover { text-decoration: underline; }
.attachment-del { color: var(--text-secondary); background: transparent; border: 1px solid var(--border); }
.attachment-del:hover { color: #e5484d; border-color: #e5484d; }
/* ===== 专业字段：优先级/风险 等级条 + 标签 ===== */
.professional-section { padding: 4px 0 8px; }
.level-row { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.level-bars { display: flex; gap: 5px; }
.level-bars .level-bar { width: 26px; height: 13px; border-radius: 3px; background: var(--border, #e3e3e3); cursor: pointer; transition: background .12s; }
.level-bars .level-bar.filled { background: #2ecc71; }
.level-bars.risk .level-bar.filled { background: #e5484d; }
.level-bars.disabled { pointer-events: none; opacity: .6; }
.level-label { font-size: 12px; color: var(--text-secondary); min-width: 48px; }
.tags-input { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; min-height: 38px; background: var(--bg-surface); }
.tags-list { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.tag-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--accent, #6554c0); color: #fff; font-size: 12px; padding: 2px 8px; border-radius: 12px; }
.tag-chip .tag-x { cursor: pointer; opacity: .85; font-weight: 700; line-height: 1; }
.tag-chip .tag-x:hover { opacity: 1; }
.tags-input input { border: none; outline: none; flex: 1; min-width: 90px; background: transparent; font-size: 13px; color: var(--text-primary); }

/* 活动日志右侧抽屉 */
#activity-log-btn { position: relative; }
#activity-badge { position: absolute; top: -2px; right: -4px; min-width: 16px; height: 16px; font-size: 10px; padding: 0 3px; border-radius: 8px; background: var(--accent, #6554c0); color: #fff; display: flex; align-items: center; justify-content: center; }
.activity-drawer { position: fixed; top: 0; right: 0; width: 420px; max-width: 92vw; height: 100vh; background: var(--bg-surface, #fff); box-shadow: -4px 0 24px rgba(0,0,0,.12); z-index: 1001; display: flex; flex-direction: column; transform: translateX(100%); transition: transform .28s cubic-bezier(.4,0,.2,1); }
.activity-drawer.open { transform: translateX(0); }
.activity-drawer-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border, #e3e3e3); flex-shrink: 0; }
.activity-drawer-header h2 { font-size: 17px; margin: 0; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.activity-drawer-tabs { display: flex; gap: 0; padding: 0 20px; border-bottom: 1px solid var(--border, #e3e3e3); flex-shrink: 0; }
.activity-tab { background: none; border: none; padding: 10px 16px; font-size: 13px; font-weight: 600; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; transition: all .15s; }
.activity-tab.active { color: var(--accent, #6554c0); border-bottom-color: var(--accent, #6554c0); }
.activity-drawer-filter { display: flex; gap: 8px; padding: 12px 20px; border-bottom: 1px solid var(--border, #e3e3e3); flex-shrink: 0; align-items: center; }
.activity-search-box { flex: 1; display: flex; align-items: center; gap: 6px; background: var(--bg-app, #f5f5f7); border-radius: 6px; padding: 6px 10px; border: 1px solid var(--border, #e3e3e3); }
.activity-search-box svg { width: 14px; height: 14px; flex-shrink: 0; color: var(--text-muted); }
.activity-search-box input { border: none; background: none; outline: none; font-size: 12.5px; width: 100%; color: var(--text-primary); }
.activity-filter-select { font-size: 12px; padding: 6px 8px; min-width: 100px; color: var(--text-primary); background: var(--bg-app, #f5f5f7); }
.activity-drawer-body { flex: 1; overflow-y: auto; padding: 8px 0; }
.activity-drawer-body .activity-list { max-height: none; gap: 0; }
.activity-drawer-body .activity-item { padding: 10px 20px; border-bottom: 1px solid var(--border-light, rgba(0,0,0,.06)); gap: 12px; transition: background .12s; cursor: default; }
.activity-drawer-body .activity-item:hover { background: var(--bg-hover, rgba(0,0,0,.02)); }
.activity-drawer-body .activity-avatar { width: 32px; height: 32px; font-size: 14px; }
.activity-drawer-body .activity-time { white-space: nowrap; font-size: 12px; color: var(--text-secondary); min-width: 38px; text-align: right; }
.activity-drawer-body .activity-task-name { font-weight: 600; font-size: 13px; color: var(--accent, #6554c0); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; display: inline-block; vertical-align: middle; }
.activity-drawer-body .activity-task-name:hover { text-decoration: underline; }
.activity-drawer-body .activity-action-icon { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 4px; background: var(--bg-app, #f5f5f7); margin-left: 6px; vertical-align: middle; flex-shrink: 0; }
.activity-drawer-body .activity-action-icon svg { width: 13px; height: 13px; }
.activity-drawer-body .activity-change-row { display: flex; align-items: center; gap: 6px; font-size: 13px; margin-top: 3px; color: var(--text-primary); }
.activity-drawer-body .activity-val-before { color: var(--text-muted); text-decoration: line-through; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-drawer-body .activity-arrow { color: var(--text-muted); font-size: 11px; }
.activity-drawer-body .activity-val-after { font-weight: 600; color: var(--text-primary); max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.25); z-index: 1000; opacity: 0; pointer-events: none; transition: opacity .25s; }
.activity-overlay.show { opacity: 1; pointer-events: auto; }
/* 批量活动分组块（撤销本次所有变更） */
.activity-group { padding: 12px 20px; border-bottom: 1px solid var(--border-light, rgba(0,0,0,.06)); display: flex; gap: 12px; align-items: flex-start; background: rgba(99,102,241,.04); transition: background .12s; }
.activity-group:hover { background: rgba(99,102,241,.08); }
.activity-group .activity-time { white-space: nowrap; font-size: 12px; color: var(--text-secondary); min-width: 38px; text-align: right; margin-top: 4px; }
.activity-group .activity-body { flex: 1; min-width: 0; }
.activity-group .activity-batch-tag { font-size: 11px; color: var(--accent, #6554c0); background: rgba(99,102,241,.12); padding: 1px 6px; border-radius: 4px; margin-left: 4px; }
.activity-group .activity-undo-batch { margin-top: 8px; white-space: nowrap; color: #fff; background: var(--accent, #6554c0); border-color: var(--accent, #6554c0); }
.activity-group .activity-undo-batch:hover { filter: brightness(.95); }


@media (max-width: 600px) {
  .activity-drawer { width: 92vw; }
}

/* ===== 分组色标 / 甘特里程碑 ===== */
.group-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.gantt-milestone { position: absolute; color: var(--accent); font-size: 20px; line-height: 1; cursor: pointer; transform: translate(-50%, 0); text-shadow: 0 0 2px var(--bg-surface); z-index: 4; }
.gantt-milestone:hover { color: var(--accent-hover); }

/* ===== 通知 Popover ===== */
#notif-popover { width: 320px; max-height: 400px; padding: 0; display: none; }
#notif-popover.show { display: block; animation: popIn 0.12s ease; }
.notif-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--border-light); position: sticky; top: 0; background: var(--bg-surface); z-index: 1; }
.notif-header h4 { margin: 0; font-size: 14px; font-weight: 600; color: var(--text-primary); }
#notif-readall-btn { font-size: 12px; color: var(--accent); background: none; border: none; cursor: pointer; padding: 2px 4px; }
#notif-readall-btn:hover { text-decoration: underline; }
#notif-list { padding: 4px; max-height: 344px; overflow-y: auto; }
.notif-item { display: flex; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer; transition: background 0.12s; align-items: flex-start; }
.notif-item:hover { background: var(--bg-hover); }
.notif-item.unread { background: var(--accent-light); }
.notif-item.unread:hover { background: var(--accent-light); }
.notif-body { flex: 1; min-width: 0; }
.notif-title { font-size: 13px; font-weight: 600; color: var(--text-primary); line-height: 1.3; }
.notif-text { font-size: 12px; color: var(--text-secondary); margin-top: 3px; word-break: break-word; }
.notif-time { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.notif-empty, .group-empty { padding: 22px 12px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* ===== 分组管理 Popover ===== */
#group-popover { width: 268px; padding: 8px; }
#group-manager-list { display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow-y: auto; }
.group-manage-item { display: flex; align-items: center; gap: 8px; }
.group-color { width: 26px; height: 26px; border: 1px solid var(--border); border-radius: 6px; padding: 0; background: none; cursor: pointer; flex-shrink: 0; }
.group-name-input { flex: 1; min-width: 0; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; background: var(--bg-surface); color: var(--text-primary); outline: none; font-family: inherit; }
.group-name-input:focus { border-color: var(--accent); }
.group-del { width: 26px; height: 26px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-surface); color: var(--text-muted); cursor: pointer; font-size: 16px; line-height: 1; flex-shrink: 0; }
.group-del:hover { background: #fdeaea; color: #e2435c; border-color: #f3c2c2; }
.group-add-btn { margin-top: 8px; width: 100%; padding: 8px; border: 1px dashed var(--border); border-radius: 6px; background: var(--bg-surface); color: var(--accent); font-size: 13px; cursor: pointer; }
.group-add-btn:hover { background: var(--accent-light); }
.group-rename-input { flex: 1; min-width: 0; padding: 6px 8px; border: 1px solid var(--accent); border-radius: 6px; font-size: 13px; background: var(--bg-surface); color: var(--text-primary); outline: none; font-family: inherit; }
.task-group-header .group-rename-input { flex: none; width: 180px; }

/* 组头「...」菜单按钮 */
.group-menu-btn { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border: none; background: transparent; color: var(--text-muted); cursor: pointer; border-radius: 4px; flex-shrink: 0; opacity: 0; transition: opacity 0.15s, background 0.12s, color 0.12s; }
.task-group-header:hover .group-menu-btn { opacity: 1; }
.group-menu-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

/* 组内「+ 添加任务到此组」行 */
.group-add-row td { padding: 2px 0 8px 14px; background: var(--bg-app); border: none; }
.group-add-row .group-add-link { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--accent); cursor: pointer; user-select: none; padding: 3px 8px; border-radius: 4px; transition: background 0.12s; border: none; background: transparent; font-family: inherit; }
.group-add-row .group-add-link:hover { background: var(--accent-light); }

/* 工具栏「+ 新建分组」按钮 */
.btn-new-group { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; border: 1px dashed var(--border); border-radius: 6px; background: var(--bg-surface); color: var(--text-secondary); font-size: 13px; cursor: pointer; transition: all 0.15s; white-space: nowrap; font-family: inherit; }
.btn-new-group:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }

/* 平铺模式下隐藏分组相关 UI（保留代码，后续可恢复） */
#toolbar-new-group-btn, #group-btn, #edit-group-row { display: none !important; }

/* 分组管理弹窗 — 色板选择器 */
.color-palette { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.color-swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; transition: transform 0.1s, border-color 0.1s; box-sizing: border-box; flex-shrink: 0; }
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.active { border-color: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,0.25); transform: scale(1.15); }
