:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --sidebar: #1f2a44;
  --sidebar-2: #27365a;
  --text: #1f2733;
  --muted: #7a869a;
  --line: #e7ebf2;
  --primary: #3b6cf6;
  --primary-d: #2f59d6;
  --green: #1aa86b;
  --amber: #e9a23b;
  --red: #e2574c;
  --shadow: 0 2px 10px rgba(31, 42, 68, 0.06);
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.app { display: flex; min-height: 100vh; }

/* sidebar */
.sidebar {
  width: 220px; flex: none; background: linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
  color: #cdd6ea; display: flex; flex-direction: column; padding: 18px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; }
.brand-logo { width: 38px; height: 38px; border-radius: 10px; background: rgba(255,255,255,.12); color: #fff; display: flex; align-items: center; justify-content: center; }
.brand-logo .icon { width: 22px; height: 22px; }
.brand-title { font-weight: 700; color: #fff; font-size: 15px; }
.brand-sub { font-size: 11px; color: #93a0c0; }
.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: 10px;
  color: #cdd6ea; text-decoration: none; cursor: pointer; font-weight: 500; user-select: none;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(59,108,246,.35); }
.nav-user { display: flex; flex-direction: column; gap: 1px; padding: 10px 12px; margin-top: 10px; border-top: 1px solid rgba(255,255,255,.1); }
.nav-user-name { color: #fff; font-weight: 600; font-size: 13px; }
.nav-user-role { color: #8b97ba; font-size: 11px; }
.nav-logout { margin-top: 4px; color: #cdd6ea; }
.nav-logout:hover { color: #ff8a8a; }
.sidebar-foot { margin-top: auto; font-size: 11px; color: #7e8bb0; padding: 10px 8px 0; }

/* content */
.content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 58px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
.view-title { font-size: 17px; font-weight: 700; }
.top-meta { color: var(--muted); font-size: 13px; display: flex; gap: 14px; align-items: center; }
.view { padding: 22px 24px; overflow: auto; }

/* generic */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.row { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.static-val { padding: 9px 12px; background: #f1f5fb; border: 1px solid var(--line); border-radius: 9px; font-size: 13px; font-weight: 600; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff;
  color: var(--text); padding: 9px 14px; border-radius: 9px; cursor: pointer; font-size: 13px; font-weight: 600;
}
.btn:hover { border-color: #c9d3e3; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-d); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); border-color: #f3c9c5; }
.btn.sm { padding: 6px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

input, select {
  font: inherit; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--text); outline: none;
  max-width: 100%; min-width: 0;
}
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,108,246,.12); }

/* entry */
.lock-banner { display: flex; align-items: center; gap: 10px; background: #eef3ff; border: 1px solid #d6e2ff; color: #25479e; padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; }
.lock-banner .icon { color: var(--primary); }
.team-banner { background: #eafaef; border-color: #c6ecd6; color: #1a7a4c; }
.team-banner .icon { color: var(--green); }

/* segmented toggle */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg-btn { border: none; background: #fff; color: var(--muted); padding: 8px 14px; cursor: pointer; font: inherit; }
.seg-btn.on { background: var(--primary); color: #fff; }

/* team summary completion colors */
.cell-act { font-weight: 700; font-size: 14px; }
.cell-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.cell-sub .good { color: var(--green); font-weight: 700; }
.cell-sub .mid { color: var(--amber); font-weight: 700; }
.cell-sub .low { color: var(--red); font-weight: 700; }
.entry-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.metric {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; overflow: hidden;
}
.metric-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.metric-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.metric-ic { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: #fff; }
.metric-ic .icon { width: 22px; height: 22px; }
.metric-name { font-weight: 700; font-size: 15px; }
.stepper { display: flex; align-items: center; gap: 8px; min-width: 0; }
.stepper button {
  width: 40px; height: 44px; flex: none; border-radius: 10px; border: 1px solid var(--line); background: #fafbfe; font-size: 22px;
  cursor: pointer; color: var(--text); display: flex; align-items: center; justify-content: center;
}
.stepper button:hover { border-color: var(--primary); color: var(--primary); }
.stepper input {
  flex: 1 1 0; width: 100%; min-width: 0; text-align: center;
  font-size: 24px; font-weight: 700; height: 44px; padding: 0 4px;
}
/* 数字框自带上下箭头会额外占宽，步进器已有 −/＋，隐藏之 */
.stepper input[type=number] { -moz-appearance: textfield; appearance: textfield; }
.stepper input[type=number]::-webkit-outer-spin-button,
.stepper input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.prog { height: 7px; background: #eef1f6; border-radius: 99px; overflow: hidden; }
.prog > i { display: block; height: 100%; background: var(--green); border-radius: 99px; transition: width .25s; }
.prog.warn > i { background: var(--amber); }
.prog-label { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; }

/* table */
table.grid { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table.grid th, table.grid td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; font-size: 13px; }
table.grid th { background: #f7f9fc; font-weight: 700; color: #56627a; }
table.grid tr:hover td { background: #fafcff; }
table.grid tr.clickable { cursor: pointer; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; background: #eef1f6; color: #566; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.pill.ok { background: #e4f6ee; color: var(--green); }
.pill.bad { background: #fdeceb; color: var(--red); }
.pill.warn { background: #fdf2e1; color: var(--amber); }

/* modal */
.modal-mask { position: fixed; inset: 0; background: rgba(20,28,46,.45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal { background: #fff; border-radius: 14px; width: min(560px, 96vw); max-height: 90vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 15px; }
.modal-body { padding: 18px; }
.modal-foot { padding: 14px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.x-btn { border: none; background: transparent; cursor: pointer; color: var(--muted); font-size: 20px; line-height: 1; padding: 4px; }

/* search list */
.search-wrap { position: relative; }
.search-list { margin-top: 8px; border: 1px solid var(--line); border-radius: 10px; max-height: 260px; overflow: auto; }
.search-list .opt { padding: 11px 13px; cursor: pointer; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.search-list .opt:last-child { border-bottom: none; }
.search-list .opt:hover { background: #f3f7ff; }
.search-list .opt.sel { background: #eaf1ff; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(20px);
  background: #1f2a44; color: #fff; padding: 11px 18px; border-radius: 10px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: all .25s; z-index: 100; box-shadow: 0 10px 30px rgba(0,0,0,.3);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* detail grid (excel-like) */
.detail-scroll { overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
table.mini { border-collapse: collapse; font-size: 12px; }
table.mini th, table.mini td { border: 1px solid var(--line); padding: 6px 8px; text-align: center; white-space: nowrap; }
table.mini th { background: #f3f6fb; position: sticky; top: 0; }
table.mini td.rowhead, table.mini th.rowhead { background: #f7f9fc; text-align: left; font-weight: 700; position: sticky; left: 0; }
table.mini .tgt { color: var(--muted); font-size: 11px; }
.weekend { background: #fff7f0; }

.section-title { font-size: 14px; font-weight: 700; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.section-title .icon { width: 18px; height: 18px; color: var(--primary); }
.mb { margin-bottom: 16px; }
.mt { margin-top: 16px; }

.target-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field input, .field select { width: 100%; }

/* 日历看板（每日预定） */
.cal-board { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); background: #f3f6fb; }
.cal-weekdays > div { text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); padding: 8px 0; border-bottom: 1px solid var(--line); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-cell { min-height: 78px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 6px 7px; cursor: pointer; transition: background .15s; display: flex; flex-direction: column; gap: 5px; }
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell.we { background: #fafbfe; }
.cal-cell.empty { cursor: default; background: #fbfcfe; }
.cal-cell:not(.empty):hover { background: #eef4ff; }
.cal-head { display: flex; align-items: baseline; gap: 4px; }
.cal-num { font-size: 14px; font-weight: 800; color: var(--text); }
.cal-dow { font-size: 11px; color: var(--muted); }
.cal-mets { display: flex; flex-direction: column; gap: 3px; }
.cal-met { display: flex; align-items: center; gap: 5px; font-size: 12px; }
.cal-met b { font-weight: 700; color: #33415c; }
.cal-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: none; }

/* 节假日管理 */
.hol-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; margin-bottom: 8px; }
.hol-item .muted { color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); }
.total-bar { display: flex; gap: 18px; flex-wrap: wrap; }
.total-item { background: #f7f9fc; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.total-item b { font-size: 18px; }
.empty { text-align: center; color: var(--muted); padding: 40px; }

/* ============ 总控制台登录 ============ */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.login-card { width: 100%; max-width: 360px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px 26px; text-align: center; }
.login-logo { width: 52px; height: 52px; border-radius: 14px; background: rgba(59,108,246,.12); color: var(--primary); display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; }
.login-logo .icon { width: 26px; height: 26px; }
.login-card h2 { margin: 0 0 6px; font-size: 20px; }
.login-card .hint { margin: 0 0 18px; text-align: left; line-height: 1.5; }
.login-input { width: 100%; box-sizing: border-box; padding: 11px 13px; border: 1px solid var(--line); border-radius: 9px; font: inherit; outline: none; margin-bottom: 12px; }
.login-input:focus { border-color: var(--primary); }
.btn.block { width: 100%; justify-content: center; }
.login-err { color: var(--red); font-size: 13px; min-height: 18px; margin-top: 10px; }
.nav-logout { margin-top: auto; }
