* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --blue: #2563eb; --blue-light: #eff6ff;
  --green: #16a34a; --red: #dc2626; --yellow: #d97706;
  --gray: #6b7280; --border: #e5e7eb; --bg: #f5f6f8;
  --sidebar: #1e293b;
}
body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: #1f2937; font-size: 14px; }
a { color: var(--blue); text-decoration: none; }

.app { display: flex; min-height: 100vh; }
.sidebar { width: 180px; background: var(--sidebar); color: #cbd5e1; display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; }
.sidebar .logo { padding: 18px 20px; font-size: 18px; font-weight: 700; color: #fff; }
.sidebar-search { padding: 0 12px 10px; }
.sidebar-search input { width: 100%; background: #334155; border-color: #475569; color: #e2e8f0; font-size: 13px; }
.sidebar-search input::placeholder { color: #94a3b8; }
.sidebar nav { flex: 1; }
.nav-badge { display: inline-block; background: var(--red); color: #fff; border-radius: 9px; padding: 1px 7px; font-size: 11px; margin-left: 6px; }
.sidebar nav a { display: block; padding: 11px 20px; color: #cbd5e1; }
.sidebar nav a:hover { background: #334155; color: #fff; }
.sidebar nav a.active { background: var(--blue); color: #fff; }
.sidebar-user { padding: 14px 20px; border-top: 1px solid #334155; display: flex; justify-content: space-between; }
.sidebar-user a { color: #94a3b8; }
.main { flex: 1; margin-left: 180px; padding: 20px 24px; max-width: calc(100vw - 180px); }

h1 { font-size: 21px; font-weight: 700; letter-spacing: -.2px; margin-bottom: 16px; }
h2 { font-size: 15px; font-weight: 700; margin: 18px 0 10px; }
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.page-head h1 { margin: 0; }

/* 页头: 头像 + 名称 + 元信息 */
.page-title { display: flex; align-items: center; gap: 12px; }
.avatar { width: 46px; height: 46px; border-radius: 12px; color: #fff; font-size: 20px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.meta-line { color: var(--gray); font-size: 13px; margin-top: 3px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.meta-line .dot::before { content: '·'; color: #cbd5e1; }

.card { background: #fff; border: 1px solid #eceef1; border-radius: 12px; padding: 18px; margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(16,24,40,.05); }

/* 空状态 */
.empty { text-align: center; padding: 34px 16px; color: var(--gray); }
.empty .em-icon { font-size: 30px; margin-bottom: 8px; }
.empty p { max-width: 460px; margin: 0 auto 14px; line-height: 1.7; }
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; }
.flash-ok { background: #dcfce7; color: #166534; }
.flash-err { background: #fee2e2; color: #991b1b; }

table.list { width: 100%; border-collapse: collapse; background: #fff; }
table.list th, table.list td { padding: 11px 10px; border-bottom: 1px solid #f0f2f5; text-align: left; vertical-align: middle; }
table.list th { background: #f8fafc; font-weight: 600; color: #64748b; white-space: nowrap; font-size: 12.5px; letter-spacing: .3px; }
table.list tr:hover td { background: #f6f9ff; }

.btn { display: inline-block; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--border); background: #fff; color: #374151; cursor: pointer; font-size: 14px; transition: background .15s, box-shadow .15s; }
.btn:hover { background: #f3f4f6; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: 0 1px 2px rgba(37,99,235,.3); }
.btn-primary:hover { background: #1d4ed8; }
.btn-sm { padding: 3px 9px; font-size: 13px; }
.btn-danger { color: var(--red); border-color: #fca5a5; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; background: #f3f4f6; color: #4b5563; white-space: nowrap; }
.badge-today { background: #ffedd5; color: #c2410c; }
.badge-blue { background: var(--blue-light); color: var(--blue); }
.badge-purple { background: #ede9fe; color: #7c3aed; }
.badge-dim { background: #f3f4f6; color: #b0b7c3; text-decoration: line-through; }
.badge-yellow { background: #fef3c7; color: var(--yellow); }
.badge-red { background: #fee2e2; color: var(--red); }
.badge-green { background: #dcfce7; color: var(--green); }
.badge-gray { background: #f3f4f6; color: var(--gray); }
.badge-a { background: #fee2e2; color: var(--red); font-weight: 700; }
.badge-b { background: #fef3c7; color: var(--yellow); font-weight: 700; }
.badge-c { background: #f3f4f6; color: var(--gray); font-weight: 700; }

form.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filter-box { margin-bottom: 12px; }
.filter-box summary { cursor: pointer; color: var(--gray); font-size: 13px; user-select: none; padding: 4px 0; }
.filter-box summary:hover { color: var(--blue); }
.bulk-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 10px;
  background: #f8fafc; border: 1px solid var(--border); border-radius: 8px 8px 0 0; border-bottom: 0; font-size: 13px; }
table.list th a { color: inherit; }
table.list th a:hover { color: var(--blue); }

/* 行内操作下拉菜单 */
.rowmenu { position: relative; display: inline-block; }
.rowmenu-btn { border: 1px solid var(--border); background: #fff; border-radius: 8px; padding: 4px 10px; cursor: pointer; font-size: 15px; line-height: 1; color: #64748b; }
.rowmenu-btn:hover { background: #f3f4f6; }
.rowmenu-pop { position: absolute; right: 0; top: 100%; margin-top: 4px; background: #fff; border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 8px 24px rgba(16,24,40,.14); z-index: 30; min-width: 120px; padding: 4px; display: none; }
.rowmenu.open .rowmenu-pop { display: block; }
.rowmenu-pop button, .rowmenu-pop a { display: block; width: 100%; text-align: left; border: 0; background: none;
  padding: 8px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; color: #374151; white-space: nowrap; }
.rowmenu-pop button:hover, .rowmenu-pop a:hover { background: #f3f6fc; }
.rowmenu-pop .danger { color: var(--red); }
.rowmenu-pop form { margin: 0; }
.rowmenu-divider { height: 1px; background: var(--border); margin: 4px 0; }
input, select, textarea { padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; font-family: inherit; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid #bfdbfe; border-color: var(--blue); }
textarea { width: 100%; min-height: 60px; resize: vertical; }
label { font-size: 13px; color: #4b5563; display: block; margin-bottom: 4px; }
label .req { color: var(--red); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid input, .form-grid select { width: 100%; }
.form-actions { margin-top: 16px; display: flex; gap: 10px; }
details.more { grid-column: 1 / -1; border-top: 1px dashed var(--border); padding-top: 8px; }
details.more summary { cursor: pointer; color: var(--gray); font-size: 13px; user-select: none; }
details.more summary:hover { color: var(--blue); }

/* 模态 */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: none; z-index: 50; }
.modal-bg.open { display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.modal { background: #fff; border-radius: 10px; padding: 20px; width: 100%; max-width: 680px; }
.modal h3 { margin-bottom: 14px; font-size: 16px; }
.modal-close { float: right; cursor: pointer; font-size: 18px; color: var(--gray); border: 0; background: none; }

/* Kanban */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.kanban-col { min-width: 230px; width: 230px; background: #eef0f3; border-radius: 8px; flex-shrink: 0; }
.kanban-col-head { padding: 10px 12px; font-weight: 600; font-size: 13px; display: flex; justify-content: space-between; border-bottom: 2px solid var(--border); }
.kanban-col-head .sum { color: var(--gray); font-weight: 400; }
.kanban-cards { padding: 8px; min-height: 60px; display: flex; flex-direction: column; gap: 8px; }
.kanban-card { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 10px; cursor: grab; font-size: 13px; }
.kanban-card.dragging { opacity: .5; }
.kanban-col.drag-over .kanban-cards { background: var(--blue-light); border-radius: 8px; }
.kanban-card .t { font-weight: 600; margin-bottom: 4px; }
.kanban-card .row { display: flex; justify-content: space-between; color: var(--gray); margin-top: 3px; }
.kanban-card .money { color: #1f2937; font-weight: 600; }

/* Today / Dashboard */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 14px; }
.stat .n { font-size: 24px; font-weight: 700; }
.stat .l { color: var(--gray); font-size: 13px; margin-top: 2px; }
.stat.warn .n { color: var(--red); }

/* 流程引导条 */
.flowbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.flowbar .fstep { padding: 4px 12px; border-radius: 14px; font-size: 13px; background: #f3f4f6; color: var(--gray); white-space: nowrap; }
.flowbar .fstep.done { background: #dcfce7; color: var(--green); }
.flowbar .fstep.current { background: var(--blue); color: #fff; font-weight: 600; }
.flowbar .farrow { color: #d1d5db; }
.nextstep { background: var(--blue-light); border: 1px solid #bfdbfe; border-radius: 8px; padding: 10px 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.nextstep b { color: var(--blue); }

.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--border); margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 8px 15px; color: var(--gray); border-bottom: 2px solid transparent; margin-bottom: -2px; border-radius: 8px 8px 0 0; transition: background .15s; }
.tabs a:hover { background: #f3f6fc; color: #374151; }
.tabs a.active { color: var(--blue); border-color: var(--blue); font-weight: 600; }

.timeline { list-style: none; }
.timeline li { padding: 10px 0 10px 20px; border-left: 2px solid var(--border); position: relative; margin-left: 8px; }
.timeline li::before { content: ''; position: absolute; left: -6px; top: 16px; width: 10px; height: 10px; border-radius: 50%; background: var(--blue); }
.timeline .meta { color: var(--gray); font-size: 12px; margin-bottom: 3px; }
.timeline .fb { color: var(--gray); margin-top: 3px; }

.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 20px; }
.kv > div { padding: 8px 10px; background: #f8fafc; border-radius: 8px; }
.kv .k { color: #8a94a3; font-size: 12px; display: inline-block; margin-bottom: 1px; }

.progress { background: #f3f4f6; border-radius: 6px; height: 8px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--green); }

.funnel-row { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.funnel-row .bar { background: var(--blue); height: 24px; border-radius: 4px; min-width: 4px; }
.funnel-row .lbl { width: 110px; text-align: right; color: var(--gray); font-size: 13px; }

.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box { background: #fff; padding: 32px; border-radius: 12px; border: 1px solid var(--border); width: 340px; }
.login-box h1 { text-align: center; margin-bottom: 20px; }
.login-box input { width: 100%; margin-bottom: 12px; }
.login-box button { width: 100%; }

.muted { color: var(--gray); }
.right { text-align: right; }
.mt { margin-top: 12px; }
.warn-text { color: var(--red); font-weight: 600; }

@media (max-width: 768px) {
  body { font-size: 15px; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; overflow-x: auto; }
  .sidebar nav { display: flex; }
  .sidebar nav a { padding: 12px 10px; white-space: nowrap; }
  .sidebar .logo { padding: 10px 12px; }
  .sidebar-user { border: 0; padding: 10px; white-space: nowrap; }
  .sidebar-search { display: none; }
  .app { flex-direction: column; }
  .main { margin-left: 0; max-width: 100vw; padding: 12px; }
  /* 表格自身横向滚动,页面不横滚 */
  table.list { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
  /* 触控目标加大 */
  .btn { padding: 10px 16px; }
  .btn-sm { padding: 7px 12px; font-size: 14px; }
  input, select, textarea { padding: 10px 12px; font-size: 16px; } /* 16px 防 iOS 聚焦放大 */
  /* 弹窗接近全屏 */
  .modal-bg.open { padding: 8px; align-items: stretch; }
  .modal { max-width: none; border-radius: 8px; }
  .form-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .kanban-col { min-width: 200px; width: 200px; }
  .page-head > div { display: flex; flex-wrap: wrap; gap: 6px; }
  .kv { grid-template-columns: repeat(2, 1fr); }
}

/* 成功提示自动淡出(app.js配合) */
.flash-ok.fade { opacity: 0; transition: opacity .6s; }

/* 系统通知开启引导条 */
.notif-bar { position: sticky; top: 0; z-index: 90; background: #fef3c7; color: #92400e;
  padding: 10px 16px; font-size: 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  border-bottom: 1px solid #fde68a; }

/* 到点提醒面板 */
.remind-panel { position: fixed; right: 16px; bottom: 16px; width: 320px; max-width: calc(100vw - 32px);
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,.18); z-index: 100; overflow: hidden; }
.remind-head { padding: 10px 14px; font-weight: 700; background: var(--blue-light); color: var(--blue);
  display: flex; justify-content: space-between; align-items: center; }
.remind-head .remind-close-all { border: 0; background: none; color: var(--gray); cursor: pointer; font-size: 12px; }
.remind-head .remind-grant { border: 1px solid var(--blue); background: #fff; color: var(--blue); cursor: pointer;
  font-size: 12px; border-radius: 6px; padding: 2px 8px; margin-left: auto; margin-right: 6px; }
.remind-item { padding: 10px 14px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 8px; }
.remind-item a { color: #1f2937; flex: 1; }
.remind-item .remind-close { border: 0; background: none; color: var(--gray); cursor: pointer; font-size: 16px; }
@media (max-width: 768px) { .remind-panel { left: 16px; width: auto; } }
