
:root {
  --bg: #f6f3f1; --card-bg: #ffffff;
  --primary: #992824; --primary-light: #faeeeb; --primary-dark: #70201d;
  --text: #292320; --text-secondary: #655b56; --text-tertiary: #766b65;
  --border: #e7ded9; --border-light: #f6f1ee;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-hover: 0 4px 12px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);
  --radius: 12px; --radius-sm: 8px;
  --status-active: #2563eb; --status-active-bg: #eff6ff;
  --status-closed: #655b56; --status-closed-bg: #f6f1ee;
  --status-settled: #059669; --status-settled-bg: #ecfdf5;
  --status-warning: #d97706; --status-warning-bg: #fffbeb;
  --status-danger: #dc2626; --status-danger-bg: #fef2f2;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: radial-gradient(1100px 420px at 72% -120px, rgba(153,40,36,.07), transparent 60%), var(--bg);
  color: var(--text); line-height: 1.6; min-height: 100vh;
}
#loginScreen {
  position: fixed; inset: 0; z-index: 999; overflow: hidden;
  background: linear-gradient(135deg, #382320 0%, #992824 55%, #a63832 100%);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
#loginScreen::before, #loginScreen::after {
  content: ''; position: absolute; border-radius: 50%; pointer-events: none; filter: blur(90px); opacity: .4;
}
#loginScreen::before { width: 520px; height: 520px; background: #bf6558; top: -180px; left: -140px; }
#loginScreen::after { width: 460px; height: 460px; background: #492421; bottom: -160px; right: -120px; }
@keyframes loginCardIn { from { opacity: 0; transform: translateY(24px) scale(.97); } to { opacity: 1; transform: none; } }
.login-card {
  position: relative; z-index: 1;
  background: #fff; border-radius: 18px; padding: 40px 36px 32px;
  width: 100%; max-width: 400px; box-shadow: 0 24px 64px rgba(0,0,0,0.28);
  animation: loginCardIn .45s cubic-bezier(.16,1,.3,1);
}
.login-card .form-submit { box-shadow: 0 10px 24px rgba(153,40,36,.35); }
.login-logo { text-align: center; margin-bottom: 28px; }
.workbench-wordmark {
  font-family: "Avenir Next", Avenir, system-ui, sans-serif;
  font-weight: 800;
  letter-spacing: -0.045em;
  color: #962721;
}
.login-title.workbench-wordmark { font-size: 38px; line-height: 1.1; }
.login-error {
  background: var(--status-danger-bg); color: var(--status-danger);
  border: 1px solid #fecaca; border-radius: var(--radius-sm);
  font-size: 13px; padding: 8px 12px; margin-bottom: 14px; display: none;
}
.header {
  background: rgba(255,255,255,.92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px; position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.header-inner {
  max-width: 1400px; margin: 0 auto; display: flex; align-items: center;
  justify-content: space-between; height: 60px; gap: 16px;
}
.logo { font-size: 20px; font-weight: 700; color: var(--primary); display: flex; align-items: center; gap: 8px; white-space: nowrap; min-width: 0; overflow: hidden; flex-shrink: 1; }
.header .logo > span:last-child { font-size: 16px; }
@media (max-width: 1050px) {
  .header-stats, #saveChip > span { display: none; }
}
@media (max-width: 760px) {
  .header .logo > span:last-child { font-size: 15px; }
}
.header-right { display: flex; align-items: center; gap: 14px; flex-wrap: nowrap; min-width: 0; }
.header-stats { display: flex; gap: 22px; font-size: 13px; color: var(--text-secondary); flex-shrink: 1; overflow: hidden; }
/* 计时中：顶栏要给计时胶囊腾位置，先把案件统计让出去（统计在页面上还有） */
.timer-on .header-stats { display: none !important; }
.header-stat { display: flex; align-items: center; gap: 6px; }
.header-stat-num { font-weight: 700; color: var(--text); font-size: 16px; }
.user-chip {
  display: flex; align-items: center; gap: 8px;
  background: var(--border-light); border-radius: 20px; padding: 5px 6px 5px 14px;
  font-size: 13px; white-space: nowrap;
}
.user-role-tag { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; }
.role-superadmin { background: #fef3c7; color: #b45309; }
.role-admin { background: #dbeafe; color: #1d4ed8; }
.role-user { background: #f6f1ee; color: #655b56; }
.icon-btn {
  width: 34px; height: 34px; border: 1px solid var(--border); background: var(--card-bg);
  border-radius: 8px; cursor: pointer; font-size: 16px; color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center; transition: all .2s;
}
.icon-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.icon-btn.wide { width: auto; height: 34px; padding: 0 11px; gap: 5px; font-size: 13px; font-weight: 500; white-space: nowrap; flex-shrink: 0; }
.icon-btn.is-warn { background: #fff7e6; border-color: #ffd591; color: #ad6800; }
.icon-btn.is-ok { background: #f6ffed; border-color: #b7eb8f; color: #389e0d; }
/* 登录后指引：气泡 + 箭头，指向顶栏「🔑 授权」 */
.coach-target { position: relative; z-index: 601; animation: coachPulse 1.6s ease-in-out infinite; }
@keyframes coachPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(24,95,165,.45); }
  50% { box-shadow: 0 0 0 9px rgba(24,95,165,0); }
}
.coach-tip {
  position: fixed; z-index: 600; width: 336px; max-width: calc(100vw - 28px);
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 14px 36px rgba(15,23,42,.18); padding: 14px 16px 12px;
  font-size: 13px; line-height: 1.6; color: var(--text);
  animation: coachIn .22s cubic-bezier(.16,1,.3,1);
}
@keyframes coachIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.coach-tip::before {
  content: ''; position: absolute; top: -8px; left: var(--arrow, 40px); margin-left: -7px;
  width: 14px; height: 14px; background: #fff;
  border-left: 1px solid var(--border); border-top: 1px solid var(--border);
  transform: rotate(45deg);
}
.coach-tip h4 { margin: 0 0 2px; font-size: 14px; font-weight: 700; }
.coach-tip .coach-sub { margin: 0 0 8px; font-size: 12px; color: var(--text-tertiary); }
.coach-line {
  display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; margin: 6px 0;
  border-radius: 8px; background: var(--bg); border: 1px solid var(--border-light);
}
.coach-line.on-ok { background: #f6ffed; border-color: #b7eb8f; }
.coach-line.on-warn { background: #fff7e6; border-color: #ffd591; }
.coach-line .dot { font-size: 12px; line-height: 1.5; }
.coach-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; gap: 10px; }
.coach-check {
  display: flex; align-items: center; gap: 6px; font-size: 12px;
  color: var(--text-tertiary); cursor: pointer; user-select: none; white-space: nowrap;
}
.coach-check input { width: 14px; height: 14px; margin: 0; cursor: pointer; accent-color: var(--primary); }
.coach-check:hover { color: var(--text-secondary); }
.coach-ok {
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  border-radius: 8px; padding: 6px 16px; font-size: 13px; cursor: pointer;
}
.coach-ok:hover { background: #eef2f7; }
.coach-ok.primary {
  background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600;
}
.coach-ok.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.nav-tabs {
  background: var(--card-bg); border-bottom: 1px solid var(--border);
  padding: 0 24px; position: sticky; top: 60px; z-index: 99;
}
.nav-tabs-inner { max-width: 1400px; margin: 0 auto; display: flex; gap: 4px; overflow-x: auto; }
.nav-tab {
  padding: 14px 20px; font-size: 15px; font-weight: 500; color: var(--text-secondary);
  cursor: pointer; border: none; background: none; border-bottom: 2px solid transparent;
  transition: all .2s; white-space: nowrap; display: flex; align-items: center; gap: 8px;
  font-family: inherit;
}
.nav-tab:hover { color: var(--primary); }
.nav-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.nav-tab-count {
  background: var(--border-light); color: var(--text-secondary);
  font-size: 12px; padding: 2px 8px; border-radius: 10px; font-weight: 600;
}
.nav-tab.active .nav-tab-count { background: var(--primary-light); color: var(--primary); }
.nav-subtabs {
  background: var(--card-bg); border-bottom: 1px solid var(--border);
  padding: 0 24px; position: sticky; top: 96px; z-index: 98;
}
.nav-subtabs-inner { max-width: 1400px; margin: 0 auto; display: flex; gap: 4px; overflow-x: auto; }
.nav-subtab {
  padding: 10px 16px; font-size: 13px; font-weight: 500; color: var(--text-secondary);
  cursor: pointer; border: none; background: none; border-bottom: 2px solid transparent;
  transition: all .2s; white-space: nowrap; display: flex; align-items: center; gap: 6px;
  font-family: inherit;
}
.nav-subtab:hover { color: var(--primary); }
.nav-subtab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.nav-subtab-count {
  background: var(--border-light); color: var(--text-secondary);
  font-size: 11px; padding: 2px 7px; border-radius: 10px; font-weight: 600;
}
.nav-subtab.active .nav-subtab-count { background: var(--primary-light); color: var(--primary); }
.nav-subtab-manage {
  margin-left: auto; padding: 6px 14px; font-size: 12px; font-weight: 500;
  color: var(--text-tertiary); cursor: pointer; border: 1px solid var(--border);
  background: var(--card-bg); border-radius: var(--radius-sm); transition: all .2s;
  white-space: nowrap; align-self: center; font-family: inherit;
}
.nav-subtab-manage:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-light); }
.nav-subtab-overview {
  padding: 6px 16px; font-size: 12px; font-weight: 600; color: var(--text-tertiary);
  cursor: pointer; border: 1px solid var(--border); background: var(--bg);
  border-radius: 20px; transition: all .2s; white-space: nowrap; font-family: inherit;
  margin-right: 8px;
}
.nav-subtab-overview:hover { color: var(--primary); border-color: var(--primary); }
.nav-subtab-overview.active { color: #fff; background: var(--primary); border-color: var(--primary); }
.main { max-width: 1400px; margin: 0 auto; padding: 24px; }
.toolbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px; gap: 16px; flex-wrap: wrap;
}
.search-box { flex: 1; max-width: 400px; position: relative; }
.search-input {
  width: 100%; padding: 10px 16px 10px 40px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14px; background: var(--card-bg);
  transition: border-color .2s; font-family: inherit;
}
.search-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-tertiary); }
.filter-group { display: flex; gap: 8px; }
.filter-btn {
  padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; background: var(--card-bg); color: var(--text-secondary);
  cursor: pointer; transition: all .2s; font-weight: 500; font-family: inherit;
}
.filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.filter-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.history-btn {
  padding: 8px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; background: var(--card-bg); color: var(--text-secondary);
  cursor: pointer; font-weight: 500; font-family: inherit; transition: all .2s;
}
.history-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.case-list { display: flex; flex-direction: column; gap: 0; }
.case-row {
  cursor: pointer;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 20px; transition: all .2s; margin-bottom: 10px;
  display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow);
}
.case-row:hover { border-color: var(--primary); box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.case-row-name { font-size: 15px; font-weight: 600; flex-shrink: 0; min-width: 180px; max-width: 260px; word-break: break-word; }
.case-row-badge { flex-shrink: 0; }
.case-row-progress { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; }
.case-row-latest-label {
  font-size: 11px; font-weight: 700; color: var(--status-danger); background: var(--status-danger-bg);
  padding: 2px 8px; border-radius: 4px; white-space: nowrap; flex-shrink: 0;
}
.case-row-latest-date {
  font-size: 13px; font-weight: 700; color: var(--primary); white-space: nowrap; flex-shrink: 0;
}
.case-row-latest-desc { font-size: 13px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.case-row-count { font-size: 12px; color: var(--text-tertiary); white-space: nowrap; flex-shrink: 0; }
.case-row-updated { font-size: 12px; color: var(--text-tertiary); white-space: nowrap; flex-shrink: 0; }
.case-row-actions { display: flex; gap: 6px; flex-shrink: 0; }
.case-row-btn {
  padding: 5px 12px; font-size: 12px; font-weight: 600; border-radius: 5px;
  border: 1px solid var(--border); background: var(--card-bg); cursor: pointer;
  font-family: inherit; transition: all .15s; white-space: nowrap;
}
.case-row-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.case-row-btn.btn-view { color: var(--primary); }
.case-row-btn.btn-edit { color: var(--status-warning); }
.case-row-btn.btn-edit:hover { border-color: var(--status-warning); background: var(--status-warning-bg); }
.case-row-btn.btn-del { color: var(--status-danger); }
.case-row-btn.btn-del:hover { border-color: var(--status-danger); background: var(--status-danger-bg); }
.case-status-badge {
  display: inline-block; padding: 3px 10px; border-radius: 12px;
  font-size: 12px; font-weight: 600; white-space: nowrap; flex-shrink: 0;
}
.status-active { background: var(--status-active-bg); color: var(--status-active); }
.status-closed { background: var(--status-closed-bg); color: var(--status-closed); }
.status-settled { background: var(--status-settled-bg); color: var(--status-settled); }
.status-warning { background: var(--status-warning-bg); color: var(--status-warning); }
.status-danger { background: var(--status-danger-bg); color: var(--status-danger); }
.status-default { background: var(--border-light); color: var(--text-secondary); }
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 200;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  justify-content: center; align-items: flex-start; padding: 40px 20px; overflow-y: auto;
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--card-bg); border-radius: 16px; max-width: 840px; width: 100%;
  box-shadow: 0 24px 80px rgba(15,23,42,.28); overflow: hidden; margin-bottom: 40px;
}
.modal-header {
  padding: 20px 24px; border-bottom: 1px solid var(--border); background: #fbfcfe;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
}
.modal-title { font-size: 18px; font-weight: 700; word-break: break-word; }
.modal-subtitle { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }
.modal-header-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.modal-close {
  width: 32px; height: 32px; border: none; background: var(--border-light);
  border-radius: 8px; cursor: pointer; font-size: 16px; color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center; transition: background .2s; flex-shrink: 0;
}
.modal-close:hover { background: var(--status-danger-bg); color: var(--status-danger); }
.modal-body { padding: 20px 24px; max-height: 70vh; overflow-y: auto; }
#caseModal .modal { max-width: 1160px; }
#caseModal .modal-body { max-height: 80vh; }
.case-info-line { margin-top: 4px; font-size: 13px; line-height: 1.5; }
.case-info-line strong { color: var(--text-primary); }
.settings-tabs { display: flex; gap: 8px; border-bottom: 1px solid var(--border); padding: 12px 20px; flex-wrap: wrap; }
.settings-tab {
  padding: 7px 16px; font-size: 13px; font-weight: 500; color: var(--text-secondary);
  border: 1px solid var(--border); background: var(--card-bg); cursor: pointer; border-radius: 999px;
  font-family: inherit; white-space: nowrap; transition: all .18s;
}
.settings-tab:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-light); }
.settings-tab.active {
  color: #fff; background: var(--primary); border-color: var(--primary); font-weight: 600;
  box-shadow: 0 2px 8px rgba(153,40,36,.3);
}
.timeline { position: relative; padding-left: 24px; }
.timeline::before {
  content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px;
  background: linear-gradient(180deg, #e5c5bd, var(--border));
}
.timeline-item { position: relative; padding-bottom: 18px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  position: absolute; left: -21px; top: 4px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--primary); border: 2px solid var(--card-bg); box-shadow: 0 0 0 2px var(--primary-light);
}
.timeline-item:first-child .timeline-dot { background: var(--text-tertiary); box-shadow: 0 0 0 2px var(--border-light); }
.timeline-item:last-child .timeline-dot { background: var(--status-danger); box-shadow: 0 0 0 2px var(--status-danger-bg); }
.timeline-date { font-size: 13px; font-weight: 700; color: var(--primary); margin-bottom: 2px; }
.timeline-item:last-child .timeline-date { color: var(--status-danger); }
.timeline-desc { font-size: 14px; line-height: 1.5; word-break: break-word; }
.timeline-actions { display: flex; gap: 6px; margin-top: 8px; }
.timeline-edit-form {
  background: var(--bg); border: 1px solid var(--border-light); border-radius: 10px;
  padding: 14px; width: 100%;
}
.mini-btn {
  padding: 4px 10px; font-size: 12px; border-radius: 5px; border: 1px solid var(--border);
  background: var(--card-bg); color: var(--text-secondary); cursor: pointer; font-family: inherit;
  white-space: nowrap;
}
.mini-btn:hover { border-color: var(--primary); color: var(--primary); }
.mini-btn.history-toggle { display:inline-flex; align-items:center; gap:4px; }
.mini-btn.history-toggle.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.mini-btn.danger:hover { border-color: var(--status-danger); color: var(--status-danger); background: var(--status-danger-bg); }
/* ===== IMPORTANT TODO（案件待办） ===== */
.imp-day-badge { display:inline-block; padding:3px 10px; border-radius:999px; font-size:11px; font-weight:700; margin-left:6px; vertical-align:middle; }
.imp-day-late   { background: var(--status-danger-bg); color: var(--status-danger); }
.imp-day-today  { background: #fff7ed; color: #c2410c; }
.imp-day-soon   { background: #fef9c3; color: #a16207; }
.imp-day-future { background: var(--primary-light); color: var(--primary); }
.imp-content { font-size: 14px; color: var(--text); line-height: 1.55; margin: 4px 0 6px; word-break: break-word; white-space: pre-wrap; }
.imp-empty-tip { color: var(--text-tertiary); text-align: center; padding: 28px 16px; font-size: 13px; }
.imp-row-done { opacity: .55; }
.imp-row-done .imp-content { text-decoration: line-through; }
.imp-pills { display:flex; flex-wrap:wrap; gap:5px; margin-top:6px; }
.imp-pill { display:inline-flex; align-items:center; gap:4px; padding:2px 9px; border-radius:999px; font-size:11px; }
.imp-pill-remind  { background: #eef2ff; color: #4338ca; }
.imp-pill-person  { background: #f1f5f9; color: #334155; }
.imp-pill-creator { background: #fdf4ff; color: #a21caf; }
/* 待办快速加人：@某人 后面的小加号 + 弹出面板 */
.assign-add-btn {
  display:inline-flex; align-items:center; justify-content:center;
  width:16px; height:16px; min-width:16px; padding:0;
  border:1px dashed var(--border); border-radius:50%;
  background:transparent; color:var(--text-tertiary);
  font-size:12px; line-height:1; font-weight:700; cursor:pointer;
  transition: all .15s; font-family: inherit;
}
.assign-add-btn:hover { border-color: var(--primary); border-style:solid; color: var(--primary); background: rgba(59,130,246,.08); }
.quick-assign-pop {
  position: fixed; z-index: 920; width: 230px; max-height: 300px; overflow-y: auto;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(15,23,42,.18); padding: 6px;
  font-size: 12.5px;
}
.quick-assign-pop .qa-head {
  font-size: 11.5px; color: var(--text-tertiary); padding: 4px 6px 6px;
  border-bottom: 1px solid var(--border); margin-bottom: 4px;
}
.quick-assign-pop .qa-row {
  display:flex; align-items:center; gap:6px; padding: 5px 6px; border-radius: 7px;
}
.quick-assign-pop .qa-row:hover { background: var(--bg); }
.quick-assign-pop .qa-name { flex:1; color: var(--text-primary); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.quick-assign-pop .qa-on-tag { font-size:10px; color:#15803d; background:#dcfce7; border-radius:6px; padding:0 5px; margin-left:4px; }
.quick-assign-pop .qa-btn {
  border:1px solid var(--border); background:var(--card-bg); color:var(--text-secondary);
  border-radius:6px; padding:2px 7px; font-size:11px; cursor:pointer; font-family:inherit; white-space:nowrap;
}
.quick-assign-pop .qa-btn:hover { border-color: var(--primary); color: var(--primary); }
.quick-assign-pop .qa-empty { padding: 8px 6px; color: var(--text-tertiary); }

.imp-status-line { display:flex; flex-wrap:wrap; align-items:center; gap:6px; margin-top:4px; font-size: 12px; color: var(--text-tertiary); }
.remind-day-chip {
  display:inline-flex; align-items:center; gap:4px; padding:6px 11px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--card-bg);
  font-size: 12px; cursor: pointer; user-select: none; transition: all .15s;
  font-family: inherit; color: var(--text-secondary);
}
.remind-day-chip:hover { border-color: var(--primary); color: var(--primary); }
.remind-day-chip.on { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 2px 6px rgba(153,40,36,.25); }
.remind-custom-input { display:none; width:90px; padding:6px 10px; border:1px solid var(--border); border-radius:8px; font-size:12px; background:var(--card-bg); color:var(--text); font-family:inherit; }
.remind-custom-input.show { display:inline-block; }
.imp-edit-form { width: 100%; }
.imp-edit-actions { display:flex; gap:8px; margin-top:10px; }

.add-progress-section { border-top: 1px solid var(--border); padding: 20px 24px; background: var(--bg); }
.add-progress-title { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.form-row { display: flex; gap: 12px; margin-bottom: 12px; }
.form-group { flex: 1; }
.form-label { font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 4px; display: block; }
.form-input, .form-textarea, .form-select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14px; background: var(--card-bg);
  color: var(--text); font-family: inherit; transition: border-color .2s;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light);
}
.form-textarea { resize: vertical; min-height: 60px; }
.form-submit {
  padding: 10px 24px; background: linear-gradient(135deg, #992824, #ae3a34); color: #fff; border: none;
  border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; cursor: pointer;
  transition: all .2s; font-family: inherit; box-shadow: 0 2px 6px rgba(153,40,36,.3);
}
.form-submit:hover { background: linear-gradient(135deg, #81231f, #992824); box-shadow: 0 4px 12px rgba(153,40,36,.38); transform: translateY(-1px); }
.form-submit:active { transform: translateY(0) scale(.98); box-shadow: 0 1px 3px rgba(153,40,36,.3); }
.form-submit-secondary {
  padding: 10px 24px; background: var(--card-bg); color: var(--text-secondary);
  border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px;
  font-weight: 600; cursor: pointer; font-family: inherit; transition: all .2s;
}
.form-submit-secondary:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.form-submit-secondary:active { transform: scale(.98); }
.account-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.account-table th {
  text-align: left; font-size: 12px; color: var(--text-tertiary); font-weight: 600;
  padding: 9px 10px; border-bottom: 1px solid var(--border); text-transform: uppercase;
  background: var(--bg); letter-spacing: .02em;
}
.account-table th:first-child { border-radius: 8px 0 0 8px; }
.account-table th:last-child { border-radius: 0 8px 8px 0; }
.account-table td { padding: 12px 10px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
.account-name { font-weight: 600; }
.account-cats { font-size: 12px; color: var(--text-secondary); }
.account-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.check-group { display: flex; flex-wrap: wrap; gap: 10px; }
.check-item {
  display: flex; align-items: center; gap: 6px; font-size: 14px;
  background: var(--border-light); padding: 6px 12px; border-radius: 6px; cursor: pointer;
}
.check-item input { accent-color: var(--primary); }
.check-item.grayed { opacity: .5; cursor: not-allowed; }
.check-note { font-size: 11px; color: var(--text-tertiary); }
/* 发票管理的子板块勾选：整行缩进，跟着父项勾选用 / 不用而显示 / 隐藏 */
.inv-sub-checks {
  display: none; flex-wrap: wrap; gap: 8px; width: 100%;
  margin: 0; padding: 8px 10px 8px 12px;
  border-left: 2px solid var(--border); border-radius: 0 6px 6px 0;
  background: var(--bg);
}
.inv-sub-checks.show { display: flex; }
.inv-sub-checks .check-item { background: var(--card-bg); border: 1px solid var(--border); }
.login-footer {
  position: absolute; left: 0; right: 0; bottom: 16px; z-index: 1;
  text-align: center; font-size: 11.5px; line-height: 1.6; letter-spacing: .2px;
  color: rgba(255,255,255,.5);
}
.hint { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; }
.log-item {
  border: 1px solid var(--border-light); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 10px; background: var(--card-bg);
}
.log-head {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  flex-wrap: wrap; margin-bottom: 4px;
}
.log-meta { font-size: 12px; color: var(--text-tertiary); }
.log-user { font-weight: 600; color: var(--primary); font-size: 13px; }
.log-action {
  display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px;
  border-radius: 10px; background: var(--border-light); color: var(--text-secondary);
}
.log-action.act-add { background: var(--status-settled-bg); color: var(--status-settled); }
.log-action.act-edit { background: var(--status-active-bg); color: var(--status-active); }
.log-action.act-del { background: var(--status-danger-bg); color: var(--status-danger); }
.log-detail { font-size: 13px; line-height: 1.5; word-break: break-word; }
.toast {
  position: fixed; top: 76px; left: 50%; transform: translateX(-50%);
  background: rgba(26,26,46,.92); color: #fff; padding: 10px 22px; border-radius: 999px;
  font-size: 14px; z-index: 500; box-shadow: 0 10px 30px rgba(0,0,0,.25);
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.toast.saved {
  display: flex; align-items: center; gap: 8px;
  background: #ecfdf3; color: #166534; border: 1px solid #bbebce;
  box-shadow: 0 8px 24px rgba(22,101,52,.16); font-weight: 600; z-index: 1000;
}
.toast.saved::before {
  content: "✓"; display: grid; place-items: center;
  width: 20px; height: 20px; border-radius: 50%; background: #166534; color: white;
}
.toast.show { opacity: 1; animation: toastIn .3s cubic-bezier(.16,1,.3,1); }
@keyframes toastIn { from { transform: translate(-50%, -10px); } to { transform: translate(-50%, 0); } }
.empty-state { text-align: center; padding: 64px 20px; color: var(--text-tertiary); }
.empty-state-icon {
  width: 88px; height: 88px; margin: 0 auto 16px; border-radius: 50%;
  background: var(--primary-light); display: flex; align-items: center; justify-content: center;
  font-size: 38px;
}
/* ===== 界面优化 ===== */
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-overlay.show { animation: overlayIn .18s ease-out; }
.modal { animation: modalIn .28s cubic-bezier(.16,1,.3,1); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c9d0da; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #aeb6c2; }
.nav-subtabs { padding: 8px 24px; }
.nav-subtabs-inner { gap: 8px; }
.nav-subtab {
  padding: 6px 14px; font-size: 13px; font-weight: 500; color: var(--text-secondary);
  cursor: pointer; border: 1px solid var(--border); background: var(--card-bg); border-radius: 999px;
  transition: all .2s; white-space: nowrap; display: flex; align-items: center; gap: 6px; font-family: inherit;
}
.nav-subtab:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-light); }
.nav-subtab.active {
  color: #fff; border-color: var(--primary); background: var(--primary); font-weight: 600;
  box-shadow: 0 2px 8px rgba(153,40,36,.3);
}
.nav-subtab.active .nav-subtab-count { background: rgba(255,255,255,.25); color: #fff; }
.nav-subtab-manage { font-size: 12px; padding: 4px 12px; }
.seg-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.seg-btn {
  padding: 6px 14px; font-size: 13px; font-weight: 500; color: var(--text-secondary);
  border: 1px solid var(--border); background: var(--card-bg); border-radius: 999px;
  cursor: pointer; transition: all .2s; font-family: inherit; white-space: nowrap;
}
.seg-btn:hover { color: var(--primary); border-color: var(--primary); }
.seg-btn.active { color: #fff; background: var(--primary); border-color: var(--primary); font-weight: 600; }
/* 待办事项 */
.todo-item { display: flex; gap: 12px; align-items: flex-start; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px; box-shadow: var(--shadow); }
.todo-item:hover { box-shadow: var(--shadow-hover); }
.todo-done { opacity: 0.55; }
.todo-done .todo-title { text-decoration: line-through; }
.todo-check { cursor: pointer; display: flex; margin-top: 2px; flex-shrink: 0; }
.todo-check input { display: none; }
.todo-checkbox { width: 20px; height: 20px; border: 2px solid #c3c9d5; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; color: #fff; background: #fff; transition: all .15s; }
.todo-check:hover .todo-checkbox { border-color: var(--primary); }
.todo-done .todo-checkbox { background: var(--primary); border-color: var(--primary); }
.todo-main { flex: 1; min-width: 0; }
.todo-title { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.todo-mine { background: var(--status-warning-bg); color: var(--status-warning); font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; }
.todo-content { font-size: 13px; color: var(--text-secondary); margin-top: 4px; white-space: pre-wrap; word-break: break-word; }
.todo-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--text-tertiary); }
.todo-assignee { background: var(--bg); border: 1px solid var(--border); color: var(--text-secondary); border-radius: 10px; padding: 1px 8px; font-size: 12px; }
.todo-assignee-me { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.todo-assignee-none { border-style: dashed; }
.todo-due { color: var(--status-warning); }
.todo-actions { display: flex; gap: 6px; flex-shrink: 0; }
.todo-check-list { display: flex; flex-wrap: wrap; gap: 8px; }
.todo-check-item { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); cursor: pointer; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--card-bg); transition: all .15s; }
.todo-check-item input { accent-color: var(--primary); }
.todo-check-item.checked { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.todo-edit-hint { font-size: 12px; color: var(--text-tertiary); margin-top: 6px; }
/* 待办页 v2 */
.todo-page-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.timer-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.timer-head-title { display: flex; align-items: center; gap: 12px; }
.timer-head-icon {
  width: 44px; height: 44px; border-radius: 12px; font-size: 22px;
  background: linear-gradient(135deg, #0ea5e9, #2563eb); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(37,99,235,.3);
}
.todo-page-title { display: flex; align-items: center; gap: 12px; }
.todo-page-icon {
  width: 44px; height: 44px; border-radius: 12px; font-size: 22px;
  background: linear-gradient(135deg, #992824, #ae3a34); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(153,40,36,.3);
}
.todo-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.todo-stat {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 999px;
  padding: 7px 14px; font-size: 12px; color: var(--text-secondary); box-shadow: var(--shadow);
  display: inline-flex; align-items: center; gap: 5px;
  cursor: pointer; transition: all .2s; font-family: inherit;
  user-select: none;
}
.todo-stat:hover { color: var(--primary); border-color: var(--primary); transform: translateY(-1px); box-shadow: var(--shadow-hover); }
.todo-stat:active { transform: scale(.96); }
.todo-stat b { font-size: 15px; color: var(--text); font-weight: 700; }
.todo-stat.stat-mine b { color: var(--primary); }
.todo-stat.stat-overdue b { color: var(--status-danger); }
.todo-stat.stat-done b { color: var(--status-settled); }
.todo-stat.active {
  color: #fff; background: var(--primary); border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(153,40,36,.3);
}
.todo-stat.active b { color: #fff; }
.todo-stat.active.stat-overdue { background: var(--status-danger); border-color: var(--status-danger); box-shadow: 0 4px 12px rgba(220,53,69,.3); }
.todo-stat.active.stat-done { background: var(--status-settled); border-color: var(--status-settled); box-shadow: 0 4px 12px rgba(40,167,69,.3); }
.todo-stat.active.stat-mine { background: var(--primary); border-color: var(--primary); }
.todo-item { position: relative; overflow: hidden; }
.todo-item::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--border); }
.todo-item:not(.todo-done)::before { background: var(--primary); }
.todo-item.todo-done::before { background: var(--status-settled); }
.todo-item.todo-overdue::before { background: var(--status-danger); }
.todo-item.todo-overdue .todo-due { color: var(--status-danger); font-weight: 700; }
.todo-overdue-tag {
  background: var(--status-danger-bg); color: var(--status-danger);
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; white-space: nowrap;
}
/* 待办关联案件 */
.todo-case-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--primary-light); color: var(--primary);
  font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 10px;
  border: 1px solid transparent; transition: all .15s; cursor: default; white-space: nowrap;
}
.todo-case-chip:hover { border-color: var(--primary); }
.todo-case-chip.todo-case-chip-link { cursor: pointer; }
.todo-case-chip.todo-case-chip-link:hover { background: var(--primary); color: #fff; transform: translateY(-1px); box-shadow: 0 4px 10px rgba(37,99,235,.28); }
.todo-case-chip-go { margin-left: 2px; font-size: 11px; opacity: .75; }
.todo-case-chip-x { margin-left: 6px; color: var(--text-tertiary); font-size: 11px; }
/* 案件详情标题旁的状态徽章（比待办徽章略小） */
.case-status-pill {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 600; padding: 1px 9px; border-radius: 9px;
  white-space: nowrap; vertical-align: middle; margin-left: 8px; position: relative; top: -1px;
}
.case-status-pill.pill-active { background: var(--status-active-bg); color: var(--status-active); }
.case-status-pill.pill-closed { background: var(--status-closed-bg); color: var(--status-closed); }
.todo-case-chip-x:hover { color: var(--status-danger); }
.todo-case-sug {
  display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15,23,42,.15); z-index: 50; max-height: 288px; overflow-y: auto;
}
.todo-case-sug-head {
  padding: 7px 14px; font-size: 11.5px; color: var(--text-tertiary);
  background: var(--bg); border-bottom: 1px solid var(--border-light);
  position: sticky; top: 0; z-index: 1;
}
.todo-case-sug-item {
  padding: 9px 14px; cursor: pointer; display: flex; flex-direction: column; gap: 1px;
  border-bottom: 1px solid var(--border-light); transition: background .12s;
}
.todo-case-sug-item:last-child { border-bottom: none; }
.todo-case-sug-item:hover { background: var(--primary-light); }
.todo-case-sug-name { font-size: 13px; font-weight: 600; }
.todo-case-sug-meta { font-size: 11.5px; color: var(--text-tertiary); }
.todo-case-mark { background: transparent; color: var(--primary); font-weight: 700; padding: 0; }
.todo-case-sug-empty { padding: 12px 14px; font-size: 12px; color: var(--text-tertiary); }
.table-card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 4px 14px 10px; overflow-x: auto; margin-bottom: 8px;
}
.account-table tbody tr { transition: background .15s; }
.account-table tbody tr:hover td { background: rgba(153,40,36,.05); }
.fin-card {
  flex: 1; min-width: 150px; background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}
.fin-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.fin-card-label { font-size: 12px; font-weight: 500; color: var(--text-tertiary); margin-bottom: 6px; }
.fin-card-value { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
/* 财务页顶部：两行 × 六张卡（团队合计 / 管理员个人） */
.fin-row-title { display: flex; align-items: baseline; gap: 8px; margin: 0 0 8px; font-size: 13px; font-weight: 700; color: var(--text-primary); }
.fin-row-title span { font-size: 12px; font-weight: 400; color: var(--text-tertiary); }
.fin-cards-6 { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.fin-cards-6 .fin-card { min-width: 0; padding: 12px 14px; }
.fin-cards-6 .fin-card-value { font-size: 17px; letter-spacing: -.03em; }
.fin-card-sub { font-size: 11.5px; line-height: 1.55; color: var(--text-tertiary); margin-top: 5px; }
@media (max-width: 1280px) { .fin-cards-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* ===== 界面优化 v2：细节打磨 ===== */
button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.main { animation: mainIn .3s ease-out; }
@keyframes mainIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.mini-btn:active, .case-row-btn:active, .filter-btn:active, .history-btn:active,
.seg-btn:active, .nav-subtab:active, .icon-btn:active, .check-item:active { transform: scale(.95); }
.mini-btn, .case-row-btn, .filter-btn, .history-btn { transition: all .15s; }
.log-item { transition: border-color .15s, box-shadow .15s; }
.log-item:hover { border-color: var(--border); box-shadow: var(--shadow); }
.todo-item { transition: box-shadow .2s, transform .15s, border-color .2s; }
.todo-item:hover { border-color: #e5c5bd; }
@media (max-width: 768px) {
  .case-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .case-row-name { max-width: none; }
  .case-row-actions { width: 100%; }
  .header-stats { display: none; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .search-box { max-width: none; }
  .form-row { flex-direction: column; }
  .fin-card { min-width: 0; }
  .fin-cards-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #timerSummary, #expSummary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .table-card { padding: 4px 8px 8px; }
}

.case-row-number { flex: 0 0 2.5em; text-align: center; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.form-input:is([type="date"], [type="month"], [type="datetime-local"]) {
  min-height: 40px;
  min-width: 0;
  max-width: 100%;
  font: inherit;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  color-scheme: light;
}
