:root {
    --bg: #f5f3ef;
    --card: #fdfcfa;
    --text: #2d2a26;
    --text-secondary: #8c857b;
    --border: #e8e5df;
    --accent: #4a6582;
    --accent-light: #8fa4b8;
    --accent-bg: rgba(74,101,130,0.08);
    --urgent: #b54242;
    --important: #c46a30;
    --normal: #4a7c59;
    --low: #9c958d;
    --success: #4a7c59;
    --shadow: 0 2px 10px rgba(45,42,38,0.05);
    --shadow-hover: 0 6px 24px rgba(45,42,38,0.09);
    --radius: 12px;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  body {
    font-family: 'Noto Serif SC', 'Source Han Serif SC', 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
  }

  /* 锁屏 */
  .lock-screen {
    position: fixed; inset: 0; z-index: 9999;
    background: linear-gradient(135deg, #2d2a26 0%, #1f3a52 100%);
    display: flex; align-items: center; justify-content: center; flex-direction: column;
  }
  .lock-card {
    background: var(--card); border-radius: var(--radius); padding: 40px 36px;
    box-shadow: var(--shadow-hover); text-align: center; width: 90%; max-width: 360px;
  }
  .lock-card h2 { font-size: 22px; margin-bottom: 6px; color: var(--text); }
  .lock-card .subtitle { font-size: 13px; color: var(--text-secondary); margin-bottom: 24px; }
  .lock-input {
    width: 100%; padding: 12px 16px; border-radius: 10px; border: 1px solid var(--border);
    font-size: 18px; font-family: inherit; text-align: center;
    background: var(--bg); color: var(--text); outline: none; margin-bottom: 16px;
    transition: border-color 0.2s;
  }
  .lock-input[type="password"] { letter-spacing: 6px; }
  .lock-input:focus { border-color: var(--accent); }
  .lock-error { color: var(--urgent); font-size: 13px; margin-bottom: 12px; min-height: 20px; }
  .lock-hint { margin-top: 20px; font-size: 12px; color: #9c958d; }
  .btn {
    padding: 10px 18px; border-radius: 10px; border: none; font-size: 14px;
    font-weight: 600; cursor: pointer; transition: all 0.2s; font-family: inherit;
  }
  .btn-primary { background: var(--accent); color: white; }
  .btn-primary:hover { background: #3d5266; }
  .btn-secondary { background: var(--bg); color: var(--text-secondary); }
  .btn-secondary:hover { background: var(--border); }
  .btn-danger { background: rgba(181,66,66,0.10); color: var(--urgent); }
  .btn-success { background: rgba(74,124,89,0.10); color: var(--success); }

  /* 顶部导航 */
  .top-bar {
    background: var(--card); border-bottom: 1px solid var(--border);
    padding: 16px 32px; display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 12px;
  }
  .top-bar-left { display: flex; align-items: center; gap: 12px; }
  .top-bar-left h1 { font-size: 18px; font-weight: 700; }
  .top-bar-left .date { font-size: 12px; color: var(--text-secondary); }
  .nav-tabs { display: flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: 10px; }
  .nav-tab {
    padding: 7px 16px; border-radius: 8px; font-size: 13px; font-weight: 600;
    cursor: pointer; border: none; background: transparent; color: var(--text-secondary);
    transition: all 0.2s; font-family: inherit; white-space: nowrap;
  }
  .nav-tab:hover { color: var(--text); }
  .nav-tab.active { background: var(--card); color: var(--text); box-shadow: var(--shadow); }

  /* 主区域 */
  .main { height: calc(100vh - 68px); overflow-y: auto; padding: 24px 48px; }
  .main-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
  .main-header h2 { font-size: 20px; font-weight: 700; }
  .stats-bar { display: flex; gap: 12px; flex-wrap: wrap; }
  .stat-item { background: var(--card); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); font-size: 13px; cursor: pointer; transition: all 0.2s; user-select: none; }
  .stat-item:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); }
  .stat-item.active { background: var(--accent-bg); color: var(--accent); font-weight: 600; }
  .stat-item strong { font-size: 18px; color: var(--accent); margin-right: 4px; }

  /* 看板 */
  .board { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; max-width: 1440px; margin: 0 auto; }
  .board-col { background: var(--bg); border-radius: var(--radius); padding: 24px; border: 1px solid var(--border); min-height: 400px; }
  .board-col-header {
    display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700;
    color: var(--text-secondary); margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border);
  }
  .board-col-header .col-dot { width: 10px; height: 10px; border-radius: 50%; }
  .board-col-header .col-count { margin-left: auto; background: var(--card); padding: 2px 8px; border-radius: 12px; font-size: 11px; }
  .board-tasks { display: flex; flex-direction: column; gap: 12px; }
  .board-task {
    display: flex; align-items: stretch; background: var(--card); border-radius: 10px; cursor: pointer;
    transition: all 0.2s; border: 1px solid var(--border); overflow: hidden;
  }
  .board-task:hover { border-color: var(--accent-light); box-shadow: var(--shadow); transform: translateY(-1px); }
  .bt-dept-badge {
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 15px; padding: 0 18px; flex-shrink: 0;
  }
  .bt-body {
    flex: 1; padding: 16px; display: flex; flex-direction: column; justify-content: center; gap: 8px;
  }
  .board-task .bt-name { font-size: 14px; font-weight: 600; line-height: 1.4; }
  .board-task .bt-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-secondary); flex-wrap: wrap; }
  .task-owner {
    font-size: 12px; padding: 3px 8px; border-radius: 4px; background: #f5ece3; color: #b05a28; font-weight: 600;
  }
  .board-task .bt-progress { height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; }
  .board-task .bt-progress-fill { height: 100%; border-radius: 3px; transition: width 0.3s; }
  .board-empty { text-align: center; padding: 40px 20px; color: #9c958d; font-size: 13px; }

  /* 部门网格视图 */
  .dept-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }
  .grid-task {
    background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
    cursor: pointer; transition: all 0.2s; border: 1px solid transparent;
    display: flex; flex-direction: column; gap: 10px; min-height: 160px;
  }
  .grid-task:hover { border-color: var(--accent-light); box-shadow: var(--shadow-hover); transform: translateY(-2px); }
  .grid-task .gt-dept {
    font-size: 12px; padding: 4px 10px; border-radius: 6px; font-weight: 700; align-self: flex-start; line-height: 1;
  }
  .grid-task .gt-name { font-size: 15px; font-weight: 700; line-height: 1.3; }
  .grid-task .gt-owner { font-size: 13px; color: var(--text-secondary); }
  .grid-task .gt-meta { display: flex; gap: 8px; font-size: 12px; color: var(--text-secondary); flex-wrap: wrap; }
  .grid-task .gt-progress { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin-top: auto; }
  .grid-task .gt-progress-fill { height: 100%; border-radius: 3px; transition: width 0.3s; }

  /* 日历视图 */
  .calendar-wrap { background: var(--card); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
  .calendar-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
  .calendar-header h3 { font-size: 18px; }
  .calendar-nav { display: flex; gap: 8px; }
  .calendar-nav button { padding: 6px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 600; }
  .calendar-nav button:hover { background: var(--border); }
  .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
  .calendar-day-label { text-align: center; font-size: 12px; font-weight: 700; color: var(--text-secondary); padding: 8px; }
  .calendar-day {
    min-height: 100px; border-radius: 10px; border: 1px solid var(--border);
    padding: 8px; background: var(--bg); transition: all 0.2s;
  }
  .calendar-day:hover { border-color: var(--accent-light); }
  .calendar-day.today { border-color: var(--accent); background: rgba(74,101,130,0.04); }
  .calendar-day .day-num { font-size: 13px; font-weight: 700; color: var(--text-secondary); margin-bottom: 6px; }
  .calendar-day.today .day-num { color: var(--accent); }
  .calendar-day .day-task {
    font-size: 11px; padding: 4px 6px; border-radius: 4px; margin-bottom: 3px;
    cursor: pointer; line-height: 1.3;
  }
  .calendar-day .day-task .dt-name {
    font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .calendar-day .day-task .dt-meta {
    font-size: 10px; opacity: 0.85; margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .calendar-day .day-task:hover { opacity: 0.8; }

  /* 弹窗 */
  .overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 150; }
  .overlay.show { display: block; }
  .modal {
    display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
    background: var(--card); border-radius: var(--radius); padding: 0; width: 90%;
    max-width: 600px; box-shadow: var(--shadow-hover); z-index: 200;
    max-height: 90vh; overflow: hidden; flex-direction: column;
  }
  .modal.show { display: flex; }
  .modal-header { padding: 20px 24px 16px; border-bottom: 1px solid var(--border); }
  .modal-header h3 { font-size: 18px; margin: 0; }
  .modal-header .modal-sub { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
  .modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
  .modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

  .form-row { margin-bottom: 16px; }
  .form-label { font-size: 13px; font-weight: 600; margin-bottom: 6px; display: block; color: var(--text-secondary); }
  .form-input, .form-textarea, .form-select {
    width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
    font-size: 14px; font-family: inherit; background: var(--bg); color: var(--text);
    outline: none; transition: border-color 0.2s;
  }
  .form-input:focus, .form-textarea:focus, .form-select:focus { border-color: var(--accent); }
  .form-textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
  .form-row-inline { display: flex; gap: 12px; }
  .form-row-inline .form-row { flex: 1; margin-bottom: 0; }

  /* 步骤拆解 */
  .step-list { display: flex; flex-direction: column; gap: 8px; }
  .step-item {
    background: var(--bg); border-radius: 10px; padding: 10px 12px; transition: all 0.2s;
    display: flex; align-items: center; gap: 10px;
  }
  .step-item:hover { background: #e8e5df; }
  .step-check {
    width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--border);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; transition: all 0.2s; font-size: 12px; color: white;
  }
  .step-check:hover { border-color: var(--accent); }
  .step-check.done { background: var(--success); border-color: var(--success); }
  .step-name {
    flex: 1; font-size: 14px; border: none; background: transparent; outline: none;
    font-family: inherit; color: var(--text);
  }
  .step-name.done { text-decoration: line-through; color: var(--text-secondary); }
  .step-assignee {
    width: 100px; font-size: 13px; padding: 4px 8px; border: 1px solid var(--border);
    border-radius: 6px; background: var(--card); outline: none; color: var(--text-secondary);
  }
  .step-assignee:focus { border-color: var(--accent); }
  .step-delete { color: var(--text-secondary); cursor: pointer; font-size: 16px; padding: 4px; border: none; background: transparent; }
  .step-delete:hover { color: var(--urgent); }
  .add-step { display: flex; gap: 8px; margin-top: 10px; }

  /* 附件 */
  .attach-list { display: flex; flex-direction: column; gap: 8px; }
  .attach-item {
    display: flex; align-items: center; gap: 10px; background: var(--bg); border-radius: 8px;
    padding: 10px 12px; font-size: 13px; transition: all 0.2s;
  }
  .attach-item:hover { background: #e8e5df; }
  .attach-icon { font-size: 20px; flex-shrink: 0; }
  .attach-info { flex: 1; min-width: 0; }
  .attach-name { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .attach-size { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
  .attach-actions { display: flex; gap: 8px; flex-shrink: 0; }
  .attach-actions button {
    font-size: 12px; padding: 4px 10px; border-radius: 6px; border: none; cursor: pointer;
    background: var(--card); color: var(--text-secondary); transition: all 0.2s;
  }
  .attach-actions button:hover { background: var(--accent-bg); color: var(--accent); }
  .attach-upload {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    border: 2px dashed var(--border); border-radius: 10px; padding: 16px;
    cursor: pointer; color: var(--text-secondary); font-size: 13px; transition: all 0.2s;
    margin-top: 8px;
  }
  .attach-upload:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }

  .priority-options { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
  .priority-chip {
    padding: 5px 14px; border-radius: 20px; font-size: 12px; font-weight: 600;
    cursor: pointer; border: 2px solid transparent; transition: all 0.2s; background: var(--bg);
  }
  .priority-chip.selected { border-color: var(--text); }
  .chip-urgent { background: rgba(181,66,66,0.10); color: #a63a3a; }
  .chip-important { background: rgba(196,106,48,0.12); color: #b05a28; }
  .chip-normal { background: rgba(74,124,89,0.10); color: #3d6b4d; }
  .chip-low { background: rgba(156,149,141,0.15); color: #6b6560; }

  /* 滚动条 */
  ::-webkit-scrollbar { width: 6px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
  ::-webkit-scrollbar-thumb:hover { background: #c8c2bb; }

  /* 响应式 */
  @media (max-width: 1400px) { .dept-grid { grid-template-columns: repeat(4, 1fr); } }
  @media (max-width: 1100px) { .dept-grid { grid-template-columns: repeat(3, 1fr); } }
  @media (max-width: 1024px) {
    .board { grid-template-columns: 1fr; }
    .calendar-grid { display: block; }
    .calendar-day { min-height: 70px; margin-bottom: 8px; }
    .dept-grid { grid-template-columns: repeat(2, 1fr); }
  }
  @media (max-width: 768px) {
    body { font-size: 14px; }
    .top-bar { padding: 8px 10px; gap: 6px; flex-wrap: wrap; }
    .top-bar-left { flex: 1; min-width: 0; }
    .top-bar-left h1 { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .top-bar-left .date { display: none; }
    .nav-tabs { padding: 3px; gap: 2px; flex: 1 1 100%; order: 3; overflow-x: auto; }
    .nav-tab { padding: 5px 10px; font-size: 12px; }
    .main { padding: 10px; height: calc(100vh - 102px); }
    .main-header { margin-bottom: 10px; gap: 6px; }
    .main-header h2 { font-size: 15px; }
    .stats-bar { gap: 5px; }
    .stat-item { padding: 5px 8px; font-size: 11px; border-radius: 6px; }
    .stat-item strong { font-size: 14px; }
    .board { gap: 10px; }
    .board-col { padding: 12px; min-height: 180px; }
    .board-col-header { margin-bottom: 8px; padding-bottom: 6px; font-size: 12px; }
    .board-tasks { gap: 8px; }
    .board-task { border-radius: 8px; }
    .bt-dept-badge { font-size: 12px; padding: 0 8px; }
    .bt-body { padding: 8px; gap: 5px; }
    .board-task .bt-name { font-size: 13px; }
    .board-task .bt-meta { gap: 5px; font-size: 11px; }
    .modal { width: 95%; max-width: none; border-radius: 10px; }
    .modal-header { padding: 12px 14px 8px; }
    .modal-header h3 { font-size: 15px; }
    .modal-body { padding: 12px 14px; }
    .modal-footer { padding: 10px 14px; gap: 8px; flex-wrap: wrap; }
    .modal-footer .btn { padding: 7px 12px; font-size: 12px; }
    .dept-grid { grid-template-columns: 1fr; gap: 8px; }
    .grid-task { padding: 10px; min-height: auto; gap: 6px; }
    .grid-task .gt-name { font-size: 13px; }
    .calendar-wrap { padding: 12px; }
    .calendar-header h3 { font-size: 14px; }
    .calendar-nav button { padding: 4px 8px; font-size: 11px; }
    .calendar-day { min-height: 50px; padding: 5px; }
    .calendar-day .day-num { font-size: 11px; margin-bottom: 3px; }
    .calendar-day .day-task { font-size: 10px; padding: 2px 3px; margin-bottom: 2px; }
    .form-row-inline { flex-direction: column; gap: 0; }
    .form-row-inline .form-row { margin-bottom: 10px; }
    .lock-card { padding: 24px 16px; }
    .lock-card h2 { font-size: 17px; }
    .lock-input { font-size: 16px; padding: 10px 12px; margin-bottom: 12px; }
    .toast { top: 10px; right: 10px; left: 10px; font-size: 13px; padding: 10px 14px; }
    .step-assignee { width: 80px; }
    .attach-actions button { padding: 3px 6px; font-size: 11px; }
    .attach-upload { padding: 10px; font-size: 12px; }
    .priority-chip { padding: 4px 10px; font-size: 11px; }
  }
  @media (max-width: 480px) {
    .top-bar { padding: 6px 8px; gap: 4px; }
    .top-bar-left h1 { font-size: 13px; }
    .nav-tab { padding: 4px 7px; font-size: 11px; }
    .main { padding: 8px; height: calc(100vh - 96px); }
    .btn { padding: 6px 10px; font-size: 12px; }
    .bt-dept-badge { font-size: 11px; padding: 0 6px; }
    .modal-footer .btn { padding: 6px 8px; font-size: 11px; }
    .board-col { padding: 10px; }
    .board-task .bt-name { font-size: 12px; }
  }
@keyframes spin { to { transform: rotate(360deg); } }

  .toast {
    position: fixed; top: 20px; right: 20px; z-index: 10000;
    background: var(--card); color: var(--text);
    padding: 12px 20px; border-radius: var(--radius);
    box-shadow: var(--shadow-hover); border: 1px solid var(--border);
    font-size: 14px; display: none; align-items: center; gap: 8px;
    animation: toastIn 0.3s ease;
  }
  .toast.show { display: flex; }
  .toast.success { border-left: 4px solid var(--success); }
  .toast.error { border-left: 4px solid var(--urgent); }
  @keyframes toastIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
  }
