/* style.css — 阶段3 落地UI样式：亮/暗双主题 + 移动端全屏弹窗 + 通知搜索 + 甘特拖拽 */
/* 阶段2 基础：设计 token + 视觉精修 + 动效 + 汉堡菜单 + 空状态插画 */

:root {
  /* 品牌色（G4 热带，文档 §7.5） */
  --primary: #FF911F;
  --primary-light: #FFB870;
  --primary-dark: #E67E00;
  --primary-bg: #FFF3E0;
  --accent: #49BBCA;
  --accent-dark: #2E8E9B;
  --accent2: #C1D236;
  /* 中性色（亮色主题） */
  --bg: #F4F2ED;
  --bg-deep: #EDEAE2;
  --card: #FFFFFF;
  --ink: #1F1E1B;
  --text: #2c2c29;
  --muted: #6B6A66;
  --faint: #A3A29E;
  --link: #555555;
  /* 状态色 */
  --st-blue: #49BBCA;
  --st-blue-bg: #E5F4F6;
  --st-yellow: #E8C94A;
  --st-yellow-bg: #FAF1D0;
  --st-green: #8FA832;
  --st-green-bg: #EDF1D6;
  --st-red: #E64D67;
  --st-red-bg: #FBE4E9;
  --st-gray: #C5C3BD;
  --st-gray-bg: #EFEEE9;
  /* 边线 */
  --border: #E8E5DE;
  --border-light: #F0EDE6;
  /* 圆角 */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-pill: 999px;
  /* 阴影 */
  --sh-1: 0 1px 3px rgba(44,44,41,.04), 0 1px 2px rgba(44,44,41,.06);
  --sh-2: 0 4px 14px rgba(44,44,41,.06), 0 2px 4px rgba(44,44,41,.04);
  --sh-3: 0 14px 44px rgba(44,44,41,.12), 0 4px 12px rgba(44,44,41,.06);
  --sh-inset: inset 0 0 0 1px rgba(232,229,222,.6);
  /* 动效 */
  --t: 180ms cubic-bezier(.4,0,.2,1);
  --t-fast: 120ms cubic-bezier(.4,0,.2,1);
  --t-slow: 280ms cubic-bezier(.4,0,.2,1);
  /* 表面色（供背景/描边使用） */
  --topbar-bg: rgba(255,255,255,.92);
  --login-card-bg: rgba(255,255,255,.85);
  --unread-bg: #FFFAF2;
  --overdue-bg: #FDF4F6;
  --grad-row: linear-gradient(90deg, #FAFAF7, #FFFFFF);
  --modal-foot-bg: #FAFAF7;
  --scroll-thumb: rgba(0,0,0,.12);
  --scroll-thumb-hover: rgba(0,0,0,.22);
}

/* ---------- 暗色主题 ---------- */
html[data-theme="dark"] {
  --primary-bg: #3A2B16;
  --bg: #131312;
  --bg-deep: #1B1B19;
  --card: #1F1F1D;
  --ink: #F0EEE7;
  --text: #D5D3CC;
  --muted: #9A988F;
  --faint: #6B6A63;
  --link: #B5B3AB;
  --st-blue-bg: #17303A;
  --st-yellow-bg: #38301A;
  --st-green-bg: #262F18;
  --st-red-bg: #3A1E26;
  --st-gray-bg: #2A2925;
  --border: #2F2E2A;
  --border-light: #282723;
  --sh-1: 0 1px 3px rgba(0,0,0,.45), 0 1px 2px rgba(0,0,0,.5);
  --sh-2: 0 4px 14px rgba(0,0,0,.4), 0 2px 4px rgba(0,0,0,.3);
  --sh-3: 0 14px 44px rgba(0,0,0,.55), 0 4px 12px rgba(0,0,0,.35);
  --sh-inset: inset 0 0 0 1px rgba(255,255,255,.06);
  --topbar-bg: rgba(31,31,29,.88);
  --login-card-bg: rgba(31,31,29,.8);
  --unread-bg: #2A2418;
  --overdue-bg: #2B1B21;
  --grad-row: linear-gradient(90deg, var(--bg-deep), var(--card));
  --modal-foot-bg: #1A1A18;
  --scroll-thumb: rgba(255,255,255,.16);
  --scroll-thumb-hover: rgba(255,255,255,.28);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--t), color var(--t);
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(ellipse 600px 400px at 10% -10%, rgba(255,145,31,.05), transparent),
    radial-gradient(ellipse 500px 400px at 110% 10%, rgba(73,187,202,.05), transparent);
}
html[data-theme="dark"] body::before {
  background:
    radial-gradient(ellipse 600px 400px at 10% -10%, rgba(255,145,31,.06), transparent),
    radial-gradient(ellipse 500px 400px at 110% 10%, rgba(73,187,202,.05), transparent);
}
a { color: var(--link); text-decoration: none; cursor: pointer; }
h1,h2,h3 { color: var(--ink); font-weight: 700; }
h2 { margin: 0; font-size: 22px; letter-spacing: -.2px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.faint { color: var(--faint); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--scroll-thumb-hover); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); border-radius: var(--r-sm); cursor: pointer;
  font-size: 14px; line-height: 1.4; font-family: inherit;
  transition: all var(--t-fast);
}
.btn:hover { border-color: var(--faint); transform: translateY(-1px); box-shadow: var(--sh-1); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; box-shadow: 0 1px 0 rgba(0,0,0,.04); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); box-shadow: 0 6px 18px rgba(255,145,31,.32); }
.btn-danger { background: var(--st-red); border-color: var(--st-red); color: #fff; }
.btn-danger:hover { background: #C8405A; border-color: #C8405A; box-shadow: 0 6px 18px rgba(230,77,103,.32); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--st-gray-bg); color: var(--ink); transform: none; box-shadow: none; }
.btn-sm { padding: 5px 11px; font-size: 13px; }
.btn-block { width: 100%; }

/* ---------- 输入 ---------- */
.input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--r-sm);
  font-size: 15px; background: var(--card); color: var(--text); font-family: inherit;
  transition: all var(--t-fast);
}
.input:hover { border-color: var(--faint); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(73,187,202,.14); }
input[type="date"].input { color-scheme: light; }
html[data-theme="dark"] input[type="date"].input { color-scheme: dark; }
label { display: block; margin: 14px 0 4px; font-size: 13px; color: var(--muted); font-weight: 500; }
label:first-child { margin-top: 0; }
textarea.input { resize: vertical; min-height: 64px; }
.chk { display: inline-flex; align-items: center; gap: 6px; margin: 12px 0 4px; font-size: 14px; color: var(--text); cursor: pointer; }
.chk input { width: 16px; height: 16px; accent-color: var(--primary); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #FFF3E0 0%, #F4F2ED 45%, #E5F4F6 100%);
  transition: background var(--t);
}
html[data-theme="dark"] .login-wrap {
  background: linear-gradient(135deg, #241A0E 0%, #131312 45%, #0E1E24 100%);
}
.login-wrap::before, .login-wrap::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; pointer-events: none;
  animation: float 8s ease-in-out infinite;
}
.login-wrap::before { width: 380px; height: 380px; top: -80px; left: -80px; background: radial-gradient(circle, #FFB870, transparent 70%); }
.login-wrap::after { width: 460px; height: 460px; bottom: -100px; right: -100px; background: radial-gradient(circle, #49BBCA, transparent 70%); animation-delay: 2s; }
@keyframes float { 0%,100% { transform: translate(0,0); } 50% { transform: translate(20px, -20px); } }
.login-card {
  position: relative; z-index: 1;
  background: var(--login-card-bg); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 20px; padding: 40px 36px; width: 380px; box-shadow: var(--sh-3);
  animation: cardIn 500ms cubic-bezier(.16,1,.3,1) both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(20px) scale(.96); } to { opacity: 1; transform: none; } }
.login-logo { display: flex; align-items: center; gap: 10px; font-size: 28px; font-weight: 800; color: var(--ink); letter-spacing: .5px; }
.login-logo-mark { width: 36px; height: 36px; background: linear-gradient(135deg, var(--primary), var(--primary-light)); border-radius: 10px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 18px; box-shadow: 0 4px 12px rgba(255,145,31,.35); }
.login-title { font-size: 22px; font-weight: 700; color: var(--ink); margin: 16px 0 4px; }
.login-sub { font-size: 13px; color: var(--muted); margin-bottom: 24px; }
.login-card .input { margin-top: 12px; }
.login-card .btn { margin-top: 22px; height: 42px; font-size: 15px; }
.login-tip { margin-top: 18px; font-size: 12px; color: var(--faint); text-align: center; line-height: 1.7; }
.login-tip code { background: var(--st-gray-bg); padding: 1px 5px; border-radius: 4px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink); font-size: 11px; }

/* ---------- 主框架 ---------- */
.shell { display: flex; flex-direction: column; min-height: 100vh; position: relative; z-index: 1; }
.topbar {
  display: flex; align-items: center; gap: 20px; background: var(--topbar-bg); padding: 0 20px; height: 60px;
  border-bottom: 1px solid var(--border); box-shadow: var(--sh-1); position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 800; color: var(--ink); white-space: nowrap; }
.brand-mark { width: 28px; height: 28px; background: linear-gradient(135deg, var(--primary), var(--primary-light)); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 14px; box-shadow: 0 3px 8px rgba(255,145,31,.3); }
.tabs { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; padding: 19px 14px; font-size: 14px; color: var(--muted); white-space: nowrap; transition: color var(--t-fast); }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--primary-dark); font-weight: 700; }
.tab.active::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 3px; background: linear-gradient(90deg, var(--primary), var(--primary-light)); border-radius: 3px 3px 0 0; }
.top-right { display: flex; align-items: center; gap: 8px; }
.user { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); padding: 4px 8px; border-radius: var(--r-pill); }
.user-name { font-weight: 500; }
.user-avatar { width: 30px; height: 30px; background: linear-gradient(135deg, var(--accent), var(--accent-dark)); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; overflow: hidden; }
.user-avatar.leader { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); }
.user-avatar.img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-preview { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; display: block; margin: 6px auto 0; }
.avatar-placeholder { background: linear-gradient(135deg, var(--accent), var(--accent-dark)); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 40px; font-weight: 700; }
.member-avatar { overflow: hidden; }
.member-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ann-avatar { overflow: hidden; }
.ann-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bell { position: relative; cursor: pointer; color: var(--muted); padding: 8px; border-radius: 50%; display: flex; transition: all var(--t-fast); }
.bell:hover { color: var(--ink); background: var(--st-gray-bg); }
.bell-dot { position: absolute; top: 4px; right: 4px; background: var(--st-red); color: #fff; font-size: 10px; min-width: 16px; height: 16px; border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 0 4px; font-weight: 700; box-shadow: 0 0 0 2px var(--topbar-bg); }
.role { font-size: 11px; padding: 2px 8px; border-radius: var(--r-pill); font-weight: 600; }
.role-leader { background: linear-gradient(135deg, var(--primary-bg), #FFE0B2); color: var(--primary-dark); }
html[data-theme="dark"] .role-leader { background: var(--primary-bg); color: var(--primary-light); }
.role-rookie { background: var(--st-gray-bg); color: var(--muted); }

/* 主题切换按钮 */
.theme-btn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border: 1px solid var(--border); border-radius: var(--r-pill);
  background: var(--card); color: var(--muted); cursor: pointer; transition: all var(--t-fast);
}
.theme-btn:hover { color: var(--primary); border-color: var(--primary-light); box-shadow: var(--sh-1); }
.theme-btn svg { display: block; }

.hamburger { display: none; background: transparent; border: none; padding: 8px; cursor: pointer; color: var(--ink); border-radius: var(--r-sm); }
.hamburger:hover { background: var(--st-gray-bg); }
.hamburger svg { display: block; }

.layout { display: flex; flex: 1; }
.sidebar {
  width: 220px; flex: none; background: var(--card); border-right: 1px solid var(--border);
  padding: 14px 10px; overflow-y: auto;
}
.menu-item { position: relative; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--r-sm); color: var(--text); font-size: 14px; margin-bottom: 2px; transition: all var(--t-fast); }
.menu-item:hover { background: var(--st-gray-bg); color: var(--ink); }
.menu-item.active { background: linear-gradient(135deg, var(--primary-bg), var(--primary-bg)); color: var(--primary-dark); font-weight: 700; box-shadow: var(--sh-inset); }
html[data-theme="dark"] .menu-item.active { color: var(--primary-light); }
.menu-item .mi-icon { width: 18px; height: 18px; flex: none; opacity: .75; }
.menu-item.active .mi-icon { opacity: 1; color: var(--primary); }
.nav-badge { display: inline-block; background: var(--st-red); color: #fff; font-size: 10px; min-width: 18px; height: 18px; line-height: 18px; border-radius: var(--r-pill); text-align: center; padding: 0 6px; margin-left: auto; font-weight: 700; box-shadow: 0 2px 6px rgba(230,77,103,.4); }
.content { flex: 1; padding: 28px; min-width: 0; }
.content.fade { animation: contentIn 320ms cubic-bezier(.16,1,.3,1) both; }
@keyframes contentIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 12px; flex-wrap: wrap; }
.page-head h2 { display: flex; align-items: center; gap: 10px; }
.page-head h2::before { content: ""; width: 4px; height: 22px; background: linear-gradient(180deg, var(--primary), var(--primary-light)); border-radius: 2px; }
.head-actions { display: flex; gap: 8px; }

/* ---------- 通知面板 ---------- */
.notif-panel {
  position: absolute; top: 48px; right: 0; width: 380px; max-height: 520px; overflow: hidden; display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--sh-3); z-index: 100; animation: panelIn 200ms cubic-bezier(.16,1,.3,1) both;
}
@keyframes panelIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px 0; font-weight: 700; color: var(--ink); gap: 8px; }
.notif-head .notif-title { font-size: 15px; }
.notif-search { padding: 10px 16px 0; }
.notif-search .input { font-size: 13px; padding: 7px 10px; }
.notif-chips { display: flex; gap: 6px; padding: 10px 16px 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--border); background: transparent; color: var(--muted);
  padding: 3px 12px; border-radius: var(--r-pill); font-size: 12px; cursor: pointer; font-family: inherit;
  transition: all var(--t-fast);
}
.chip:hover { color: var(--ink); border-color: var(--faint); }
.chip.active { background: var(--primary-bg); border-color: var(--primary-light); color: var(--primary-dark); font-weight: 600; }
html[data-theme="dark"] .chip.active { color: var(--primary-light); }
.notif-list { flex: 1; overflow-y: auto; border-top: 1px solid var(--border-light); margin-top: 8px; }
.notif-item { display: flex; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border-light); font-size: 13px; cursor: pointer; transition: background var(--t-fast); }
.notif-item:hover { background: var(--st-gray-bg); }
.notif-item.unread { background: var(--unread-bg); }
.notif-cat-icon { width: 30px; height: 30px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; font-weight: 700; box-shadow: var(--sh-1); }
.nci-blue { background: linear-gradient(135deg, var(--accent), var(--accent-dark)); }
.nci-yellow { background: linear-gradient(135deg, #F0C73A, var(--st-yellow)); }
.nci-green { background: linear-gradient(135deg, #A8C247, var(--st-green)); }
.nci-red { background: linear-gradient(135deg, #EC6E83, var(--st-red)); }
.nci-orange { background: linear-gradient(135deg, #FFB870, var(--primary)); }
.notif-item-body { flex: 1; min-width: 0; }
.notif-content { color: var(--text); line-height: 1.5; }
.notif-time { display: block; font-size: 11px; color: var(--faint); margin-top: 2px; }
.notif-empty { padding: 40px 24px; text-align: center; color: var(--faint); }
.notif-empty .empty-illu { margin: 0 auto 12px; }

/* ---------- 徽标 ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: var(--r-pill); font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-blue { background: var(--st-blue-bg); color: var(--accent-dark); }
html[data-theme="dark"] .badge-blue { color: #7FD4DF; }
.badge-yellow { background: var(--st-yellow-bg); color: #8a6d00; }
html[data-theme="dark"] .badge-yellow { color: #E8D27A; }
.badge-green { background: var(--st-green-bg); color: #5d6f1f; }
html[data-theme="dark"] .badge-green { color: #B5CC6B; }
.badge-red { background: var(--st-red-bg); color: #B2324D; }
html[data-theme="dark"] .badge-red { color: #EF8CA0; }
.badge-gray { background: var(--st-gray-bg); color: var(--muted); }
.overdue-tag { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--st-red); font-weight: 700; }
.overdue-tag::before { content: "!"; display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; background: var(--st-red); color: #fff; border-radius: 50%; font-size: 10px; font-weight: 800; }

/* ---------- toast / modal ---------- */
.toast { position: fixed; top: 24px; left: 50%; transform: translateX(-50%) translateY(-20px); background: var(--ink); color: var(--card); padding: 10px 20px; border-radius: var(--r-sm); font-size: 14px; opacity: 0; transition: all var(--t); z-index: 999; pointer-events: none; box-shadow: var(--sh-2); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--st-red); color: #fff; }
.toast.ok { background: var(--st-green); color: #fff; }

.modal-mask { position: fixed; inset: 0; background: rgba(31,30,27,.5); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 500; padding: 20px; animation: maskIn 200ms ease both; }
@keyframes maskIn { from { opacity: 0; } to { opacity: 1; } }
.modal { background: var(--card); border-radius: var(--r-lg); width: 100%; max-width: 560px; max-height: 88vh; overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--sh-3); animation: modalIn 280ms cubic-bezier(.16,1,.3,1) both; }
@keyframes modalIn { from { opacity: 0; transform: translateY(20px) scale(.96); } to { opacity: 1; transform: none; } }
.modal-head { padding: 18px 22px; font-size: 16px; font-weight: 700; color: var(--ink); border-bottom: 1px solid var(--border-light); display: flex; align-items: center; gap: 10px; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border-light); display: flex; justify-content: flex-end; gap: 8px; background: var(--modal-foot-bg); }

/* ---------- 空状态插画 ---------- */
.empty { text-align: center; color: var(--faint); padding: 48px 20px; }
.empty-illu { width: 96px; height: 96px; margin: 0 auto 16px; opacity: .85; }
.empty-title { font-size: 14px; color: var(--ink); font-weight: 600; margin-bottom: 4px; }
.empty-tip { font-size: 12px; color: var(--faint); margin-top: 4px; }

/* ---------- 看板 ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.kpi {
  background: var(--card); border-radius: var(--r-md); padding: 20px 22px;
  border: 1px solid var(--border); position: relative; overflow: hidden;
  transition: all var(--t);
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--sh-2); border-color: transparent; }
.kpi::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--st-blue); }
.kpi-yellow::before { background: var(--st-yellow); }
.kpi-green::before { background: var(--st-green); }
.kpi-red::before { background: var(--st-red); }
.kpi-icon { position: absolute; right: 16px; top: 16px; width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 16px; opacity: .9; }
.kpi.kpi-blue .kpi-icon { background: var(--st-blue-bg); color: var(--accent-dark); }
html[data-theme="dark"] .kpi.kpi-blue .kpi-icon { color: #7FD4DF; }
.kpi.kpi-yellow .kpi-icon { background: var(--st-yellow-bg); color: #8a6d00; }
html[data-theme="dark"] .kpi.kpi-yellow .kpi-icon { color: #E8D27A; }
.kpi.kpi-green .kpi-icon { background: var(--st-green-bg); color: #5d6f1f; }
html[data-theme="dark"] .kpi.kpi-green .kpi-icon { color: #B5CC6B; }
.kpi.kpi-red .kpi-icon { background: var(--st-red-bg); color: #B2324D; }
html[data-theme="dark"] .kpi.kpi-red .kpi-icon { color: #EF8CA0; }
.kpi-num { font-size: 32px; font-weight: 800; color: var(--ink); line-height: 1.1; }
.kpi-label { font-size: 13px; color: var(--muted); margin-top: 4px; }

.dash-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; margin-bottom: 20px; }
.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-md); padding: 20px 22px; margin-bottom: 20px; transition: all var(--t); }
.panel:hover { border-color: var(--border-light); }
.panel-title { font-size: 15px; font-weight: 700; color: var(--ink); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.panel-title::before { content: ""; width: 3px; height: 14px; background: var(--primary); border-radius: 2px; }

.member-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--border-light); }
.member-row:last-child { border-bottom: none; }
.member-avatar { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-dark)); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex: none; }
.member-avatar.leader { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); }
.member-name { width: 64px; font-size: 14px; color: var(--text); font-weight: 500; }
.bar { flex: 1; height: 8px; background: var(--st-gray-bg); border-radius: var(--r-pill); overflow: hidden; position: relative; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-dark)); border-radius: var(--r-pill); transition: width 600ms cubic-bezier(.4,0,.2,1); position: relative; }
.bar-fill::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.4), transparent); animation: shimmer 2.4s linear infinite; }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.member-pct { width: 92px; text-align: right; font-size: 13px; color: var(--muted); font-weight: 500; }

.stat-line { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px dashed var(--border-light); font-size: 14px; }
.stat-line:last-child { border-bottom: none; }
.stat-line span { color: var(--muted); }
.stat-line b { color: var(--ink); font-weight: 700; }

.feed { position: relative; padding-left: 22px; }
.feed::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.feed-item { position: relative; padding: 6px 0 12px; font-size: 13px; color: var(--text); line-height: 1.5; }
.feed-dot { position: absolute; left: -22px; top: 10px; width: 10px; height: 10px; background: var(--card); border: 3px solid var(--accent); border-radius: 50%; box-shadow: 0 0 0 3px var(--card); }
.feed-dot.kind-change { border-color: var(--primary); }
.feed-dot.kind-annotation { border-color: var(--accent2); }
.ann-time { font-size: 11px; color: var(--faint); margin-left: 8px; }

/* ---------- 任务列表 ---------- */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; padding: 12px 14px; background: var(--card); border: 1px solid var(--border); border-radius: var(--r-md); }
.filter-bar .input { width: auto; font-size: 14px; }
.filter-bar #f-kw { flex: 1; min-width: 140px; }
.task-list { display: flex; flex-direction: column; gap: 12px; }
.task-group { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; transition: all var(--t); }
.task-group:hover { box-shadow: var(--sh-1); }
.task-parent { display: flex; align-items: center; gap: 14px; padding: 14px 18px; background: var(--grad-row); border-bottom: 1px solid var(--border-light); cursor: pointer; transition: all var(--t-fast); position: relative; }
.task-parent::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--primary); opacity: 0; transition: opacity var(--t); }
.task-parent:hover::before { opacity: 1; }
.parent-title { font-weight: 700; color: var(--ink); font-size: 15px; flex: 1; display: flex; align-items: center; gap: 6px; }
.parent-title .ms { color: var(--primary); }
.task-sub { display: flex; align-items: center; gap: 14px; padding: 12px 18px 12px 32px; border-bottom: 1px solid var(--border-light); cursor: pointer; transition: all var(--t-fast); position: relative; }
.task-sub:last-child { border-bottom: none; }
.task-sub:hover { background: var(--bg-deep); }
.task-sub::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); opacity: 0; transition: opacity var(--t); }
.task-sub:hover::before { opacity: 1; }
.task-sub.overdue { background: var(--overdue-bg); }
.task-sub.overdue::before { background: var(--st-red); opacity: 1; }
.sub-title { flex: 1; font-size: 14px; color: var(--text); }
.task-ops { display: flex; gap: 6px; flex: none; }

/* ---------- 甘特图 ---------- */
.gantt-gran { gap: 4px; padding: 4px; background: var(--st-gray-bg); border-radius: var(--r-sm); }
.gantt-gran .btn { border: none; background: transparent; }
.gantt-gran .btn.btn-primary { background: var(--card); color: var(--primary-dark); box-shadow: var(--sh-1); }
html[data-theme="dark"] .gantt-gran .btn.btn-primary { color: var(--primary-light); }
.gantt-zoom { gap: 2px; }
.gantt-zoom .btn { padding: 5px 9px; font-size: 15px; line-height: 1; }
.gantt-body { display: flex; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--card); overflow: hidden; box-shadow: var(--sh-1); }
.gantt-tree { width: 260px; flex: none; border-right: 1px solid var(--border); background: var(--card); overflow-y: auto; }
.gantt-tree-head { display: flex; align-items: center; padding: 0 14px; font-size: 13px; font-weight: 700; color: var(--muted); border-bottom: 1px solid var(--border); height: 30px; background: var(--bg-deep); }
.gantt-row { display: flex; align-items: center; padding: 0 14px; border-bottom: 1px solid var(--border-light); cursor: pointer; font-size: 13px; transition: background var(--t-fast); }
.gantt-row:hover { background: var(--bg-deep); }
.gantt-row.parent { font-weight: 700; color: var(--ink); background: var(--bg-deep); }
.gantt-row.sub { color: var(--text); }
.gantt-indent { width: 18px; flex: none; }
.gantt-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gantt-name { flex: none; font-size: 12px; }
.gantt-canvas { flex: 1; overflow-x: auto; background: var(--card); position: relative; }
.gantt-canvas svg { display: block; }
.gantt-canvas svg rect { transition: opacity var(--t-fast); }
.gantt-canvas svg .gantt-bar { cursor: pointer; }
.gantt-canvas svg .gantt-bar.draggable { cursor: ew-resize; }
.gantt-canvas svg .gantt-bar.draggable:hover { opacity: .78; }
.gantt-canvas svg .gantt-bar.locked { cursor: not-allowed; }
/* 拖拽幽灵条 + 日期浮层 */
.gantt-ghost { position: absolute; border-radius: 4px; opacity: .42; pointer-events: none; z-index: 5; box-shadow: 0 0 0 1px var(--st-red); }
.gantt-tip {
  position: absolute; z-index: 6; pointer-events: none; white-space: nowrap;
  background: var(--ink); color: var(--card); font-size: 12px; padding: 5px 10px; border-radius: var(--r-sm);
  box-shadow: var(--sh-2); transform: translateX(-50%);
}
.gantt-hint { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--faint); margin-left: 10px; }
.gantt-hint svg { display: block; }

/* ---------- 审批中心 ---------- */
.seg-tabs { display: flex; gap: 4px; margin-bottom: 18px; padding: 4px; background: var(--st-gray-bg); border-radius: var(--r-sm); width: fit-content; }
.seg { padding: 8px 18px; border: none; background: transparent; border-radius: var(--r-sm); cursor: pointer; font-size: 14px; color: var(--muted); transition: all var(--t-fast); display: flex; align-items: center; gap: 8px; font-family: inherit; }
.seg:hover { color: var(--ink); }
.seg.active { background: var(--card); color: var(--primary-dark); font-weight: 700; box-shadow: var(--sh-1); }
html[data-theme="dark"] .seg.active { color: var(--primary-light); }
.appr-list { display: flex; flex-direction: column; gap: 12px; }
.appr-item { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-md); padding: 18px 20px; transition: all var(--t); position: relative; }
.appr-item::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--primary); border-radius: var(--r-md) 0 0 var(--r-md); }
.appr-item:hover { box-shadow: var(--sh-2); transform: translateY(-1px); }
.appr-title { font-size: 15px; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.appr-ops { display: flex; gap: 8px; margin-top: 14px; }

/* ---------- 详情 / 批注 / 历史 ---------- */
.meta { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--text); padding: 4px 0; }
.meta span:first-child { color: var(--faint); min-width: 56px; }
.desc { margin-top: 14px; padding: 12px 14px; background: var(--bg-deep); border-radius: var(--r-sm); font-size: 13px; color: var(--text); line-height: 1.6; border-left: 3px solid var(--accent); }
.actions { display: flex; gap: 8px; margin: 16px 0; flex-wrap: wrap; }
.sub-list { margin: 8px 0 4px; }
.sub-item { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-sm); margin-bottom: 6px; cursor: pointer; font-size: 13px; display: flex; align-items: center; gap: 10px; transition: all var(--t-fast); }
.sub-item:hover { background: var(--bg-deep); border-color: var(--faint); }
.ann-block { margin-top: 18px; padding-top: 18px; border-top: 1px dashed var(--border); }
.ann-title { font-size: 14px; font-weight: 700; color: var(--ink); margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.ann-list { max-height: 240px; overflow-y: auto; margin-bottom: 12px; }
.ann-item { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--border-light); }
.ann-avatar { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-dark)); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex: none; }
.ann-avatar.leader { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); }
.ann-body { flex: 1; min-width: 0; }
.ann-head { font-size: 13px; font-weight: 600; color: var(--ink); display: flex; align-items: baseline; gap: 8px; }
.ann-content { font-size: 13px; color: var(--text); margin-top: 2px; line-height: 1.5; word-break: break-word; }
.ann-form { display: flex; gap: 8px; }
.ann-form .input { flex: 1; font-size: 14px; }
.hist-item { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 8px 0; border-bottom: 1px dashed var(--border-light); flex-wrap: wrap; }
.hist-item:last-child { border-bottom: none; }

/* ---------- 团队 ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 14px 16px; font-size: 14px; border-bottom: 1px solid var(--border-light); }
.table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; background: var(--bg-deep); }
.table tr { transition: background var(--t-fast); }
.table tbody tr:hover { background: var(--bg-deep); }
.table td.ops { text-align: right; }

/* ---------- 快捷键提示条 ---------- */
.kbd-hint {
  display: flex; gap: 14px; flex-wrap: wrap; padding: 8px 12px; margin-bottom: 18px;
  background: var(--bg-deep); border: 1px dashed var(--border); border-radius: var(--r-sm);
  font-size: 12px; color: var(--muted);
}
.kbd-hint b { font-weight: 600; color: var(--ink); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--card); border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; margin-right: 4px; }

/* ---------- v2.0/v2.1 新增：侧边栏收起 + 签到按钮 + 任务表格 + 预留区 + 成员单元格 ---------- */
.sidebar-head { display: flex; align-items: center; justify-content: flex-end; padding: 2px 2px 10px; }
.sidebar-collapse {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border: 1px solid var(--border); background: var(--card);
  color: var(--muted); border-radius: var(--r-sm); cursor: pointer; font-size: 13px; line-height: 1;
  transition: all var(--t-fast); font-family: inherit;
}
.sidebar-collapse:hover { color: var(--ink); border-color: var(--faint); }
.sidebar.collapsed { width: 60px; }
.sidebar.collapsed .menu-item { justify-content: center; padding: 10px 0; }
.sidebar.collapsed .menu-item span, .sidebar.collapsed .menu-item .nav-badge { display: none; }
.sidebar.collapsed .menu-item .mi-icon { margin: 0; }
.sidebar.collapsed ~ .content { } /* 内容区自动伸缩 */

/* 顶栏签到按钮（今日已签/未签） */
.checkin-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: var(--r-pill); font-size: 13px; font-weight: 600;
  border: 1px solid var(--primary-light); color: var(--primary-dark); background: var(--primary-bg);
  cursor: pointer; transition: all var(--t-fast); font-family: inherit; white-space: nowrap;
}
html[data-theme="dark"] .checkin-btn { color: var(--primary-light); }
.checkin-btn:hover { box-shadow: var(--sh-1); transform: translateY(-1px); }
.checkin-btn.done { border-color: var(--st-green); color: #5d6f1f; background: var(--st-green-bg); cursor: default; }
html[data-theme="dark"] .checkin-btn.done { color: #B5CC6B; }

/* 看板预留区标题（用户消息中心 / 自媒体数据中心） */
.reserved-panel h3 { margin: 0; font-size: 16px; color: var(--ink); }

/* 团队成员单元格 / 逾期次数链接 */
.user-cell { display: flex; align-items: center; gap: 10px; }
.linkable { color: var(--primary-dark); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

/* 任务表格（v2.0/v2.1） */
.task-tbl .t-title { min-width: 200px; font-weight: 500; }
.task-tbl tbody tr { cursor: pointer; }
.task-tbl .parent-row .t-title { font-weight: 700; color: var(--ink); }
.task-tbl .sub-row td:first-child { padding-left: 30px; }
.task-tbl tr.overdue { background: var(--overdue-bg); }
.task-tbl .badge { white-space: nowrap; }

/* 签到记录列表 */
.checkin-list { max-height: 320px; overflow-y: auto; }

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
  .dash-grid { grid-template-columns: 1fr; }
  .gantt-tree { width: 180px; }
}
@media (max-width: 768px) {
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: 260px; z-index: 200; transform: translateX(-100%); transition: transform var(--t); box-shadow: var(--sh-3); }
  .sidebar.open { transform: translateX(0); }
  .sidebar.collapsed { width: 260px; } /* 移动端抽屉不缩窄 */
  .sidebar.collapsed .menu-item { justify-content: flex-start; padding: 10px 14px; }
  .sidebar.collapsed .menu-item span, .sidebar.collapsed .menu-item .nav-badge { display: inline; }
  .sidebar-mask { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 150; opacity: 0; pointer-events: none; transition: opacity var(--t); }
  .sidebar-mask.show { opacity: 1; pointer-events: auto; }
  .hamburger { display: flex; }
  .content { padding: 16px; }
  .topbar { gap: 8px; padding: 0 12px; }
  .brand span:not(.brand-mark) { display: none; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .gantt-tree { width: 130px; }
  .row2 { grid-template-columns: 1fr; }
  .filter-bar { gap: 8px; padding: 10px; }
  .user .user-name { display: none; }
  .seg-tabs { width: 100%; }
  .seg { flex: 1; justify-content: center; }
  .notif-panel { width: calc(100vw - 24px); right: -58px; max-height: 70vh; }
  .kbd-hint { display: none; }

  /* 移动端：弹窗全屏抽屉（底部滑入） */
  .modal-mask { padding: 0; align-items: flex-end; }
  .modal {
    max-width: 100%; max-height: 92dvh; width: 100%;
    border-radius: 18px 18px 0 0;
    animation: modalSheet 300ms cubic-bezier(.16,1,.3,1) both;
  }
  @keyframes modalSheet { from { transform: translateY(100%); } to { transform: none; } }
  .modal-body { padding: 18px 18px 12px; }
  .modal-head { padding: 16px 18px; }
  .modal-foot { padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); }
}

/* ============================================================
   移动端响应式优化（v2.2，PC 为主，移动端保证能用不破）
   纯 CSS 实现，不改 JS/HTML
   ============================================================ */

/* 表格横向滚动（任务表 9 列 / 团队表）*/
@media (max-width: 768px) {
  /* 包表格的 panel 变横向滚动容器 */
  .panel:has(table) { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .panel > .table { min-width: 640px; }
  .panel > .table.task-tbl { min-width: 900px; }
  .table th, .table td { padding: 10px 10px; font-size: 13px; white-space: nowrap; }
  .table td.ops { white-space: nowrap; }
  .table td.ops .btn { margin-left: 4px; }

  /* 顶栏：tabs 横向滚动不换行，签到/主题 icon 化 */
  .tabs { overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs .tab { flex: none; padding: 0 10px; white-space: nowrap; }
  .topbar { flex-wrap: nowrap; }
  .top-right { gap: 2px; flex: none; }
  .checkin-btn { font-size: 12px; padding: 4px 8px; }
  #logout { padding: 4px 8px; font-size: 12px; }

  /* 甘特图：树收窄，工具栏换行 */
  .gantt-body { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .gantt-tree { width: 110px; }
  .gantt-canvas { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .head-actions { flex-wrap: wrap; gap: 6px; }

  /* 看板 */
  .kpi-num { font-size: 26px; }
  .member-row { flex-wrap: nowrap; }
  .member-name { width: auto; min-width: 44px; font-size: 13px; }
  .bar { flex: 1; min-width: 40px; }

  /* 登录页 */
  .login-card { width: calc(100vw - 40px); max-width: 360px; padding: 28px 20px; }
  .login-wrap { padding: 24px 0; }

  /* 审批项按钮不溢出 */
  .appr-ops { display: flex; gap: 8px; flex-wrap: wrap; }
  .appr-ops .btn { flex: 1; min-width: 90px; justify-content: center; }

  /* 筛选栏换行 + 搜索框撑满 */
  .filter-bar { flex-wrap: wrap; }
  .filter-bar .input, .filter-bar select { flex: 1 1 auto; min-width: 120px; }
  #f-kw { flex-basis: 100%; }

  /* 签到记录 / 通用弹窗内容 */
  .checkin-list { max-height: 55vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
}

/* 小屏（手机窄屏 480px 以下）补充 */
@media (max-width: 480px) {
  .content { padding: 12px; }
  .panel { padding: 14px; }
  .kpi { padding: 14px; }
  .kpi-num { font-size: 22px; }
  .kpi-icon { width: 32px; height: 32px; right: 12px; top: 12px; }
  .page-head { flex-wrap: wrap; gap: 8px; }
  .page-head h2 { font-size: 20px; }
  .head-actions .btn { font-size: 13px; padding: 6px 10px; }
  .topbar { gap: 4px; padding: 0 8px; }
  .user { padding: 2px 4px; }
  .brand { margin-right: 2px; }
  .feed-item { font-size: 12px; }
  .modal-head { font-size: 16px; }
  .modal-body label { font-size: 13px; }
  .row2 { gap: 10px; }
  .badge { font-size: 11px; padding: 2px 6px; }
  .empty-illu { width: 84px; height: 84px; }
  .checkin-btn { padding: 4px 6px; }
}
