:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --ink: #16181d;
  --ink-2: #5b6270;
  --ink-3: #8a919e;
  --line: #e6e8ec;
  --red: #c8102e;
  --red-ink: #a20d25;
  --red-soft: #fdeef0;
  --ok: #178a5b;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 12px 32px -12px rgba(16, 24, 40, .16);
  --radius: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

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

body {
  background:
    radial-gradient(1200px 500px at 15% -10%, #fff1f2 0%, rgba(255, 241, 242, 0) 60%),
    var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 48px 24px 64px;
}

/* ---------- hero ---------- */
.hero { margin-bottom: 28px; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--ink-2);
}

.brand .dot {
  width: 10px; height: 10px; border-radius: 3px;
  background: var(--red);
  box-shadow: 0 0 0 4px var(--red-soft);
}

.brand-name { font-weight: 700; color: var(--ink); letter-spacing: .02em; }

.tag {
  margin-left: 4px;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink-3);
  letter-spacing: .04em;
}

.hero h1 {
  margin: 16px 0 8px;
  font-size: 30px;
  line-height: 1.3;
  letter-spacing: -.01em;
  font-weight: 750;
}

.hero .sub { margin: 0; color: var(--ink-2); font-size: 15px; }

/* ---------- layout ---------- */
.grid {
  display: grid;
  grid-template-columns: 372px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.card-title { margin: 0 0 16px; font-size: 15px; font-weight: 700; }

/* ---------- form ---------- */
.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 7px;
  font-weight: 550;
}

.field input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  font-size: 15px;
  color: var(--ink);
  background: #fbfbfc;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}

.field input:focus {
  background: #fff;
  border-color: #f2b8c0;
  box-shadow: 0 0 0 4px var(--red-soft);
}

.field input::placeholder { color: #b3b9c4; }

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.chips { display: flex; gap: 6px; margin-top: 8px; }

.chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s;
}

.chip:hover { border-color: #f2b8c0; color: var(--red-ink); background: var(--red-soft); }

.hint { margin: 8px 0 0; font-size: 12px; color: var(--ink-3); }
.hint b { color: var(--ink-2); font-weight: 600; }

.err { margin: 6px 0 0; font-size: 12px; color: var(--red); }

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: #f2f3f6;
  padding: 4px;
  border-radius: 11px;
}

.segmented button {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  padding: 8px 6px;
  border-radius: 8px;
  cursor: pointer;
  transition: all .15s;
}

.segmented button.on {
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .1);
}

.primary {
  width: 100%;
  height: 46px;
  margin-top: 6px;
  border: 0;
  border-radius: 11px;
  background: var(--red);
  color: #fff;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: .02em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .15s, transform .05s;
}

.primary:hover { background: var(--red-ink); }
.primary:active { transform: translateY(1px); }
.primary[disabled] { opacity: .6; cursor: default; }

.primary .ico { font-size: 15px; }

.foot { margin: 10px 0 0; font-size: 12px; color: var(--ink-3); text-align: center; }

/* ---------- preview ---------- */
.preview-head { display: flex; align-items: center; justify-content: space-between; }
.preview-head .card-title { margin-bottom: 0; }

.pill {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #f2f3f6;
  color: var(--ink-3);
}

.pill.ok { background: #e9f7f0; color: var(--ok); }

.meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 16px 0;
}

.meta div {
  background: #fafafb;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
}

.meta span { display: block; font-size: 11px; color: var(--ink-3); margin-bottom: 3px; }
.meta b { font-size: 14px; font-weight: 650; }

.sheet-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  max-height: 560px;
}

table.sheet {
  border-collapse: collapse;
  width: 100%;
  table-layout: fixed;
  font-size: 12px;
}

table.sheet th, table.sheet td {
  border: 1px solid #eceef2;
  padding: 5px 3px;
  text-align: center;
  white-space: nowrap;
}

table.sheet thead th {
  background: #f7f8fa;
  color: var(--ink-2);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
}

table.sheet th.c-idx { width: 42px; }
table.sheet th.c-item { text-align: left; padding-left: 8px; }

table.sheet td.item {
  text-align: left;
  padding-left: 8px;
  color: var(--ink-2);
  white-space: normal;
  line-height: 1.35;
  min-width: 150px;
}

table.sheet td.day { width: 34px; color: var(--red); font-weight: 600; font-size: 10.5px; padding: 5px 0; }
table.sheet thead th.day { font-weight: 500; color: var(--ink-3); font-size: 10.5px; padding: 6px 0; }

.live { margin: 12px 0 0; font-size: 12px; color: var(--ink-3); }
.live.ok { color: var(--ok); }

/* ---------- footer ---------- */
.tail {
  margin-top: 34px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-3);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.tail p { margin: 0; }

.grid > .card { min-width: 0; }

@media (max-width: 860px) {
  .grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .page { padding: 22px 14px 40px; }
  .hero h1 { font-size: 23px; line-height: 1.25; }
  .hero .sub { font-size: 13.5px; }
  .card { padding: 16px; border-radius: 14px; }
  .cal-foot { gap: 6px; }
  .cal-stat b { font-size: 17px; }
  .strip { grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); }
  .day-chip .s { font-size: 10px; }
  .range-add { flex-wrap: wrap; }
}

/* ---------- 出勤日历 ---------- */
.cal-card { min-height: 100%; }

.presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 8px; }

.presets button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  font-size: 12.5px;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s;
}

.presets button:hover { border-color: #f2b8c0; color: var(--red-ink); background: var(--red-soft); }

.presets button.on {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  font-weight: 600;
}

.strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(62px, 1fr));
  gap: 7px;
  margin: 14px 0 4px;
  max-height: 268px;
  overflow-y: auto;
  padding-right: 4px;
}

.strip .empty { grid-column: 1 / -1; color: var(--ink-3); font-size: 13px; margin: 12px 0; }

.day-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 7px 4px 6px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  transition: all .12s;
  font-family: inherit;
}

.day-chip:hover { transform: translateY(-1px); box-shadow: 0 4px 12px -6px rgba(16, 24, 40, .35); }

.day-chip .d { font-size: 13px; font-weight: 650; color: var(--ink); line-height: 1.1; }
.day-chip .w { font-size: 10.5px; color: var(--ink-3); line-height: 1.1; }
.day-chip .s {
  margin-top: 3px;
  font-size: 10.5px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--red-soft);
  color: var(--red);
  font-weight: 600;
}

.day-chip.rest { background: #f7f7f9; border-color: #eceef2; }
.day-chip.rest .d { color: var(--ink-3); font-weight: 500; }
.day-chip.rest .s { background: #eceef2; color: var(--ink-3); }

.day-chip.leave { background: #fffaf0; border-color: #f0dcb0; }
.day-chip.leave .s { background: #fbe7c6; color: #a8681a; }

.cal-foot {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.cal-stat { text-align: center; }
.cal-stat b { display: block; font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
.cal-stat span { font-size: 11.5px; color: var(--ink-3); }

.warn { margin: 12px 0 0; font-size: 12px; color: #a8681a; background: #fffaf0; border: 1px solid #f0dcb0; border-radius: 10px; padding: 8px 10px; }

.preview-card { margin-top: 20px; }
table.sheet thead th.day.off { color: #c9ced7; }
table.sheet td.day:empty { color: transparent; }

.check {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
}

.check input { width: 14px; height: 14px; accent-color: var(--red); cursor: pointer; }

.hint.on { color: var(--ok); }

.day-chip.beyond { opacity: .38; }
.day-chip.beyond .s { background: #eceef2; color: var(--ink-3); }

.field label .opt { color: var(--ink-3); font-weight: 400; font-size: 11px; }

.with-clear { display: flex; gap: 6px; align-items: center; }
.with-clear input { flex: 1; }

.mini {
  width: 34px; height: 42px;
  border: 1px solid var(--line);
  background: #fbfbfc;
  border-radius: 10px;
  color: var(--ink-3);
  font-size: 16px;
  cursor: pointer;
  transition: all .15s;
}
.mini:hover { color: var(--red); border-color: #f2b8c0; background: var(--red-soft); }

.day-chip.quit { opacity: .45; background: #fafafb; cursor: default; }
.day-chip.quit .s { background: #eceef2; color: var(--ink-3); }

.warn.info { color: var(--ink-2); background: #f7f8fa; border-color: var(--line); }

/* ---------- 日期清单模式 ---------- */
.segmented.small { display: inline-grid; grid-template-columns: auto auto; margin-bottom: 12px; }
.segmented.small button { font-size: 12.5px; padding: 7px 14px; white-space: nowrap; }

.with-add { display: flex; gap: 8px; }
.with-add input {
  flex: 1;
  height: 40px;
  padding: 0 12px;
  font-size: 14px;
  background: #fbfbfc;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
}
.with-add input:focus { background: #fff; border-color: #f2b8c0; box-shadow: 0 0 0 4px var(--red-soft); }

#pick-add {
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  background: var(--red);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  flex: none;
}
#pick-add:hover { background: var(--red-ink); }

.two.disabled { opacity: .45; pointer-events: none; }

.day-chip { position: relative; }
.chip-x {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 12px;
  line-height: 15px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .12);
  opacity: .5;
  transition: opacity .12s, color .12s, border-color .12s;
}
.day-chip:hover .chip-x { opacity: 1; }
.day-chip:hover .chip-x, .chip-x:hover { opacity: 1; color: var(--red); border-color: #f2b8c0; }
@media (hover: none) { .chip-x { opacity: .85; } }

.day-chip.removed { background: #fbfbfc; border-style: dashed; opacity: .75; }
.day-chip.removed .d { color: var(--ink-3); text-decoration: line-through; }
.day-chip.removed .s { background: #eceef2; color: var(--ink-3); }
.chip-x.undo { color: var(--ok); border-color: #cfe9dc; opacity: .9; }
.chip-x { opacity: .42; }
.day-chip:hover .chip-x { opacity: 1; }

.mode-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.mode-label { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.segmented.small { margin-bottom: 0; }

/* ---------- 日期清单 ---------- */
.add-block { margin-bottom: 14px; }
.add-label { display: block; font-size: 12px; color: var(--ink-3); margin-bottom: 6px; }

.range-add { display: flex; align-items: center; gap: 8px; }
.range-add input[type="date"] {
  flex: 1;
  height: 38px;
  padding: 0 8px;
  font-size: 13px;
  background: #fbfbfc;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
  min-width: 0;
}
.range-add .to { font-size: 12px; color: var(--ink-3); flex: none; }
#range-add {
  flex: none;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
#range-add:hover { border-color: #f2b8c0; color: var(--red-ink); background: var(--red-soft); }

.link-btn {
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
}
.link-btn:hover { color: var(--red); }

.day-chip .x {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 12px;
  line-height: 15px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .12);
  opacity: .45;
  transition: opacity .12s, color .12s, border-color .12s;
}
.day-chip:hover .x { opacity: 1; color: var(--red); border-color: #f2b8c0; }

/* ---------- 月历 ---------- */
.cal {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 12px 8px;
  margin: 14px 0;
  background: #fcfcfd;
}

.cal-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.cal-nav b { font-size: 13.5px; font-weight: 650; }
.cal-nav .link-btn { margin-left: auto; }

.cal-btn {
  width: 26px; height: 26px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.cal-btn:hover { border-color: #f2b8c0; color: var(--red); }

.cal-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11px;
  color: var(--ink-3);
  margin-bottom: 6px;
}

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }

.cal-cell {
  height: 34px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.cal-cell:hover { background: #f2f3f6; }
.cal-cell.blank { cursor: default; background: transparent; }
.cal-cell.today { border-color: #f2b8c0; }
.cal-cell.on { background: var(--red); color: #fff; font-weight: 650; border-color: var(--red); }

.cal .hint { margin: 8px 0 2px; }

/* ---------- 访问密码 ---------- */
.gate {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(900px 420px at 20% -10%, #fff1f2 0%, rgba(255, 241, 242, 0) 65%),
    #f5f6f8;
}

.gate-box {
  width: 100%;
  max-width: 360px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 28px 24px;
  text-align: center;
}

.gate-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 18px;
}
.gate-brand .dot { width: 9px; height: 9px; border-radius: 3px; background: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }

.gate-box h2 { font-size: 17px; margin: 0 0 6px; }
.gate-sub { font-size: 12.5px; color: var(--ink-3); margin: 0 0 16px; }

.gate-box input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  font-size: 15px;
  text-align: center;
  letter-spacing: .12em;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fbfbfc;
  outline: none;
  box-sizing: border-box;
}
.gate-box input:focus { background: #fff; border-color: #f2b8c0; box-shadow: 0 0 0 4px var(--red-soft); }

.gate-err { color: var(--red); font-size: 12px; margin: 8px 0 0; }

.gate-box button {
  width: 100%;
  height: 44px;
  margin-top: 14px;
  border: 0;
  border-radius: 11px;
  background: var(--red);
  color: #fff;
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
}
.gate-box button:hover { background: var(--red-ink); }

.three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 4px; }
.three input { width: 100%; }
.sub-label { font-size: 12px; color: var(--ink-3); margin-bottom: 6px; display: block; }
@media (max-width: 860px) {
  .three { grid-template-columns: 1fr; }
}

table.sheet td.day.date { font-size: 9px; line-height: 1.15; white-space: normal; padding: 3px 0; }

#mgr-hint { margin: 0 0 14px; }
