/* MonTree 样式 */
:root {
  --primary: #16a34a;
  --primary-dark: #15803d;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --danger: #dc2626;
  --warn: #d97706;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .08);
}

* { box-sizing: border-box; }
/* 保证 hidden 属性始终生效（优先于任何 display 规则，如 .modal-mask 的 flex） */
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 0 0 12px; }
h4 { margin: 16px 0 8px; font-size: 13px; color: var(--muted); }
hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 210px; flex-shrink: 0; background: #14532d; color: #dcfce7;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.logo { font-size: 20px; font-weight: 700; padding: 20px 16px; color: #fff; }
.sidebar nav { flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 11px 16px;
  color: #bbf7d0; font-size: 14px;
}
.nav-item:hover { background: rgba(255, 255, 255, .08); text-decoration: none; }
.nav-item.active { background: rgba(255, 255, 255, .14); color: #fff; font-weight: 600; }
.nav-icon { width: 20px; text-align: center; }
.sidebar-footer { border-top: 1px solid rgba(255, 255, 255, .15); padding-bottom: 8px; }
.badge {
  background: var(--danger); color: #fff; border-radius: 10px;
  font-size: 11px; padding: 1px 7px; margin-left: auto;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; background: var(--panel); border-bottom: 1px solid var(--border);
}
.search-form input {
  width: 300px; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: 20px; background: var(--bg); font-size: 13px;
}
.today { color: var(--muted); font-size: 13px; }
.content { padding: 24px; flex: 1; }

/* ---------- 通用组件 ---------- */
.panel {
  background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 18px;
}
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.page-head h1 { margin: 0; }
.meta { color: var(--muted); font-size: 12px; }
.empty { color: var(--muted); padding: 12px 0; }
.text-danger { color: var(--danger); font-weight: 600; }
.text-warn { color: var(--warn); font-weight: 600; }

.btn {
  display: inline-block; padding: 8px 16px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--panel); color: var(--text);
  font-size: 13px; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--bg); text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn.danger { color: var(--danger); border-color: #fecaca; }
.icon-btn { border: none; background: none; cursor: pointer; font-size: 14px; color: var(--muted); padding: 2px 6px; }
.icon-btn:hover { color: var(--text); }
.icon-btn.danger:hover { color: var(--danger); }

input[type="text"], input[type="email"], input[type="password"], input[type="date"],
input[type="search"], select, textarea {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; font-family: inherit; background: #fff; color: var(--text);
}
textarea { resize: vertical; min-height: 70px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid #86efac; border-color: var(--primary); }

.flash { margin: 12px 24px 0; padding: 10px 16px; border-radius: 8px; font-size: 13px; }
.flash-success { background: #dcfce7; color: #166534; }
.flash-error { background: #fee2e2; color: #991b1b; }

.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.inline-form input[type="text"] { flex: 1; min-width: 200px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 14px; }
.form-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; color: var(--muted); padding: 8px; border-bottom: 2px solid var(--border); }
.table td { padding: 9px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:hover td { background: #f9fafb; }
.row-muted { opacity: .5; }
.row-blocked td { background: #fffbeb; }

.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%; background: var(--primary);
  color: #fff; font-size: 13px; flex-shrink: 0;
}
.avatar-sm { width: 22px; height: 22px; font-size: 11px; }
.member-avatars { display: flex; }
.member-avatars .avatar { margin-left: -6px; border: 2px solid #fff; }

.progress { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--primary); border-radius: 4px; transition: width .3s; }
.progress-sm { height: 5px; margin-top: 6px; }

.hbar { position: relative; background: var(--bg); border-radius: 4px; height: 20px; min-width: 120px; }
.hbar-fill { position: absolute; left: 0; top: 0; bottom: 0; background: #86efac; border-radius: 4px; }
.hbar-num { position: relative; padding-left: 8px; font-size: 12px; line-height: 20px; }

.prio { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.prio-urgent { background: #dc2626; }
.prio-high { background: #f59e0b; }
.prio-normal { background: #3b82f6; }
.prio-low { background: #9ca3af; }

.due { font-size: 12px; }
.due-over { color: var(--danger); font-weight: 600; }
.due-today { color: var(--warn); font-weight: 600; }
.due-future { color: var(--muted); }
.due-done { color: var(--muted); }
.done-text { text-decoration: line-through; color: var(--muted); }

.label-chip {
  display: inline-block; padding: 1px 8px; border-radius: 10px;
  color: #fff; font-size: 11px; margin-right: 4px;
}

/* ---------- 登录页 ---------- */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #14532d, #166534); }
.login-box { background: #fff; border-radius: 14px; padding: 36px; width: 360px; box-shadow: 0 10px 40px rgba(0, 0, 0, .3); }
.login-logo { font-size: 26px; font-weight: 700; text-align: center; }
.login-sub { text-align: center; color: var(--muted); margin: 6px 0 20px; }
.login-box label { display: block; margin: 12px 0 5px; font-size: 13px; color: var(--muted); }
.login-box input { width: 100%; }
.login-box .btn { margin-top: 20px; padding: 10px; }
.login-box .flash { margin: 0 0 10px; }

/* ---------- 仪表盘 ---------- */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; text-align: center; }
.stat-num { font-size: 28px; font-weight: 700; color: var(--primary-dark); }
.stat-label { color: var(--muted); font-size: 13px; margin-top: 4px; }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }

.task-list { list-style: none; margin: 0; padding: 0; }
.task-list li { border-bottom: 1px solid var(--border); }
.task-list li:last-child { border-bottom: none; }
.task-list a { display: flex; align-items: center; gap: 8px; padding: 9px 4px; color: var(--text); flex-wrap: wrap; }
.task-list a:hover { background: #f9fafb; text-decoration: none; }
.task-list .meta { margin-left: auto; }
.todo-line { display: flex; align-items: center; gap: 8px; padding: 8px 4px; }
.todo-line .due, .todo-line .meta { margin-left: auto; }
.todo-content { flex: 1; }

.board-progress-list { list-style: none; margin: 0; padding: 0; }
.board-progress-list li { margin-bottom: 4px; }
.board-progress-list a { display: block; padding: 8px 4px; color: var(--text); }
.board-progress-list a:hover { background: #f9fafb; text-decoration: none; }
.bp-head { display: flex; justify-content: space-between; margin-bottom: 5px; }

/* ---------- 看板列表页 ---------- */
.board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.board-card { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); position: relative; }
.board-card.archived { opacity: .55; }
.board-card-main { display: block; padding: 16px; color: var(--text); }
.board-card-main:hover { text-decoration: none; }
.board-card h3 { margin: 0 0 6px; font-size: 15px; }
.board-card .progress { margin: 10px 0 8px; }
.board-card-foot { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.board-card-actions { position: absolute; top: 10px; right: 10px; }

/* ---------- Kanban ---------- */
.board-head { align-items: flex-start; }
.board-tools { display: flex; align-items: center; gap: 8px; }
.kanban {
  display: flex; gap: 14px; align-items: flex-start;
  overflow-x: auto; padding-bottom: 16px; min-height: 60vh;
}
.list {
  background: #eef1f4; border-radius: var(--radius); width: 280px; flex-shrink: 0;
  padding: 10px; max-height: calc(100vh - 210px); display: flex; flex-direction: column;
}
.list-head { display: flex; align-items: center; gap: 6px; padding: 2px 4px 8px; }
.list-title { font-weight: 600; font-size: 14px; cursor: pointer; }
.list-count { color: var(--muted); font-size: 12px; background: #fff; border-radius: 10px; padding: 0 7px; }
.list-menu { margin-left: auto; position: relative; }
.list-menu-items {
  display: none; position: absolute; right: 0; top: 24px; z-index: 30;
  background: #fff; border-radius: 8px; box-shadow: 0 4px 16px rgba(0, 0, 0, .15); min-width: 130px; padding: 4px 0;
}
.list-menu.open .list-menu-items { display: block; }
.list-menu-items button { display: block; width: 100%; text-align: left; border: none; background: none; padding: 8px 14px; font-size: 13px; cursor: pointer; }
.list-menu-items button:hover { background: var(--bg); }
.list-menu-items button.danger { color: var(--danger); }
.menu-sep { padding: 6px 14px 2px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--border); margin-top: 4px; }
.menu-sep:empty { padding: 0; margin-top: 4px; }
.color-row { display: flex; gap: 6px; padding: 4px 14px 8px; }
.color-row .color-dot {
  width: 20px; height: 20px; border-radius: 50%; border: none; cursor: pointer;
  padding: 0; flex-shrink: 0; font-size: 11px; color: #6b7280; line-height: 20px; text-align: center;
}
.color-row .color-dot.cur { outline: 2px solid var(--text); outline-offset: 1px; }
.menu-file { display: block; padding: 8px 14px; font-size: 13px; cursor: pointer; }
.menu-file:hover { background: var(--bg); }

/* 列颜色应用：顶部色条 + 计数徽章着色 */
.list.has-color { border-top: 4px solid var(--lc); }
.list.has-color .list-count { background: var(--lc); color: #fff; }

.card-stack { overflow-y: auto; flex: 1; min-height: 30px; display: flex; flex-direction: column; gap: 8px; padding: 2px; }
.card {
  background: #fff; border-radius: 8px; box-shadow: var(--shadow); padding: 10px;
  cursor: grab; border-left: 3px solid transparent;
}
.card:hover { box-shadow: 0 3px 8px rgba(0, 0, 0, .12); }
.card.dragging { opacity: .5; }
.card.done { opacity: .6; }
.card.done .card-title { text-decoration: line-through; }
.card.blocked { border-left-color: var(--warn); background: #fffbeb; }
.card-title { font-size: 13px; line-height: 1.45; }
.card-labels { margin-bottom: 6px; }
.card-blocked { color: var(--warn); font-size: 12px; margin-top: 5px; }
.card-foot { display: flex; align-items: center; gap: 8px; margin-top: 7px; flex-wrap: wrap; }
.card-avatars { margin-left: auto; display: flex; }
.card-avatars .avatar { margin-left: -5px; border: 1px solid #fff; }
.add-card-form input, .list-adder input {
  width: 100%; border: none; background: transparent; padding: 8px 6px; font-size: 13px;
}
.add-card-form input:focus, .list-adder input:focus { background: #fff; outline: 2px solid #86efac; border-radius: 6px; }
.list-adder { background: rgba(238, 241, 244, .6); }

/* ---------- 抽屉 ---------- */
.drawer {
  position: fixed; right: 0; top: 0; bottom: 0; width: 320px; z-index: 40;
  background: #fff; box-shadow: -4px 0 20px rgba(0, 0, 0, .15); padding: 16px; overflow-y: auto;
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.drawer-head h3 { margin: 0; }
.drawer-form { display: flex; gap: 8px; margin-top: 12px; }
.drawer-form input { flex: 1; }
.member-list, .activity-list, .notify-list, .comment-list, .checklist { list-style: none; margin: 0; padding: 0; }
.member-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.member-list li .meta { display: block; }
.activity-list li { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.activity-list .meta { display: block; margin-top: 2px; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 50;
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto;
}
body.modal-open { overflow: hidden; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 880px; padding: 20px; }
.modal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.modal-title { flex: 1; font-size: 18px; font-weight: 700; border: 1px solid transparent; border-radius: 6px; padding: 6px 8px; }
.modal-title:hover { border-color: var(--border); }
.modal-grid { display: grid; grid-template-columns: 1fr 320px; gap: 24px; }
/* 卡点及以下：左右两列均衡排布 */
.side-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; align-items: start; }
.side-cols h4 { margin-top: 16px; }
.side-cols input[type="text"], .side-cols select { width: 100%; }
@media (max-width: 700px) { .modal-grid { grid-template-columns: 1fr; } }
.modal-desc { width: 100%; }
.modal-side select, .modal-side input[type="date"], .modal-side input[type="text"] { width: 100%; margin-bottom: 6px; }
.modal-side input[type="range"] { width: 100%; }
.side-row { display: flex; align-items: center; gap: 7px; padding: 3px 0; font-size: 13px; cursor: pointer; }
.side-label { font-size: 12px; color: var(--muted); }
.side-checks { max-height: 160px; overflow-y: auto; }
.label-form { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.label-form input[type="text"] { flex: 1; min-width: 0; }
.label-form input[type="color"] { width: 34px; height: 30px; padding: 2px; border: 1px solid var(--border); border-radius: 6px; }

.modal-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  border-top: 1px solid var(--border); margin-top: 18px; padding-top: 14px;
  position: sticky; bottom: 0; background: #fff;
}
.modal-foot-tip { margin-right: auto; }

.checklist li { display: flex; align-items: center; gap: 8px; padding: 5px 0; }
.checklist .done { text-decoration: line-through; color: var(--muted); }
.checklist .icon-btn { margin-left: auto; }
.comment-form { margin-bottom: 12px; }
.comment-form .btn { margin-top: 6px; }
.comment-list li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.comment-body { margin-top: 4px; font-size: 13px; line-height: 1.55; }

/* ---------- 版本号与品牌 ---------- */
.logo .ver { font-size: 11px; font-weight: 400; color: #86efac; opacity: .85; }
.logo small { font-size: 13px; font-weight: 500; color: #bbf7d0; }
.login-logo small { font-size: 16px; font-weight: 500; color: var(--muted); }
.login-ver { text-align: center; color: #9ca3af; font-size: 12px; margin-top: 18px; }
.login-opts { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; font-size: 13px; }

/* ---------- 表格横向滚动 ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap .table { min-width: 600px; }

/* ---------- 部门 ---------- */
.dept-tree { list-style: none; margin: 0; padding: 0; }
.dept-tree > li { border-bottom: 1px solid var(--border); }
.dept-row { display: flex; align-items: center; gap: 10px; padding: 10px 4px; flex-wrap: wrap; }
.dept-name { font-weight: 600; min-width: 140px; }
.dept-members { flex: 1; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dept-chip {
  display: inline-flex; align-items: center; gap: 3px; background: #f0fdf4; color: #166534;
  border: 1px solid #bbf7d0; border-radius: 12px; padding: 1px 9px; font-size: 12px; cursor: pointer;
}
.dept-chip.leader { background: #fefce8; color: #854d0e; border-color: #fde68a; }
.dept-chip-x { font-weight: 400; color: #9ca3af; cursor: pointer; }
.dept-chip-x:hover { color: var(--danger); }
.dept-add-select { font-size: 12px; padding: 3px 6px; }
.dept-actions { display: flex; gap: 6px; }

/* ---------- 附件 ---------- */
.attach-btn { cursor: pointer; margin-left: 8px; }
.attach-list { list-style: none; margin: 0; padding: 0; }
.attach-list li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.attach-list li:last-child { border-bottom: none; }
.attach-list .icon-btn { margin-left: auto; }

/* ---------- 自动化 ---------- */
.auto-list { list-style: none; margin: 0 0 14px; padding: 0; }
.auto-list li { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.auto-list li.auto-off { opacity: .45; }
.auto-actions { margin-left: auto; display: flex; }
.auto-form { display: flex; flex-direction: column; gap: 6px; }
.auto-form select { width: 100%; }

/* ---------- 甘特图 ---------- */
.gantt-panel { padding: 0; }
.gantt-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.gantt { font-size: 12px; }
.gantt-row { display: flex; border-bottom: 1px solid var(--border); min-height: 34px; }
.gantt-row:last-child { border-bottom: none; }
.gantt-label {
  width: 220px; flex-shrink: 0; padding: 8px 10px; border-right: 1px solid var(--border);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: sticky; left: 0;
  background: var(--panel); z-index: 2;
}
.gantt-group { background: #f9fafb; }
.gantt-group .gantt-label { font-weight: 600; background: #f9fafb; }
.gantt-days { position: relative; }
.gantt-head { border-bottom: 2px solid var(--border); }
.gantt-months { display: flex; }
.gantt-months span {
  display: inline-block; padding: 4px 0 2px 6px; font-weight: 600; color: var(--muted);
  border-right: 1px solid var(--border); white-space: nowrap; overflow: hidden;
}
.gantt-daynums { display: flex; }
.gantt-daynums span { display: inline-block; text-align: center; color: var(--muted); padding: 2px 0 4px; }
.gantt-daynums .g-weekend { background: #f3f4f6; }
.gantt-daynums .g-today { background: #dcfce7; color: var(--primary-dark); font-weight: 700; border-radius: 4px; }
.gantt-grid {
  background-image: repeating-linear-gradient(to right, transparent, transparent 29px, var(--border) 29px, var(--border) 30px);
}
.gantt-bar {
  position: absolute; top: 5px; height: 24px; line-height: 24px; border-radius: 6px;
  color: #fff; font-size: 12px; padding: 0 8px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; text-decoration: none; z-index: 1;
}
.gantt-bar:hover { text-decoration: none; filter: brightness(1.08); }
.gantt-bar.g-normal { background: #3b82f6; }
.gantt-bar.g-done { background: #16a34a; opacity: .75; }
.gantt-bar.g-blocked { background: #d97706; }
.gantt-bar.g-over { background: #dc2626; }
.gantt-todayline { position: absolute; top: 0; bottom: 0; width: 2px; background: #16a34a; opacity: .5; z-index: 0; }

/* ---------- 日期时间成对输入 ---------- */
.dt-row { display: flex; gap: 6px; }
.dt-row input[type="date"] { flex: 1.4; min-width: 0; }
.dt-row input[type="time"] { flex: 1; min-width: 0; }
.modal-side .dt-row input { margin-bottom: 6px; }

/* ---------- 承办人标识 ---------- */
.avatar-owner { box-shadow: 0 0 0 2px #f59e0b; }

/* ---------- 项目池 ---------- */
.pool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.pool-card { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; border-top: 3px solid var(--border); }
.pool-card h3 { margin: 0 0 6px; font-size: 15px; }
.pool-desc { min-height: 34px; margin: 0 0 8px; }
.pool-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
.pool-assign-select { font-size: 12px; padding: 4px 6px; }
.prio-border-urgent { border-top-color: #dc2626; }
.prio-border-high { border-top-color: #f59e0b; }
.prio-border-normal { border-top-color: #3b82f6; }
.prio-border-low { border-top-color: #9ca3af; }

/* ---------- 团队视图 ---------- */
.team-member summary { display: flex; align-items: center; gap: 8px; cursor: pointer; flex-wrap: wrap; list-style: none; }
.team-member summary::-webkit-details-marker { display: none; }
.team-member summary::before { content: '▸'; color: var(--muted); }
.team-member[open] summary::before { content: '▾'; }
.team-badges { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.tbadge { background: var(--bg); border-radius: 10px; padding: 2px 9px; font-size: 12px; color: var(--muted); }
.tbadge-danger { background: #fee2e2; color: #991b1b; }
.tbadge-warn { background: #fef3c7; color: #92400e; }
.tbadge-ok { background: #dcfce7; color: #166534; }

/* ---------- 日历 ---------- */
.cal-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.cal-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.cal-title { margin: 0 8px; font-size: 17px; }
.cal-legend { margin-left: auto; }
.cal-legend .lg { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin: 0 3px 0 8px; vertical-align: middle; }
.lg-task { background: #3b82f6; }
.lg-hot { background: #dc2626; }
.lg-blocked { background: #d97706; }
.lg-todo { background: #8b5cf6; }
.lg-done { background: #9ca3af; }
.cal-panel { padding: 12px; }

.cal-chip {
  display: block; margin: 2px 0; padding: 2px 7px; border-radius: 5px;
  background: #3b82f6; color: #fff; font-size: 12px; line-height: 1.5;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none;
}
.cal-chip:hover { text-decoration: none; filter: brightness(1.1); }
.cal-chip.chip-hot { background: #dc2626; }
.cal-chip.chip-blocked { background: #d97706; }
.cal-chip.chip-todo { background: #8b5cf6; }
.cal-chip.chip-done { background: #e5e7eb; color: #9ca3af; text-decoration: line-through; }

/* 月视图 */
.cal-month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.cal-mhead { background: #f9fafb; text-align: center; font-size: 12px; color: var(--muted); padding: 7px 0; }
.cal-mcell { background: var(--panel); min-height: 96px; padding: 4px; overflow: hidden; }
.cal-mcell.cal-dim { background: #fafafa; }
.cal-mcell.cal-dim .cal-daynum { color: #c4c8cf; }
.cal-mcell.cal-today { background: #f0fdf4; }
.cal-mcell.cal-today .cal-daynum { background: var(--primary); color: #fff; }
.cal-daynum { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; font-size: 12px; color: var(--text); margin-bottom: 3px; }
.cal-daynum:hover { background: var(--bg); text-decoration: none; }
.cal-more { display: block; font-size: 11px; color: var(--muted); padding: 1px 6px; }

/* 周视图 */
.cal-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal-wcol { background: #f9fafb; border-radius: 8px; min-height: 300px; padding: 6px; }
.cal-wcol.cal-today { background: #f0fdf4; outline: 2px solid #86efac; }
.cal-whead { display: block; text-align: center; color: var(--muted); font-size: 12px; padding: 4px 0 8px; }
.cal-whead b { font-size: 16px; color: var(--text); }
.cal-empty { display: block; text-align: center; padding-top: 20px; }

/* 日视图 */
.cal-allday { display: flex; gap: 10px; padding: 8px 0; border-bottom: 2px solid var(--border); margin-bottom: 4px; align-items: flex-start; }
.cal-allday > div { flex: 1; }
.cal-hlabel { width: 52px; flex-shrink: 0; color: var(--muted); font-size: 12px; padding-top: 3px; }
.cal-hour { display: flex; gap: 10px; border-bottom: 1px solid var(--border); min-height: 36px; padding: 3px 0; }
.cal-hour:last-child { border-bottom: none; }
.cal-hitems { flex: 1; }
.cal-hitems .cal-chip { display: inline-block; margin-right: 4px; }

/* 年/季视图 */
.cal-minis { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 8px; }
.mini-month { background: #f9fafb; border-radius: 8px; padding: 10px; }
.mini-title { display: block; font-weight: 700; margin-bottom: 6px; color: var(--text); }
.mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.mini-w { font-size: 10px; color: var(--muted); }
.mini-d { font-size: 11px; color: var(--text); padding: 2px 0; border-radius: 4px; position: relative; }
.mini-d:hover { background: var(--bg); text-decoration: none; }
.mini-d.mini-today { background: var(--primary); color: #fff; }
.mini-d.mini-has i { display: block; width: 4px; height: 4px; border-radius: 50%; background: #3b82f6; margin: 0 auto; }
.mini-d.mini-today.mini-has i { background: #fff; }

/* ---------- 响应式适配 ---------- */
.hamburger { display: none; border: none; background: none; font-size: 20px; cursor: pointer; padding: 4px 10px; color: var(--text); }
.sidebar-mask { display: none; }

@media (max-width: 1024px) {
  .search-form input { width: 200px; }
  .content { padding: 16px; }
}

@media (max-width: 768px) {
  .hamburger { display: block; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 60; height: 100vh;
    transform: translateX(-100%); transition: transform .25s ease;
  }
  .app.nav-open .sidebar { transform: translateX(0); }
  .app.nav-open .sidebar-mask {
    display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 55;
  }
  .topbar { padding: 10px 12px; gap: 8px; }
  .search-form { flex: 1; }
  .search-form input { width: 100%; }
  .today { display: none; }
  .content { padding: 12px; }
  h1 { font-size: 19px; }

  /* 看板：列表占屏 82%，横向滑动翻列 */
  .kanban { gap: 10px; scroll-snap-type: x proximity; }
  .list { width: 82vw; max-width: 320px; scroll-snap-align: start; max-height: calc(100vh - 190px); }

  /* 弹窗全屏化 */
  .modal-mask { padding: 0; }
  .modal { max-width: none; min-height: 100vh; border-radius: 0; padding: 14px; }
  .modal-grid { grid-template-columns: 1fr; gap: 14px; }

  .drawer { width: 88vw; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-num { font-size: 22px; }
  .form-grid { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .board-grid { grid-template-columns: 1fr; }
  .gantt-label { width: 120px; }
  .dept-row { flex-direction: column; align-items: flex-start; gap: 6px; }
  .dept-name { min-width: 0; }

  /* 日历移动端：月视图缩小，周视图纵向排列 */
  .cal-mcell { min-height: 64px; }
  .cal-mcell .cal-chip { font-size: 10px; padding: 1px 3px; }
  .cal-week { grid-template-columns: 1fr; }
  .cal-wcol { min-height: 0; }
  .cal-legend { display: none; }
  .team-badges { margin-left: 0; }
}

@media (max-width: 480px) {
  .list { width: 88vw; }
  .login-box { width: 92vw; padding: 26px 20px; }
}

/* ---------- 通知页 ---------- */
.notify-list li { display: flex; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.notify-list li:last-child { border-bottom: none; }
.notify-list li.unread { background: #f0fdf4; }
.notify-icon { font-size: 18px; }
.notify-body { flex: 1; }
.notify-list > li > .meta { white-space: nowrap; }
