:root {
  --pink: #FF8FB1;
  --pink-deep: #F26D9B;
  --cream: #FFF7FB;
  --card: #FFFFFF;
  --ink: #6E4A5A;
  --ink-soft: #C2A6B6;
  --pink-soft: #FFF0F6;
  --line: #FBDDEA;
  --mint-soft: #EAFBF3;
  --yellow-soft: #FFF8E3;
  --shadow-sm: 0 2px 6px rgba(242, 109, 155, .10), 0 6px 16px rgba(242, 109, 155, .08);
  --shadow-md: 0 8px 22px rgba(242, 109, 155, .16), 0 3px 8px rgba(242, 109, 155, .10);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Yuanti SC", "YuanTi SC", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1100px 460px at 50% -200px, #FFE3F1 0%, rgba(255, 227, 241, 0) 70%),
    linear-gradient(180deg, #FFF6FB 0%, #FFF9FC 100%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

header {
  background: linear-gradient(135deg, #FFB7D5 0%, #FF9EC9 48%, #F79BC8 100%);
  color: #fff;
  padding: 22px clamp(16px, 4vw, 40px) 20px;
  box-shadow: 0 8px 22px rgba(242, 109, 155, .28);
  position: relative;
  overflow: hidden;
}
header::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .40) 2px, transparent 3px);
  background-size: 24px 24px;
  opacity: .5;
  pointer-events: none;
}
header::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 4px;
  background: linear-gradient(90deg, #FFD2E6, #FF9EC9, #FFD2E6);
}
.title {
  font-size: clamp(22px, 4vw, 28px);
  font-weight: 800;
  letter-spacing: 2px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}
.title .dot {
  width: 13px; height: 13px; border-radius: 50%;
  background: #FFF; box-shadow: 0 0 0 4px rgba(255, 255, 255, .40);
}
.nav, .ops { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; position: relative; }
.nav button, .ops button {
  background: rgba(255, 255, 255, .26);
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, .55);
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 700;
  transition: background .18s ease, transform .12s ease, box-shadow .18s ease;
}
.nav button:hover, .ops button:hover {
  background: rgba(255, 255, 255, .42);
  transform: translateY(-1px);
}
.nav button:active, .ops button:active { transform: translateY(0); }
#today { background: #fff; color: var(--pink-deep); border-color: transparent; }
#today:hover { background: #FFF0F7; }
#monthLabel {
  font-size: 18px; font-weight: 800; min-width: 130px; text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .10);
}
#operator {
  padding: 8px 14px; border-radius: 999px;
  border: 1.5px solid rgba(255, 255, 255, .7);
  background: #fff; color: var(--ink); font-size: 14px; font-weight: 700; cursor: pointer;
}
.ops label { font-size: 13.5px; font-weight: 700; }
#status { font-size: 12px; color: #FFF3F9; min-width: 64px; font-weight: 700; }
.tip {
  font-size: 11px; color: rgba(255, 255, 255, .82);
  margin-top: 4px; letter-spacing: .2px; position: relative;
}

.weekbar {
  display: grid; grid-template-columns: repeat(7, 1fr);
  background: var(--pink-soft);
  max-width: 1160px; margin: 18px auto 0;
  border-radius: 16px 16px 0 0;
  box-shadow: var(--shadow-sm);
  position: relative;
}
.weekbar span {
  text-align: center; padding: 12px 0; font-weight: 800;
  font-size: 14px; color: #E28DB3; letter-spacing: 1px;
}
.weekbar span:nth-child(1), .weekbar span:nth-child(7) { color: var(--pink-deep); }

.grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px;
  padding: 10px; max-width: 1160px; margin: 0 auto 8px;
  background: var(--pink-soft);
  border-radius: 0 0 16px 16px;
  box-shadow: var(--shadow-sm);
}
.cell {
  background: var(--card);
  border-radius: 16px;
  min-height: 108px;
  padding: 9px 10px 10px;
  position: relative;
  cursor: pointer;
  border: 1.5px solid var(--line);
  display: flex; flex-direction: column; gap: 5px;
  box-shadow: var(--shadow-sm);
  transition: transform .14s ease, box-shadow .18s ease, border-color .18s ease;
}
.cell:hover {
  transform: translateY(-3px) scale(1.012);
  box-shadow: var(--shadow-md);
  border-color: #FFC2DC;
}
.cell.empty { background: transparent; border: none; cursor: default; box-shadow: none; transform: none; }
.cell.weekend { background: var(--pink-soft); }
.cell.today { border: 2.5px solid var(--pink-deep); background: #FFF2F8; }
.cell.holiday { background: #FFE6EE; }
.cell.workday { background: var(--yellow-soft); }

.top { display: flex; justify-content: space-between; align-items: baseline; gap: 4px; }
.greg { font-size: 19px; font-weight: 800; color: var(--ink); line-height: 1.1; }
.label {
  font-size: 10px; color: var(--ink-soft); max-width: 62%; text-align: right;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500;
}
.badge {
  position: absolute; top: 9px; right: 9px;
  font-size: 10px; min-width: 18px; height: 18px; padding: 0 6px;
  line-height: 18px; text-align: center; border-radius: 999px; color: #fff;
  font-weight: 800; box-shadow: 0 2px 5px rgba(0, 0, 0, .12);
}
.b-holiday { background: #FF6B8A; }
.b-work { background: #F4B63C; }

.pills { display: flex; flex-direction: column; gap: 4px; margin-top: auto; }
.pill {
  font-size: 10px; padding: 2px 6px; border-radius: 9px; text-align: center;
  background: transparent; color: var(--ink-soft);
  border: 1px solid transparent; font-weight: 600;
  opacity: .5;
}
.pill.rest {
  font-size: 13px; font-weight: 800; color: #fff;
  padding: 4px 8px; border-radius: 11px; opacity: 1;
  box-shadow: 0 2px 6px rgba(242, 109, 155, .30);
  display: flex; align-items: center; justify-content: center; gap: 3px;
}
.pill.rest::before { content: "\1F319"; font-size: 12px; }
.pill.me { border-color: var(--pink-deep); box-shadow: 0 0 0 2px var(--pink-deep); }

.summary {
  max-width: 1160px; margin: 8px auto 32px; padding: 0 10px;
  display: flex; gap: 12px; flex-wrap: wrap;
}
.sumtag {
  background: var(--card); border-left: 4px solid #ccc; padding: 9px 16px;
  border-radius: 12px; font-size: 13.5px; box-shadow: var(--shadow-sm);
  font-weight: 600; color: var(--ink);
}
.sumtag b { font-size: 15px; }

.modal {
  position: fixed; inset: 0; background: rgba(110, 74, 90, .38);
  display: flex; align-items: center; justify-content: center; z-index: 50;
  backdrop-filter: blur(2px);
}
.modal.hidden { display: none; }
.modal-box {
  background: var(--card); border-radius: 22px; padding: 24px;
  width: 90%; max-width: 440px; box-shadow: var(--shadow-md);
  border: 1.5px solid var(--line);
}
.modal-box h3 { margin: 0 0 6px; font-size: 19px; font-weight: 800; color: var(--ink); }
.hint { color: var(--ink-soft); font-size: 12.5px; margin: 0 0 14px; }
#nameInputs { display: flex; flex-direction: column; gap: 9px; margin-bottom: 16px; }
.nameInput {
  padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px;
  font-size: 14px; color: var(--ink); background: #FFFDFE;
}
.nameInput:focus { outline: none; border-color: var(--pink); box-shadow: 0 0 0 3px var(--pink-soft); }
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.modal-actions button {
  padding: 9px 16px; border: none; border-radius: 12px; cursor: pointer;
  font-size: 14px; font-weight: 800; transition: transform .12s ease, filter .15s ease;
}
.modal-actions button:active { transform: translateY(1px); }
#saveNames { background: var(--pink-deep); color: #fff; }
#saveNames:hover { filter: brightness(1.05); }
#cancelNames { background: var(--pink-soft); color: var(--ink); }
#addName { background: #FFF0F7; color: var(--pink-deep); }

@media (max-width: 640px) {
  .cell { min-height: 86px; padding: 7px 7px 8px; }
  .greg { font-size: 16px; }
  .label { font-size: 9px; }
  .pill { font-size: 9px; }
  .pill.rest { font-size: 11px; padding: 3px 6px; }
  .pill.rest::before { font-size: 10px; }
  .grid { gap: 6px; padding: 6px; }
  .weekbar span { padding: 9px 0; }
  .nav button, .ops button { padding: 7px 12px; font-size: 12.5px; }
  .tip { font-size: 10px; }
}
