:root {
  --brand: #4f46e5;
  --brand-600: #4338ca;
  --brand-50: #eef2ff;
  --brand-100: #e0e7ff;
  --ink: #0f172a;
  --ink2: #334155;
  --muted: #64748b;
  --muted2: #94a3b8;
  --line: #e6e9ef;
  --line2: #eef1f6;
  --bg: #f5f6f8;
  --card: #ffffff;
  --ok: #059669;
  --ok-bg: #ecfdf5;
  --warn: #b45309;
  --warn-bg: #fffbeb;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 10px 30px -16px rgba(15, 23, 42, .25);
  --sidebar-w: 236px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.6;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ========== 登录页 ========== */
.login-body { min-height: 100vh; background: #fff; }
.login-shell { display: grid; grid-template-columns: 1.05fr .95fr; min-height: 100vh; }
.login-brand {
  position: relative;
  padding: 64px 60px;
  color: #fff;
  background: radial-gradient(900px 600px at 10% 0%, #6366f1 0%, transparent 60%),
              linear-gradient(145deg, #1e1b4b 0%, #312e81 45%, #0f172a 100%);
  display: flex; flex-direction: column; justify-content: center;
  overflow: hidden;
}
.login-brand::after {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(circle at 30% 40%, #000 0%, transparent 75%);
  pointer-events: none;
}
.brand-mark {
  width: 56px; height: 56px; border-radius: 16px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #818cf8, #4f46e5);
  font-size: 26px; font-weight: 700; color: #fff;
  box-shadow: 0 12px 30px -10px rgba(99, 102, 241, .8);
  margin-bottom: 28px;
}
.brand-mark.sm { width: 38px; height: 38px; border-radius: 11px; font-size: 18px; margin: 0; }
.login-brand h1 { font-size: 38px; letter-spacing: -.02em; }
.brand-sub { color: #c7d2fe; margin: 12px 0 40px; font-size: 15px; }
.brand-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 18px; max-width: 420px; }
.brand-points li { display: flex; gap: 14px; color: #e0e7ff; font-size: 14.5px; align-items: flex-start; }
.brand-points span {
  font-size: 11px; letter-spacing: .08em; color: #a5b4fc;
  border: 1px solid rgba(165, 180, 252, .4); border-radius: 6px;
  padding: 2px 6px; margin-top: 3px; flex: none;
}
.brand-foot { margin-top: 48px; color: #818cf8; font-size: 12.5px; letter-spacing: .04em; }
.brand-icp { margin-top: 8px; font-size: 12px; }
.brand-icp a { color: #6366f1; }
.brand-icp a:hover { color: #a5b4fc; }

.login-form-wrap { display: grid; place-items: center; padding: 40px 28px; background: #fff; }
.login-card { width: 100%; max-width: 380px; }
.login-card h2 { font-size: 24px; }
.login-tip { color: var(--muted); margin: 6px 0 28px; font-size: 13.5px; }

.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 12.5px; color: var(--ink2); margin-bottom: 6px; font-weight: 500; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 9px; background: #fff; color: var(--ink);
  transition: border-color .15s, box-shadow .15s; outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}
.field textarea { resize: vertical; min-height: 76px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 15px; border-radius: 9px; border: 1px solid var(--line);
  background: #fff; color: var(--ink2); cursor: pointer; font-size: 13.5px;
  font-weight: 500; transition: all .15s; white-space: nowrap;
}
.btn:hover { background: #f8fafc; border-color: #d8dee9; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(79,70,229,.3); }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: #f1f5f9; color: var(--ink); }
.btn-danger { color: var(--danger); border-color: #fecaca; background: #fff; }
.btn-danger:hover { background: var(--danger-bg); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn-block { width: 100%; padding: 11px; font-size: 15px; margin-top: 8px; }

.login-error { color: var(--danger); font-size: 13px; min-height: 20px; }
.demo-hint { margin-top: 30px; padding-top: 22px; border-top: 1px dashed var(--line); }
.demo-title { font-size: 12px; color: var(--muted2); margin-bottom: 10px; letter-spacing: .04em; }
.demo-grid { display: grid; gap: 6px; }
.demo-grid button {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 7px 10px; background: #fafbfc; border: 1px solid var(--line2);
  border-radius: 8px; cursor: pointer; font-size: 12px; color: var(--muted);
  transition: all .15s; text-align: left;
}
.demo-grid button:hover { border-color: var(--brand-100); background: var(--brand-50); }
.demo-grid b { color: var(--ink2); font-weight: 500; font-size: 12.5px; }
.demo-grid span { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; }

/* ========== 应用布局 ========== */
.app-body { height: 100vh; height: 100dvh; overflow: hidden; }
.layout { display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: 100vh; height: 100dvh; }

.sidebar {
  background: #0f172a;
  color: #94a3b8;
  display: flex; flex-direction: column;
  padding: 18px 14px 14px;
  border-right: 1px solid #1e293b;
  z-index: 40;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 20px; flex: none; }
.side-brand strong { display: block; color: #f1f5f9; font-size: 14px; font-weight: 600; line-height: 1.3; }
.side-brand small { color: #475569; font-size: 9.5px; letter-spacing: .13em; }

.side-nav {
  display: flex; flex-direction: column; gap: 2px;
  flex: 1; min-height: 0; overflow-y: auto;
}
.side-nav .nav-group { font-size: 10.5px; letter-spacing: .1em; color: #475569; padding: 16px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 8px; color: #a8b3c4;
  font-size: 13.5px; cursor: pointer; border: none; background: none;
  width: 100%; text-align: left; transition: all .15s;
}
.nav-item:hover { background: #1e293b; color: #e2e8f0; }
.nav-item.active { background: #1e1b4b; color: #fff; box-shadow: inset 0 0 0 1px rgba(129,140,248,.35); }
.nav-item .ico { width: 18px; text-align: center; font-size: 14px; opacity: .9; }
.nav-item .badge-dot { margin-left: auto; background: var(--danger); color: #fff; font-size: 10px; padding: 0 5px; border-radius: 9px; }

.side-foot { border-top: 1px solid #1e293b; padding-top: 12px; margin-top: 8px; flex: none; }
.side-user { display: flex; align-items: center; gap: 9px; padding: 4px 6px 10px; }
.side-user .u-name { color: #e2e8f0; font-size: 13px; font-weight: 500; }
.side-user .u-role { color: #64748b; font-size: 11px; }
.side-logout {
  width: 100%; padding: 7px; border-radius: 8px; border: 1px solid #1e293b;
  background: transparent; color: #64748b; font-size: 12.5px; cursor: pointer; transition: all .15s;
}
.side-logout:hover { background: #1e293b; color: #e2e8f0; }
.side-icp { margin-top: 9px; text-align: center; font-size: 10.5px; color: #475569; }
.side-icp a { color: #475569; }
.side-icp a:hover { color: #94a3b8; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.topbar {
  height: 60px; flex: none; display: flex; align-items: center; gap: 14px;
  padding: 0 24px; background: rgba(255,255,255,.86);
  border-bottom: 1px solid var(--line); backdrop-filter: blur(8px);
}
.crumb h1 { font-size: 16.5px; }
.crumb span { font-size: 12px; color: var(--muted2); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.today-chip {
  font-size: 12px; color: var(--muted); background: #f1f5f9;
  padding: 5px 10px; border-radius: 20px;
}
.presence {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: #15803d; background: #f0fdf4;
  border: 1px solid #dcfce7; padding: 3px 9px; border-radius: 20px;
  white-space: nowrap;
}
.presence b { font-weight: 600; }
.presence i {
  width: 6px; height: 6px; border-radius: 50%; background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, .16);
}
.presence.off { color: var(--muted2); background: #f8fafc; border-color: var(--line); }
.presence.off i { background: #cbd5e1; box-shadow: none; }
.sync-bar {
  position: sticky; top: 0; z-index: 20; margin: -22px -24px 14px;
  padding: 7px 24px; background: var(--warn-bg); border-bottom: 1px solid #fde68a;
  color: var(--warn); font-size: 12.5px; display: none;
}
.sync-bar.show { display: block; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, #818cf8, #4f46e5); color: #fff;
  font-size: 12.5px; font-weight: 600;
}
.view {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden;
  padding: 22px 24px 60px; overscroll-behavior: contain;
}

.icon-btn {
  border: 1px solid var(--line); background: #fff; border-radius: 8px;
  width: 34px; height: 34px; cursor: pointer; color: var(--ink2); font-size: 15px;
}
.only-mobile { display: none; }
.scrim { display: none; }

/* ========== 通用组件 ========== */
.page-head { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { font-size: 19px; }
.page-head .desc { color: var(--muted); font-size: 12.5px; }
.page-head .spacer { flex: 1; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-head {
  display: flex; align-items: center; gap: 10px; padding: 14px 18px;
  border-bottom: 1px solid var(--line2);
}
.card-head h3 { font-size: 14.5px; }
.card-head .spacer { flex: 1; }
.card-body { padding: 16px 18px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 17px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat .k { color: var(--muted); font-size: 12.5px; }
.stat .v { font-size: 26px; font-weight: 650; letter-spacing: -.02em; margin-top: 2px; line-height: 1.25; }
.stat .sub { color: var(--muted2); font-size: 11.5px; }
.stat.accent .v { color: var(--brand); }
.stat.warn .v { color: var(--warn); }
.stat.ok .v { color: var(--ok); }
.stat .glyph { position: absolute; right: 14px; top: 12px; font-size: 20px; opacity: .18; }

.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px; border-radius: 20px; font-size: 11.5px; font-weight: 500;
  background: #f1f5f9; color: var(--muted);
}
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.danger { background: var(--danger-bg); color: var(--danger); }
.tag.brand { background: var(--brand-50); color: var(--brand-600); }
.tag.ghost { background: #fff; border: 1px solid var(--line); color: var(--muted); }

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .search {
  position: relative; flex: 1; min-width: 180px; max-width: 300px;
}
.toolbar .search input {
  width: 100%; padding: 8px 12px 8px 32px; border-radius: 9px;
  border: 1px solid var(--line); background: #fff; outline: none;
}
.toolbar .search input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
.toolbar .search::before {
  content: ""; position: absolute; left: 11px; top: 10px; width: 8px; height: 8px;
  border: 1.5px solid var(--muted2); border-radius: 50%;
}
.toolbar .search::after {
  content: ""; position: absolute; left: 18px; top: 19px; width: 5px; height: 1.5px;
  background: var(--muted2); transform: rotate(45deg); border-radius: 1px;
}
select.ctl, input.ctl {
  padding: 8px 11px; border-radius: 9px; border: 1px solid var(--line);
  background: #fff; color: var(--ink2); outline: none;
}
/* 下拉框：右侧自己画箭头，避免原生箭头挤压文字；不用固定高度，按内容撑开 */
select.ctl {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2394a3b8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 10px 6px;
  padding: 8px 30px 8px 11px;
  min-width: 132px;
  max-width: 240px;
  flex: 0 0 auto;
  text-overflow: ellipsis;
  line-height: 1.35;
}
select.ctl:focus, input.ctl:focus { border-color: var(--brand); }

.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th {
  text-align: left; font-weight: 500; color: var(--muted); font-size: 12px;
  padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fafbfc;
  white-space: nowrap;
}
table.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr:hover { background: #fcfcfd; }
.cell-strong { font-weight: 500; color: var(--ink); }
.cell-sub { color: var(--muted2); font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; color: var(--ink2); }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; opacity: .55; transition: opacity .15s; }
tr:hover .row-actions { opacity: 1; }

.empty { text-align: center; padding: 44px 20px; color: var(--muted2); font-size: 13px; }
.empty .big { font-size: 26px; margin-bottom: 8px; opacity: .5; }

/* ========== 排期时间轴 ========== */
.week-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.week-nav { display: flex; align-items: center; gap: 8px; }
.week-nav .sm { display: none; }
.seg { display: inline-flex; background: #eef1f6; padding: 3px; border-radius: 9px; }
.seg button {
  border: none; background: transparent; padding: 6px 13px; border-radius: 7px;
  font-size: 12.5px; color: var(--muted); cursor: pointer;
}
.seg button.active { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); font-weight: 500; }

.timeline {
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff;
  overflow: auto; box-shadow: var(--shadow-sm);
}
.tl-inner { min-width: 820px; }
.tl-head { display: grid; grid-template-columns: 54px repeat(7, 1fr); border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 3; }
.tl-head .h { padding: 9px 8px; text-align: center; font-size: 12.5px; color: var(--muted); border-left: 1px solid var(--line2); }
.tl-head .h b { display: block; font-size: 15px; color: var(--ink); font-weight: 600; letter-spacing: -.01em; }
.tl-head .h.today b { color: var(--brand); }
.tl-head .h.today { background: var(--brand-50); }
.tl-body {
  display: grid; grid-template-columns: 54px repeat(7, 1fr);
  position: relative;
  /* 首行时间标签用 translateY(-7px) 对齐到小时线，不留这 8px 会被容器裁掉上半截 */
  padding-top: 8px;
}
.tl-hours { border-right: 1px solid var(--line2); }
.tl-hour { height: 56px; font-size: 10.5px; color: var(--muted2); text-align: right; padding-right: 8px; transform: translateY(-7px); }
.tl-col { position: relative; border-left: 1px solid var(--line2); }
.tl-col.today { background: rgba(238, 242, 255, .38); }
.tl-line { position: absolute; left: 0; right: 0; border-top: 1px dashed #eef1f6; }
.tl-slot { position: absolute; left: 0; right: 0; }
.tl-slot:hover { background: rgba(79, 70, 229, .035); cursor: copy; }

.sched-block {
  position: absolute; left: 4px; right: 4px; border-radius: 8px; padding: 6px 8px;
  font-size: 11.5px; overflow: hidden; cursor: pointer;
  border-left: 3px solid var(--brand); background: var(--brand-50); color: #312e81;
  box-shadow: 0 1px 2px rgba(15,23,42,.06); transition: transform .12s, box-shadow .12s;
  line-height: 1.35;
}
.sched-block:hover { transform: translateY(-1px); box-shadow: 0 6px 16px -6px rgba(49,46,129,.4); z-index: 2; }
.sched-block .t { font-weight: 600; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sched-block .m { opacity: .78; font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sched-block.s-live { background: #fff1f2; border-left-color: #e11d48; color: #9f1239; }
.sched-block.s-draft { background: #f8fafc; border-left-color: #94a3b8; color: #475569; border-left-style: dashed; }
.sched-block.s-finished { background: #f1f5f9; border-left-color: #94a3b8; color: #64748b; }
.sched-block.s-confirmed { background: #eef2ff; border-left-color: #4f46e5; color: #312e81; }

/* 排期列表卡片 */
.sched-list { display: grid; gap: 10px; }
.sched-row {
  display: grid; grid-template-columns: 108px 1fr auto; gap: 16px; align-items: center;
  background: #fff; border: 1px solid var(--line); border-radius: 11px; padding: 12px 16px;
  box-shadow: var(--shadow-sm);
}
.sched-row .time { font-size: 13px; font-weight: 600; color: var(--ink); }
.sched-row .date { font-size: 11.5px; color: var(--muted2); }
.sched-row .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 3px; }

/* ========== 线索看板 ========== */
.kanban { display: grid; grid-template-columns: repeat(10, minmax(172px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 8px; }
.kcol { background: #f1f3f7; border-radius: 11px; padding: 9px; min-height: 200px; }
.kcol-head { display: flex; align-items: center; gap: 6px; padding: 3px 4px 9px; font-size: 12.5px; color: var(--ink2); font-weight: 500; }
.kcol-head .dot { width: 7px; height: 7px; border-radius: 50%; }
.kcol-head .n { margin-left: auto; color: var(--muted2); font-size: 11.5px; font-weight: 400; }
.kcard {
  background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 10px 11px;
  margin-bottom: 7px; cursor: pointer; box-shadow: var(--shadow-sm); transition: all .15s;
}
.kcard:hover { border-color: #c7d2fe; box-shadow: 0 4px 14px -8px rgba(49,46,129,.45); transform: translateY(-1px); }
.kcard .nm { font-weight: 500; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.kcard .meta { color: var(--muted2); font-size: 11.5px; margin-top: 3px; }

/* 漏斗 */
.funnel { display: flex; gap: 2px; margin: 4px 0 0; }
.funnel .fseg { height: 8px; border-radius: 3px; }

/* ========== 抽屉 / 弹窗 ========== */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .42);
  display: flex; align-items: center; justify-content: center; z-index: 100;
  padding: 20px; animation: fade .15s ease;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 560px;
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px); /* 手机浏览器地址栏收起/展开时 100vh 会算错 */
  display: flex; flex-direction: column;
  box-shadow: 0 24px 60px -12px rgba(15, 23, 42, .45); animation: pop .18s ease;
}
@keyframes pop { from { transform: translateY(8px) scale(.99); opacity: 0 } to { transform: none; opacity: 1 } }
.modal.wide { max-width: 720px; }
.modal-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line2); }
.modal-head h3 { font-size: 15.5px; }
.modal-head .spacer { flex: 1; }
.modal-body { padding: 18px 20px; overflow-y: auto; min-height: 0; flex: 1; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line2); }
.x-btn { border: none; background: none; font-size: 20px; line-height: 1; color: var(--muted2); cursor: pointer; padding: 0 4px; }
.x-btn:hover { color: var(--ink); }

.drawer-mask { position: fixed; inset: 0; background: rgba(15,23,42,.35); z-index: 90; animation: fade .15s; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: auto;
  height: 100vh; height: 100dvh; /* 同上：固定 100vh 会把底部推出可视区 */
  width: min(560px, 100%);
  background: #fff; z-index: 91; display: flex; flex-direction: column;
  box-shadow: -20px 0 50px -20px rgba(15,23,42,.45); animation: slideIn .22s ease;
}
@keyframes slideIn { from { transform: translateX(30px); opacity: .6 } to { transform: none; opacity: 1 } }
.drawer-head { padding: 18px 22px 14px; border-bottom: 1px solid var(--line2); }
.drawer-body { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 22px 40px; }

.kv { display: grid; grid-template-columns: 92px 1fr; gap: 8px 14px; font-size: 13px; }
.kv dt { color: var(--muted2); }
.kv dd { margin: 0; color: var(--ink2); }

.section-title { font-size: 12px; color: var(--muted2); letter-spacing: .06em; margin: 22px 0 10px; display: flex; align-items: center; gap: 8px; }
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line2); }

.stage-rail { display: flex; align-items: center; gap: 0; margin: 6px 0 4px; }
.stage-rail .sn { flex: 1; text-align: center; font-size: 10.5px; color: var(--muted2); position: relative; padding-top: 14px; }
.stage-rail .sn::before {
  content: ""; position: absolute; top: 2px; left: 50%; transform: translateX(-50%);
  width: 8px; height: 8px; border-radius: 50%; background: #e2e8f0;
}
.stage-rail .sn::after { content: ""; position: absolute; top: 5.5px; left: 0; right: 50%; height: 2px; background: #e2e8f0; }
.stage-rail .sn:first-child::after { display: none; }
.stage-rail .sn.done { color: var(--brand); }
.stage-rail .sn.done::before { background: var(--brand); }
.stage-rail .sn.done::after { background: var(--brand); }
.stage-rail .sn.cur::before { box-shadow: 0 0 0 4px var(--brand-100); }

.timeline-list { position: relative; padding-left: 18px; }
.timeline-list::before { content: ""; position: absolute; left: 4px; top: 6px; bottom: 6px; width: 1px; background: var(--line); }
.tl-item { position: relative; padding: 0 0 16px 0; }
.tl-item::before {
  content: ""; position: absolute; left: -18px; top: 6px; width: 8px; height: 8px;
  border-radius: 50%; background: #fff; border: 2px solid #cbd5e1;
}
.tl-item.hi::before { border-color: var(--brand); }
.tl-item .h { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.tl-item .c { color: var(--ink2); font-size: 13px; margin-top: 2px; white-space: pre-wrap; }
.tl-item .d { color: var(--muted2); font-size: 11px; }

.alert {
  border-radius: 10px; padding: 10px 13px; font-size: 12.5px; display: flex; gap: 9px;
  align-items: flex-start; line-height: 1.5;
}
.chg {
  display: grid; gap: 5px; margin-top: 6px; background: #f8fafc;
  border: 1px solid var(--line2); border-radius: 8px; padding: 8px 10px;
}
.chg-row { display: flex; align-items: center; gap: 7px; font-size: 12px; flex-wrap: wrap; }
.chg-k { color: var(--muted2); min-width: 56px; }
.chg-a { color: var(--muted); text-decoration: line-through; }
.chg-arrow { color: var(--muted2); }
.chg-b { color: var(--ink); font-weight: 500; }

.alert.danger { background: var(--danger-bg); color: #991b1b; border: 1px solid #fecaca; }
.alert.warn { background: var(--warn-bg); color: #92400e; border: 1px solid #fde68a; }
.alert.info { background: var(--brand-50); color: #3730a3; border: 1px solid #c7d2fe; }
.alert.ok { background: var(--ok-bg); color: #065f46; border: 1px solid #a7f3d0; }

.conflict-box { margin-top: 12px; display: grid; gap: 6px; }
.conflict-item {
  background: var(--danger-bg); border: 1px solid #fecaca; color: #991b1b;
  padding: 8px 11px; border-radius: 8px; font-size: 12.5px;
}

.toast-root { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 999; display: grid; gap: 8px; }
.toast {
  background: #0f172a; color: #fff; padding: 9px 16px; border-radius: 9px; font-size: 13px;
  box-shadow: 0 12px 30px -12px rgba(0,0,0,.6); animation: drop .2s ease; max-width: 460px;
}
.toast.err { background: #991b1b; }
.toast.ok { background: #065f46; }
@keyframes drop { from { transform: translateY(-8px); opacity: 0 } to { transform: none; opacity: 1 } }

.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stack { display: grid; gap: 14px; }
.hint { color: var(--muted2); font-size: 12px; }
.spacer { flex: 1; }
.flex { display: flex; align-items: center; gap: 8px; }
.flex-wrap { flex-wrap: wrap; }

.room-card { border: 1px solid var(--line); border-radius: 11px; padding: 14px 15px; background: #fff; box-shadow: var(--shadow-sm); }
.room-card .top { display: flex; align-items: center; gap: 8px; }
.room-card .nm { font-weight: 550; font-size: 13.5px; }
.room-card .sub { color: var(--muted2); font-size: 11.5px; margin-top: 2px; }
.room-card .bar { height: 3px; border-radius: 2px; background: #eef1f6; margin-top: 12px; overflow: hidden; }
.room-card .bar i { display: block; height: 100%; background: var(--brand); border-radius: 2px; }

.person-card { display: flex; align-items: center; gap: 11px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.person-ava { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-size: 13px; font-weight: 600; flex: none; }
.person-card .nm { font-weight: 500; font-size: 13.5px; }
.person-card .sub { color: var(--muted2); font-size: 11.5px; }

/* ========== 响应式 ========== */
@media (max-width: 1180px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 262px;
    transform: translateX(-100%); transition: transform .22s ease;
  }
  .sidebar.open { transform: none; }
  .scrim.show { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 35; }
  .only-mobile { display: inline-flex; align-items: center; justify-content: center; }
  .view { padding: 16px 14px 80px; }
  .topbar { padding: 0 14px; height: 56px; }
  .today-chip { display: none; }
  .crumb span { display: none; }
  .view { padding-top: 12px; }
  .kanban { grid-template-columns: repeat(10, 200px); }
  .sched-row { grid-template-columns: 100px 1fr; }
  .sched-row .date { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sched-row .row-actions { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (max-width: 560px) {
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 12px 13px; }
  .stat .v { font-size: 21px; }
  .field-row, .field-row-3 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .modal { max-height: calc(100vh - 24px); border-radius: 12px; }
  .modal-body { padding: 14px 15px; }
  .modal-head, .modal-foot { padding: 13px 15px; }
  .drawer { width: 100%; }
  .view { padding: 14px 12px 80px; }
}

/* ========== 滚动条：显式可见，避免长页面误以为不能再滚 ========== */
.view, .modal-body, .drawer-body, .timeline, .table-wrap, .kanban {
  scrollbar-width: thin;
  scrollbar-color: #b6c3d4 transparent;
}
.side-nav { scrollbar-width: thin; scrollbar-color: #334155 transparent; }
.side-nav::-webkit-scrollbar { width: 8px; }
.side-nav::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }
.side-nav::-webkit-scrollbar-track { background: transparent; }
.view::-webkit-scrollbar,
.modal-body::-webkit-scrollbar,
.drawer-body::-webkit-scrollbar,
.timeline::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar,
.kanban::-webkit-scrollbar {
  width: 10px; height: 10px;
}
.view::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track,
.drawer-body::-webkit-scrollbar-track,
.timeline::-webkit-scrollbar-track,
.table-wrap::-webkit-scrollbar-track,
.kanban::-webkit-scrollbar-track {
  background: transparent;
}
.view::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb,
.drawer-body::-webkit-scrollbar-thumb,
.timeline::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb,
.kanban::-webkit-scrollbar-thumb {
  background: #b6c3d4; border-radius: 6px; border: 2px solid transparent;
  background-clip: content-box;
}
.view::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover,
.drawer-body::-webkit-scrollbar-thumb:hover,
.timeline::-webkit-scrollbar-thumb:hover,
.table-wrap::-webkit-scrollbar-thumb:hover {
  background: #94a3b8; background-clip: content-box;
}

/* ========== 角色勾选与权限矩阵 ========== */
.role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 8px 12px;
  padding: 8px 0 2px;
}
.role-check {
  display: flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; cursor: pointer; background: #fff;
  font-size: 13px; transition: border-color .12s, background .12s;
}
.role-check:hover { border-color: var(--brand-300, #c7d2fe); background: #f8faff; }
.role-check input[type='checkbox'],
.cap-row input[type='checkbox'] {
  width: 14px; height: 14px; margin: 0; flex: none; min-width: 0;
}
.role-check span:first-of-type { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-check:has(input:checked) {
  border-color: var(--brand-500, #6366f1);
  background: var(--brand-50, #eef2ff);
}

.cap-matrix { display: grid; gap: 10px; margin-top: 8px; }
.cap-group {
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px 6px; background: #fbfcfe;
}
.cap-head {
  display: flex; align-items: baseline; gap: 8px;
  padding-bottom: 6px; margin-bottom: 4px;
  border-bottom: 1px dashed var(--line2);
}
.cap-head b { font-size: 13px; color: var(--ink); }
.cap-head span { font-size: 11.5px; color: var(--muted2); }
.cap-row {
  display: grid; grid-template-columns: 16px 1fr auto;
  align-items: center; gap: 8px;
  padding: 5px 0; cursor: pointer; font-size: 12.5px;
}
.cap-row input { margin: 0; }
.cap-label { color: var(--ink2); }
.cap-row:has(input:checked) .cap-label { color: var(--ink); font-weight: 500; }
.cap-desc { color: var(--muted2); font-size: 11.5px; text-align: right; }
.cap-row:has(input:disabled) { cursor: default; opacity: .75; }

@media (max-width: 560px) {
  .role-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .role-check { padding: 7px 8px; font-size: 12.5px; }
  .cap-row { grid-template-columns: 16px 1fr; row-gap: 2px; align-items: start; }
  .cap-row input { margin-top: 2px; }
  .cap-desc { grid-column: 2; text-align: left; font-size: 11px; }
}

/* ========== 移动端：排期页头部收紧，时间轴不被裁 ========== */
@media (max-width: 860px) {
  .page-head { gap: 8px; padding-bottom: 8px; align-items: flex-start; }
  .page-head h2 { font-size: 17px; line-height: 1.35; }
  .page-head .desc { font-size: 11.5px; line-height: 1.5; }
  .page-head .spacer { display: none; }
  .page-head .ctl {
    /* 不能被 flex 压到装不下 5 个字的项目名，空间不够时宁可换行 */
    flex: 0 1 auto; min-width: 132px; max-width: 100%;
    height: auto; min-height: 34px;
    padding: 7px 30px 7px 10px; font-size: 12.5px; line-height: 1.35;
    background-position: right 9px center;
  }
  .page-head .seg { flex: 0 0 auto; }
  .page-head .seg button { padding: 6px 10px; font-size: 12px; }
  .week-nav { flex: 0 0 auto; justify-content: flex-start; gap: 6px; }
  .week-nav .btn { padding: 7px 11px; font-size: 12.5px; }
  .week-nav .lg { display: none; }
  .week-nav .sm { display: inline; }
  #newSched { flex: 1 1 auto; margin-top: 0; }

  /* 周视图：纵向跟随页面滚动，避免「内层滚动 + 外层滚动」两套滚动手势打架 */
  .timeline { overflow-x: auto; overflow-y: hidden; }
  .tl-head { position: static; }
  .timeline .hint { display: none; }
}

/* ========== 重复系列删除范围选择 ========== */
.scope-list { display: grid; gap: 8px; }
.scope-opt {
  display: block; width: 100%; text-align: left; cursor: pointer;
  border: 1px solid var(--line); border-radius: 10px;
  background: #fff; padding: 11px 13px;
  transition: border-color .12s, background .12s;
}
.scope-opt:hover { border-color: var(--brand-500, #6366f1); background: var(--brand-50, #eef2ff); }
.scope-opt b { display: block; font-size: 13.5px; color: var(--ink); margin-bottom: 3px; }
.scope-opt span { font-size: 12px; color: var(--muted2); line-height: 1.5; }
.scope-opt.danger b { color: var(--danger); }
.scope-opt.danger:hover { border-color: #fca5a5; background: var(--danger-bg); }

/* ========== 手机端弹窗：改为底部上滑面板，按钮一定在屏幕内 ========== */
@media (max-width: 640px) {
  .modal-mask { align-items: flex-end; padding: 0; }
  .modal,
  .modal.wide {
    width: 100%; max-width: none;
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: 16px 16px 0 0;
    animation: sheetUp .2s ease;
  }
  @keyframes sheetUp {
    from { transform: translateY(26px); opacity: .85 }
    to { transform: none; opacity: 1 }
  }
  .modal-head {
    padding: 13px 18px;
    border-radius: 16px 16px 0 0;
    flex: none;
  }
  .modal-head h3 { font-size: 15px; }
  .modal-body {
    padding: 14px 18px;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .modal-foot {
    flex: none;
    padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px));
    gap: 10px;
    justify-content: stretch;
  }
  .modal-foot .btn { flex: 1; }
  .modal-foot .btn-danger { flex: 0 0 auto; }

  .drawer { width: 100%; }
  .drawer-head { padding: calc(14px + env(safe-area-inset-top, 0px)) 18px 12px; }
  .drawer-body {
    padding: 16px 18px calc(36px + env(safe-area-inset-bottom, 0px));
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
}

/* ========== 移动端 / 微信内置浏览器适配 ========== */
/* 可视区真实高度由 JS（visualViewport）写进 --app-h。
   微信 iOS 是 WKWebView、安卓是 X5 内核：地址栏收放、键盘弹起时
   100vh 不会跟着变，底部按钮会被顶到屏幕外，所以不能只靠 100vh。 */
:root { --app-h: 100vh; --kb: 0px; }
@supports (height: 100dvh) {
  :root { --app-h: 100dvh; }
}
.app-body, .layout { height: var(--app-h); }

/* 触摸交互：去掉点击灰块、去掉 300ms 延迟、长按不弹系统菜单 */
a, button, .btn, .icon-btn, .nav-item, .tab, label.field, .demo-hint button,
.modal-foot .btn, select.ctl {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}
button, .btn, .icon-btn { -webkit-user-select: none; user-select: none; }
.app-body { overscroll-behavior-y: none; }

/* 键盘弹起时，把底部上滑面板抬到键盘上沿。
   安卓微信会压缩布局视口（--kb 为 0，不触发），iOS 微信不会，靠这一行兜住。 */
.modal-mask { bottom: var(--kb); }

@media (max-width: 640px) {
  /* iOS 微信对 16px 以下的输入框会自动放大整页，统一提到 16px 避免页面被撑歪 */
  input, select, textarea { font-size: 16px; }
  .modal, .modal.wide { max-height: calc(var(--app-h) - 24px); }
  .login-body, .login-shell { min-height: var(--app-h); }
  /* 手机端表格首列吸边，横向滑动时不断行 */
  .table-wrap { -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
}

/* 窄屏登录页：品牌区在 900px 以下被隐藏，这里补一个轻量品牌头，
   否则微信里点开只看到「账号登录」，认不出是哪个系统 */
.login-mobile-brand { display: none; }
@media (max-width: 900px) {
  .login-form-wrap { place-items: start center; padding-top: 12vh; }
  .login-mobile-brand {
    display: flex; align-items: center; gap: 11px; margin-bottom: 26px;
  }
  .login-mobile-brand .brand-mark.sm { flex: none; }
  .login-mobile-brand strong { display: block; font-size: 15.5px; letter-spacing: -.01em; }
  .login-mobile-brand span { display: block; font-size: 12px; color: var(--muted2); margin-top: 1px; }
  .login-card h2 { font-size: 20px; }
}
@media (max-width: 900px) and (max-height: 700px) {
  .login-form-wrap { padding-top: 7vh; }
}

/* 联系方式已脱敏的学员（与当前用户无关）：置灰 + 禁止选中复制，避免误当成完整号码拨打 */
.masked {
  color: var(--muted2);
  -webkit-user-select: none;
  user-select: none;
}
