/* ============================================================
   友逸付协同平台 · 设计系统
   Design tokens + Layout + Components
   ============================================================ */

:root {
  /* Brand */
  --brand: #2563eb;
  --brand-600: #1d4ed8;
  --brand-700: #1e40af;
  --brand-50: #eff6ff;
  --brand-100: #dbeafe;

  /* Ink */
  --ink: #0f172a;
  --ink-2: #334155;
  --ink-3: #475569;
  --muted: #64748b;
  --muted-2: #94a3b8;

  /* Lines & surfaces */
  --line: #e5e9f0;
  --line-soft: #eef2f7;
  --bg: #f4f6fa;
  --card: #ffffff;
  --hover: #f8fafc;

  /* Semantic */
  --ok: #16a34a;
  --ok-bg: #ecfdf5;
  --warn: #d97706;
  --warn-bg: #fffbeb;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --info: #0891b2;
  --info-bg: #ecfeff;
  --violet: #7c3aed;
  --violet-bg: #f5f3ff;

  /* Sidebar */
  --side-bg: #0b1220;
  --side-bg-2: #111c31;
  --side-text: #94a3b8;
  --side-text-active: #ffffff;

  /* Geometry */
  --radius: 10px;
  --radius-sm: 7px;
  --radius-lg: 14px;
  --side-w: 232px;
  --top-h: 60px;

  /* Elevation */
  --sh-1: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
  --sh-2: 0 4px 16px rgba(15, 23, 42, .08);
  --sh-3: 0 18px 50px rgba(15, 23, 42, .18);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
}

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-2);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5 { margin: 0; font-weight: 600; color: var(--ink); letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; }
::selection { background: var(--brand-100); }

/* scrollbar */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 9px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; background-clip: content-box; }

.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* ============================================================
   Shell
   ============================================================ */
.shell { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.side {
  width: var(--side-w);
  flex: 0 0 var(--side-w);
  background: linear-gradient(180deg, var(--side-bg) 0%, var(--side-bg-2) 100%);
  color: var(--side-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 60;
  transition: transform .22s ease;
}

.side-brand {
  height: var(--top-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  flex: 0 0 auto;
}

.brand-mark {
  width: 30px; height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 14px;
  letter-spacing: -.5px;
  box-shadow: 0 2px 10px rgba(37, 99, 235, .45);
  flex: 0 0 auto;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { color: #fff; font-size: 14.5px; font-weight: 600; letter-spacing: .2px; }
.brand-text span { font-size: 10.5px; color: #64748b; letter-spacing: .5px; text-transform: uppercase; }

.side-scroll { overflow-y: auto; flex: 1; padding: 12px 10px 20px; }
.side-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); background-clip: content-box; }

.nav-group-label {
  font-size: 10.5px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: #4b5b73;
  padding: 14px 10px 6px;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--side-text);
  font-size: 13.5px;
  cursor: pointer;
  position: relative;
  transition: background .14s, color .14s;
  user-select: none;
  margin-bottom: 1px;
}
.nav-item svg { width: 17px; height: 17px; flex: 0 0 17px; opacity: .85; }
.nav-item:hover { background: rgba(255, 255, 255, .055); color: #e2e8f0; }
.nav-item.on { background: rgba(37, 99, 235, .16); color: var(--side-text-active); font-weight: 500; }
.nav-item.on::before {
  content: ""; position: absolute; left: -10px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: #3b82f6;
}
.nav-item.on svg { opacity: 1; color: #60a5fa; }
.nav-item .badge-dot {
  margin-left: auto; font-size: 10.5px; font-weight: 600; padding: 1px 6px;
  border-radius: 20px; background: rgba(255,255,255,.1); color: #cbd5e1;
}
.nav-item.on .badge-dot { background: rgba(59,130,246,.35); color: #dbeafe; }
.nav-item.locked { opacity: .42; cursor: not-allowed; }
.nav-item.locked:hover { background: transparent; color: var(--side-text); }

.side-foot {
  flex: 0 0 auto;
  padding: 12px 14px;
  border-top: 1px solid rgba(255, 255, 255, .06);
  font-size: 11px;
  color: #4b5b73;
  display: flex; align-items: center; justify-content: space-between;
}
.side-foot .dot-live { display: inline-flex; align-items: center; gap: 5px; color: #4ade80; }
.side-foot .dot-live i { width: 5px; height: 5px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 3px rgba(74,222,128,.15); }

/* ---------- Main ---------- */
.main {
  flex: 1;
  min-width: 0;
  margin-left: var(--side-w);
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--top-h);
  background: rgba(255, 255, 255, .86);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 22px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.crumb { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); min-width: 0; }
.crumb b { color: var(--ink); font-weight: 600; font-size: 14.5px; }
.crumb .sep { color: #cbd5e1; }

.top-search {
  margin-left: auto;
  display: flex; align-items: center; gap: 7px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  height: 34px;
  width: 250px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.top-search:focus-within { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.top-search svg { width: 15px; height: 15px; color: var(--muted-2); flex: 0 0 15px; }
.top-search input {
  border: 0; background: transparent; outline: none; font-size: 13px;
  width: 100%; color: var(--ink); font-family: inherit;
}
.top-search input::placeholder { color: var(--muted-2); }
.top-search kbd {
  font-family: inherit; font-size: 10.5px; color: var(--muted-2);
  border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; background: #fff;
}

.icon-btn {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid transparent;
  background: transparent; display: grid; place-items: center; cursor: pointer;
  color: var(--ink-3); position: relative; transition: background .15s;
}
.icon-btn:hover { background: var(--bg); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .dot {
  position: absolute; top: 7px; right: 8px; width: 6px; height: 6px;
  background: var(--danger); border-radius: 50%; border: 1.5px solid #fff;
}

.who {
  display: flex; align-items: center; gap: 9px; padding-left: 13px;
  border-left: 1px solid var(--line); cursor: pointer;
}
.who .avatar { width: 30px; height: 30px; font-size: 12px; }
.who-meta { line-height: 1.25; }
.who-meta b { display: block; font-size: 13px; color: var(--ink); font-weight: 600; }
.who-meta span { font-size: 11px; color: var(--muted); }

.avatar {
  border-radius: 50%;
  display: grid; place-items: center;
  color: #fff; font-weight: 600;
  flex: 0 0 auto;
  background: linear-gradient(135deg, #64748b, #475569);
  letter-spacing: .3px;
}
.avatar.lg { width: 42px; height: 42px; font-size: 15px; }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }

/* ---------- Content ---------- */
.content { padding: 22px; flex: 1; max-width: 1560px; width: 100%; }

.page-head {
  display: flex; align-items: flex-start; gap: 16px;
  margin-bottom: 18px;
}
.page-head .ph-text { min-width: 0; }
.page-head h1 { font-size: 20px; line-height: 1.3; display: flex; align-items: center; gap: 9px; }
.page-head .sub { font-size: 13px; color: var(--muted); margin-top: 3px; }
.page-head .ph-actions { margin-left: auto; display: flex; gap: 9px; flex: 0 0 auto; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px;
  border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-2);
  font-size: 13px; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: all .14s;
  user-select: none;
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { background: var(--hover); border-color: #d3dbe6; color: var(--ink); }
.btn:active { transform: translateY(.5px); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(37,99,235,.25); }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.btn-danger { color: var(--danger); border-color: #fecaca; background: #fff; }
.btn-danger:hover { background: var(--danger-bg); color: var(--danger); border-color: #fca5a5; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--bg); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn-sm svg { width: 13px; height: 13px; }
.btn-lg { height: 38px; padding: 0 18px; font-size: 13.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--sh-1);
}
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.card-head h3 { font-size: 14px; font-weight: 600; }
.card-head .sub { font-size: 12px; color: var(--muted); }
.card-head .right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 16px; }
.card-body.flush { padding: 0; }

.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ============================================================
   KPI stat
   ============================================================ */
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 16px;
  box-shadow: var(--sh-1);
  position: relative;
  overflow: hidden;
  transition: box-shadow .2s, transform .2s, border-color .2s;
}
.stat:hover { box-shadow: var(--sh-2); border-color: #dbe3ee; }
.stat .st-top { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.stat .st-ico {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: var(--brand-50); color: var(--brand); flex: 0 0 28px;
}
.stat .st-ico svg { width: 15px; height: 15px; }
.stat .st-label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.stat .st-val { font-size: 27px; font-weight: 650; color: var(--ink); line-height: 1.1; letter-spacing: -.02em; }
.stat .st-val small { font-size: 14px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.stat .st-foot { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 11.5px; color: var(--muted); flex-wrap: wrap; line-height: 1.5; }
.stat .trend { font-weight: 600; display: inline-flex; align-items: center; gap: 2px; }
.trend.up { color: var(--ok); }
.trend.down { color: var(--danger); }
.stat.accent-ok .st-ico { background: var(--ok-bg); color: var(--ok); }
.stat.accent-warn .st-ico { background: var(--warn-bg); color: var(--warn); }
.stat.accent-danger .st-ico { background: var(--danger-bg); color: var(--danger); }
.stat.accent-violet .st-ico { background: var(--violet-bg); color: var(--violet); }
.stat.accent-info .st-ico { background: var(--info-bg); color: var(--info); }

/* ============================================================
   Table
   ============================================================ */
.table-wrap { width: 100%; overflow-x: auto; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.tbl th {
  text-align: left; font-weight: 600; font-size: 11.5px; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted);
  padding: 9px 14px; background: #fafbfd;
  border-bottom: 1px solid var(--line);
  white-space: nowrap; position: sticky; top: 0; z-index: 2;
}
table.tbl td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-2); vertical-align: middle;
}
table.tbl tbody tr { transition: background .12s; }
table.tbl tbody tr:hover { background: #fafbfe; }
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl td.tight { width: 1%; white-space: nowrap; }
table.tbl .cell-main { font-weight: 500; color: var(--ink); }
table.tbl .cell-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
table.tbl.clickable tbody tr { cursor: pointer; }

.t-actions { display: flex; gap: 2px; justify-content: flex-end; opacity: .35; transition: opacity .15s; }
tr:hover .t-actions { opacity: 1; }
.t-actions .icon-btn { width: 27px; height: 27px; border-radius: 6px; }
.t-actions .icon-btn svg { width: 14px; height: 14px; }

/* ============================================================
   Badges / pills
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.6;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex: 0 0 5px; }
.badge.gray { background: #f1f5f9; color: #475569; border-color: #e6ebf1; }
.badge.blue { background: var(--brand-50); color: var(--brand-600); border-color: #dbeafe; }
.badge.green { background: var(--ok-bg); color: #15803d; border-color: #d1fae5; }
.badge.amber { background: var(--warn-bg); color: #b45309; border-color: #fde68a; }
.badge.red { background: var(--danger-bg); color: #b91c1c; border-color: #fecaca; }
.badge.violet { background: var(--violet-bg); color: #6d28d9; border-color: #ddd6fe; }
.badge.cyan { background: var(--info-bg); color: #0e7490; border-color: #cffafe; }

.tag {
  display: inline-block; padding: 1px 7px; border-radius: 5px;
  font-size: 11px; background: #f1f5f9; color: var(--ink-3);
  border: 1px solid var(--line); white-space: nowrap;
}

/* priority */
.prio { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; }
.prio::before { content: ""; width: 3px; height: 13px; border-radius: 2px; background: currentColor; }
.prio.p0 { color: var(--danger); }
.prio.p1 { color: #ea580c; }
.prio.p2 { color: #ca8a04; }
.prio.p3 { color: var(--muted); }

/* ============================================================
   Progress
   ============================================================ */
.prog { display: flex; align-items: center; gap: 9px; min-width: 110px; }
.prog .bar { flex: 1; height: 6px; border-radius: 6px; background: #edf1f6; overflow: hidden; min-width: 54px; }
.prog .bar > i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, #3b82f6, #2563eb); transition: width .5s cubic-bezier(.4,0,.2,1); }
.prog .bar > i.done { background: linear-gradient(90deg, #22c55e, #16a34a); }
.prog .bar > i.warn { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.prog .bar > i.danger { background: linear-gradient(90deg, #f87171, #dc2626); }
.prog .pc { font-size: 11.5px; font-weight: 600; color: var(--ink-3); width: 32px; text-align: right; font-variant-numeric: tabular-nums; }

/* segmented bar */
.seg-bar { display: flex; height: 8px; border-radius: 6px; overflow: hidden; background: #edf1f6; }
.seg-bar > i { height: 100%; transition: width .5s; }

/* ============================================================
   Filter bar / toolbar
   ============================================================ */
.toolbar {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-soft);
  flex-wrap: wrap;
  background: #fff;
  border-radius: var(--radius) var(--radius) 0 0;
}
.field {
  display: flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 8px;
  background: #fff; font-size: 12.5px; color: var(--ink-2);
  transition: border-color .15s, box-shadow .15s;
}
.field svg { width: 14px; height: 14px; color: var(--muted-2); }
.field input, .field select {
  border: 0; outline: none; background: transparent; font-family: inherit;
  font-size: 12.5px; color: var(--ink); width: 100%; min-width: 0;
}
.field:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.09); }
.field.search { width: 220px; }
.field select { cursor: pointer; height: 30px; }
.toolbar .spacer { margin-left: auto; }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 14px; background: #fff; }
.tab {
  padding: 11px 13px 10px; font-size: 13px; color: var(--muted);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
  font-weight: 500; transition: color .15s, border-color .15s; white-space: nowrap;
  display: flex; align-items: center; gap: 6px;
}
.tab:hover { color: var(--ink-2); }
.tab.on { color: var(--brand); border-bottom-color: var(--brand); }
.tab .cnt {
  font-size: 10.5px; background: #f1f5f9; color: var(--muted);
  padding: 0 5px; border-radius: 20px; font-weight: 600; line-height: 1.65;
}
.tab.on .cnt { background: var(--brand-50); color: var(--brand); }

/* ============================================================
   Modal
   ============================================================ */
.mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
  backdrop-filter: blur(2px);
  z-index: 200; display: flex; align-items: flex-start; justify-content: center;
  padding: 5vh 20px 40px; overflow-y: auto;
  animation: fade .16s ease;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes pop { from { opacity: 0; transform: translateY(-8px) scale(.99) } to { opacity: 1; transform: none } }
.modal {
  background: #fff; border-radius: var(--radius-lg);
  box-shadow: var(--sh-3);
  width: 100%; max-width: 620px;
  animation: pop .2s cubic-bezier(.2,.8,.3,1);
  overflow: hidden;
}
.modal.wide { max-width: 840px; }
.modal.slim { max-width: 440px; }
.modal-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px; border-bottom: 1px solid var(--line-soft);
}
.modal-head h3 { font-size: 15.5px; }
.modal-head .sub { font-size: 12px; color: var(--muted); }
.modal-head .x { margin-left: auto; }
.modal-body { padding: 20px; max-height: 68vh; overflow-y: auto; }
.modal-foot {
  display: flex; align-items: center; gap: 9px;
  padding: 14px 20px; border-top: 1px solid var(--line-soft);
  background: #fafbfd;
}
.modal-foot .right { margin-left: auto; display: flex; gap: 9px; }

/* ============================================================
   Forms
   ============================================================ */
.form-grid { display: grid; gap: 15px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fg { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fg.full { grid-column: 1 / -1; }
.fg > label { font-size: 12.5px; font-weight: 500; color: var(--ink-2); display: flex; align-items: center; gap: 4px; }
.fg > label .req { color: var(--danger); }
.fg .hint { font-size: 11.5px; color: var(--muted); }

.inp, .sel, .txa {
  width: 100%; font-family: inherit; font-size: 13px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 0 11px; height: 36px; background: #fff;
  outline: none; transition: border-color .15s, box-shadow .15s;
  appearance: none;
}
.txa { height: auto; min-height: 78px; padding: 9px 11px; line-height: 1.6; resize: vertical; }
.inp:focus, .sel:focus, .txa:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.inp::placeholder, .txa::placeholder { color: var(--muted-2); }
.sel {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  padding-right: 30px; cursor: pointer;
}
.inp[type="date"], .inp[type="month"] { cursor: pointer; }
.inp.err { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(220,38,38,.09); }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  padding: 5px 11px; border-radius: 20px; border: 1px solid var(--line);
  font-size: 12.5px; cursor: pointer; background: #fff; color: var(--ink-3);
  transition: all .14s; user-select: none;
}
.chip:hover { border-color: #c7d2e0; background: var(--hover); }
.chip.on { background: var(--brand-50); border-color: #bfdbfe; color: var(--brand-600); font-weight: 500; }

.switch-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px; border: 1px solid var(--line); border-radius: 9px;
  background: #fcfdff;
}
.switch-row .sw-txt { flex: 1; min-width: 0; }
.switch-row .sw-txt b { display: block; font-size: 13px; color: var(--ink); font-weight: 500; }
.switch-row .sw-txt span { font-size: 11.5px; color: var(--muted); }

/* ============================================================
   Kanban
   ============================================================ */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 14px; align-items: stretch; }
.kb-col { background: #f2f5f9; border-radius: var(--radius); padding: 10px; border: 1px solid #e8edf4; min-height: 120px; }
.kb-head { display: flex; align-items: center; gap: 7px; padding: 2px 4px 9px; }
.kb-head .kb-t { font-size: 12.5px; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.kb-head .kb-n { margin-left: auto; font-size: 11px; color: var(--muted); background: #fff; border-radius: 20px; padding: 0 7px; border: 1px solid var(--line); font-weight: 600; }
.kb-card {
  background: #fff; border: 1px solid var(--line); border-radius: 9px;
  padding: 11px 12px; margin-bottom: 8px; box-shadow: 0 1px 2px rgba(15,23,42,.04);
  cursor: pointer; transition: box-shadow .16s, transform .16s, border-color .16s;
}
.kb-card:hover { box-shadow: var(--sh-2); border-color: #d3dbe6; transform: translateY(-1px); }
.kb-card .kc-title { font-size: 13px; font-weight: 500; color: var(--ink); line-height: 1.45; margin-bottom: 7px; }
.kb-card .kc-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); }
.kb-card .kc-foot { display: flex; align-items: center; gap: 7px; margin-top: 9px; padding-top: 8px; border-top: 1px dashed var(--line); }

/* ============================================================
   Timeline / list items
   ============================================================ */
.tl { position: relative; padding-left: 22px; }
.tl::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 1.5px; background: var(--line); }
.tl-item { position: relative; padding-bottom: 17px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: -21px; top: 5px;
  width: 9px; height: 9px; border-radius: 50%;
  background: #fff; border: 2px solid #cbd5e1;
}
.tl-item.ok::before { border-color: var(--ok); background: var(--ok-bg); }
.tl-item.brand::before { border-color: var(--brand); background: var(--brand-50); }
.tl-item.warn::before { border-color: var(--warn); background: var(--warn-bg); }
.tl-item .tl-t { font-size: 13px; color: var(--ink); font-weight: 500; }
.tl-item .tl-m { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.tl-item .tl-d { font-size: 13px; color: var(--ink-3); margin-top: 5px; line-height: 1.6; }

.list-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line-soft);
}
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: #fafbfe; }

/* ============================================================
   Empty / misc
   ============================================================ */
.empty {
  padding: 46px 20px; text-align: center; color: var(--muted);
}
.empty .ico {
  width: 46px; height: 46px; border-radius: 13px; margin: 0 auto 12px;
  background: #f1f5f9; display: grid; place-items: center; color: var(--muted-2);
}
.empty .ico svg { width: 22px; height: 22px; }
.empty b { display: block; color: var(--ink-2); font-size: 13.5px; font-weight: 500; margin-bottom: 3px; }
.empty span { font-size: 12.5px; }

.divider { height: 1px; background: var(--line-soft); margin: 16px 0; }

.kv { display: grid; grid-template-columns: 92px 1fr; gap: 9px 12px; font-size: 13px; }
.kv dt { color: var(--muted); font-size: 12.5px; }
.kv dd { margin: 0; color: var(--ink-2); min-width: 0; word-break: break-word; }

.hint-bar {
  display: flex; align-items: flex-start; gap: 9px;
  background: #f8fafc; border: 1px solid var(--line); border-left: 3px solid var(--brand);
  border-radius: 8px; padding: 10px 13px; font-size: 12.5px; color: var(--ink-3);
  line-height: 1.6;
}
.hint-bar svg { width: 15px; height: 15px; color: var(--brand); flex: 0 0 15px; margin-top: 2px; }
.hint-bar.warn { border-left-color: var(--warn); background: #fffdf7; }
.hint-bar.warn svg { color: var(--warn); }

/* toast */
.toast-wrap { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 500; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 8px;
  background: #0f172a; color: #fff; font-size: 13px;
  padding: 9px 15px; border-radius: 9px; box-shadow: var(--sh-3);
  animation: toastIn .22s cubic-bezier(.2,.8,.3,1);
  max-width: 92vw;
}
.toast svg { width: 15px; height: 15px; flex: 0 0 15px; }
.toast.ok svg { color: #4ade80; }
.toast.err svg { color: #f87171; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px) } to { opacity: 1; transform: none } }

/* mini chart */
.chart { width: 100%; display: block; overflow: visible; }
.chart .grid-line { stroke: #eef2f7; stroke-width: 1; }
.chart .axis-label { font-size: 10px; fill: #94a3b8; }
.chart .area { fill: url(#gradArea); }
.chart .line { fill: none; stroke: #2563eb; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart .dot { fill: #fff; stroke: #2563eb; stroke-width: 2; }

/* legend */
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; vertical-align: 1px; }

/* gantt */
.gantt { font-size: 12px; }
.gt-row { display: grid; grid-template-columns: 200px 1fr; align-items: center; gap: 12px; height: 38px; border-bottom: 1px solid var(--line-soft); }
.gt-row:last-child { border-bottom: 0; }
.gt-name { font-size: 12.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: 4px; }
.gt-track { position: relative; height: 100%; display: flex; align-items: center; }
.gt-bg { position: absolute; inset: 8px 0; background-color: #fafbfd; background-image: linear-gradient(90deg, #eaeff6 1px, transparent 1px); background-size: 20% 100%; border-radius: 5px; }
.gt-bar {
  position: relative; height: 20px; border-radius: 6px;
  background: linear-gradient(90deg, #60a5fa, #3b82f6);
  display: flex; align-items: center; justify-content: flex-end;
  padding-right: 6px; font-size: 10.5px; color: #fff; font-weight: 600;
  box-shadow: 0 1px 3px rgba(37,99,235,.28);
  min-width: 34px; overflow: hidden; white-space: nowrap;
}
.gt-bar.done { background: linear-gradient(90deg, #4ade80, #22c55e); box-shadow: 0 1px 3px rgba(34,197,94,.28); }
.gt-bar.warn { background: linear-gradient(90deg, #fbbf24, #f59e0b); box-shadow: 0 1px 3px rgba(245,158,11,.28); }
.gt-bar.late { background: linear-gradient(90deg, #f87171, #ef4444); box-shadow: 0 1px 3px rgba(239,68,68,.28); }

/* permission lock panel */
.lock-panel {
  text-align: center; padding: 60px 24px; max-width: 460px; margin: 30px auto;
}
.lock-panel .lk-ico {
  width: 58px; height: 58px; border-radius: 17px; margin: 0 auto 16px;
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  display: grid; place-items: center; color: #64748b;
}
.lock-panel .lk-ico svg { width: 26px; height: 26px; }
.lock-panel h3 { font-size: 16px; margin-bottom: 6px; }
.lock-panel p { font-size: 13px; color: var(--muted); line-height: 1.7; }

/* customer card grid */
.cust-card {
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff;
  padding: 14px; cursor: pointer; transition: box-shadow .18s, border-color .18s, transform .18s;
  box-shadow: var(--sh-1);
}
.cust-card:hover { box-shadow: var(--sh-2); border-color: #d3dbe6; transform: translateY(-1px); }
.cust-card .cc-head { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.cust-card .cc-n { font-size: 13.5px; font-weight: 600; color: var(--ink); line-height: 1.35; }
.cust-card .cc-s { font-size: 11.5px; color: var(--muted); }
.cust-card .cc-body { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.cust-card .cc-foot { display: flex; align-items: center; gap: 6px; padding-top: 9px; border-top: 1px dashed var(--line); font-size: 11.5px; color: var(--muted); }

/* month picker strip */
.months { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.month-pill {
  padding: 5px 12px; border-radius: 20px; border: 1px solid var(--line);
  font-size: 12.5px; cursor: pointer; background: #fff; color: var(--ink-3);
  white-space: nowrap; transition: all .14s;
}
.month-pill:hover { background: var(--hover); }
.month-pill.on { background: var(--ink); color: #fff; border-color: var(--ink); font-weight: 500; }

/* right drawer */
.drawer-mask { position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 180; animation: fade .16s; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 480px; max-width: 96vw;
  background: #fff; z-index: 181; box-shadow: -8px 0 40px rgba(15,23,42,.16);
  display: flex; flex-direction: column; animation: slideIn .24s cubic-bezier(.2,.8,.3,1);
}
@keyframes slideIn { from { transform: translateX(24px); opacity: .4 } to { transform: none; opacity: 1 } }

/* responsive */
@media (max-width: 1180px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .g-3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .kanban { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 900px) {
  :root { --side-w: 210px; }
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .side { transform: translateX(-100%); z-index: 90; }
  .side.open { transform: none; box-shadow: 0 0 60px rgba(0,0,0,.4); }
  .main { margin-left: 0; }
  .content { padding: 14px; }
  .g-2, .g-3, .g-4 { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: 1fr; }
  .top-search { display: none; }
  .who-meta { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .page-head { flex-wrap: wrap; }
  .page-head .ph-actions { margin-left: 0; width: 100%; }
}

/* print */
@media print {
  .side, .topbar, .page-head .ph-actions, .toolbar, .t-actions { display: none !important; }
  .main { margin-left: 0; }
  .content { padding: 0; }
  .card { box-shadow: none; border-color: #ccc; }
}

/* dashboard split layout */
.dash-split { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .dash-split { grid-template-columns: 1fr !important; } }

/* table bar inside .bar usage */
.bar { height: 6px; border-radius: 6px; background: #edf1f6; overflow: hidden; }

/* ---------- milestone track ---------- */
.ms-track { display: flex; position: relative; padding-top: 6px; }
.ms-track::before {
  content: ""; position: absolute; left: 8%; right: 8%; top: 12px;
  height: 2px; background: #e8edf4; border-radius: 2px;
}
.ms-item { flex: 1; text-align: center; position: relative; min-width: 0; }
.ms-item i {
  display: block; width: 13px; height: 13px; border-radius: 50%;
  background: #fff; border: 2px solid #cbd5e1; margin: 0 auto 9px;
  position: relative; z-index: 1; transition: all .2s;
}
.ms-item.done i { background: #16a34a; border-color: #16a34a; box-shadow: 0 0 0 3px #ecfdf5; }
.ms-item b { display: block; font-size: 11.5px; font-weight: 500; color: #475569; line-height: 1.4; padding: 0 3px; }
.ms-item.done b { color: #0f172a; }
.ms-item span { display: block; font-size: 10.5px; color: #94a3b8; margin-top: 1px; }

/* ---------- mobile menu button ---------- */
.menu-btn { display: none !important; }
@media (max-width: 900px) { .menu-btn { display: grid !important; } }

/* details summary marker cleanup */
details summary::-webkit-details-marker { display: none; }
details summary svg { transition: transform .2s; vertical-align: -2px; }
details[open] summary svg { transform: rotate(90deg); }

@media (max-width: 560px) {
  .g-4 { grid-template-columns: 1fr !important; }
  .stat .st-val { font-size: 24px; }
}

/* ---------- 财务系统入口（右上角） ---------- */
.fin-entry {
  display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 11px 0 10px; margin-right: 2px;
  border-radius: 8px; text-decoration: none;
  background: linear-gradient(135deg, #0f172a, #1e2c46);
  color: #fff; font-size: 12.5px; font-weight: 500; letter-spacing: .01em;
  box-shadow: 0 2px 8px rgba(15,23,42,.18);
  transition: transform .15s, box-shadow .15s, opacity .15s;
  white-space: nowrap;
}
.fin-entry svg { width: 14px; height: 14px; }
.fin-entry:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(15,23,42,.26); }
.fin-entry[hidden] { display: none !important; }
@media (max-width: 720px) {
  .fin-entry { padding: 0 9px; }
  .fin-entry span { display: none; }
  .fin-entry svg:last-child { display: none; }
}

/* ---------- 复选框 ---------- */
.chk { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; padding: 7px 0; }
.chk input { position: absolute; opacity: 0; width: 0; height: 0; }
.chk i {
  width: 17px; height: 17px; border-radius: 5px; border: 1.5px solid #cbd5e1;
  background: #fff; display: inline-block; position: relative; transition: all .15s; flex: 0 0 17px;
}
.chk input:checked + i { background: #2563eb; border-color: #2563eb; }
.chk input:checked + i::after {
  content: ""; position: absolute; left: 5px; top: 1.5px; width: 4px; height: 8px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.chk span { font-size: 13px; color: #334155; }

/* ---------- 首屏加载遮罩 ---------- */
.boot-mask {
  position: fixed; inset: 0; z-index: 9999;
  background: #f6f8fb;
  display: grid; place-items: center;
}
.boot-inner { text-align: center; padding: 0 24px; }
.boot-logo {
  width: 52px; height: 52px; border-radius: 14px; margin: 0 auto 16px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff; font-size: 22px; font-weight: 700;
  display: grid; place-items: center;
  box-shadow: 0 8px 24px rgba(37, 99, 235, .3);
  animation: bootPulse 1.8s ease-in-out infinite;
}
.boot-logo.err { background: #dc2626; animation: none; box-shadow: none; }
.boot-txt { font-size: 13px; color: #64748b; line-height: 1.65; max-width: 340px; }
.boot-retry {
  margin-top: 15px; height: 34px; padding: 0 16px;
  border-radius: 8px; border: 1px solid #dbe2ec; background: #fff;
  font-size: 12.5px; color: #334155; cursor: pointer; font-family: inherit;
}
.boot-retry:hover { border-color: #bfdbfe; color: #2563eb; }
@keyframes bootPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(.93); opacity: .8; }
}

/* ---------- 移动端顶栏触控优化 ---------- */
@media (max-width: 720px) {
  .topbar { padding: 0 10px; gap: 2px; }
  .topbar .crumb, .topbar .top-crumb { display: none; }
  .topbar .icon-btn, .topbar .menu-btn {
    width: 38px !important; height: 38px !important;
    display: grid !important; place-items: center;
  }
  .topbar .crumb { font-size: 13px; max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #top-search-box { display: none !important; }
  .crumb { overflow: hidden; }
  #who-btn { gap: 6px; }
  #btn-search { display: grid !important; }
  #who-btn .who-name, #who-btn .who-dept { display: none; }
  .content { padding: 14px 12px 40px !important; }
  .page-head h1 { font-size: 19px; }
  .modal { max-width: 100% !important; border-radius: 14px; }
  .mask { padding: 3vh 10px 24px; }
  .form-grid { grid-template-columns: 1fr !important; }
  .tbl th, .tbl td { padding: 9px 8px; }
}
