:root {
  --bg: #f6f8fc;
  --panel: #ffffff;
  --text: #1f1f1f;
  --muted: #6f7585;
  --line: #e3e8f4;
  --primary: #1a73e8;
  --holiday: #d93025;
  --today: #e8f0fe;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", "Microsoft JhengHei", sans-serif;
  color: var(--text);
  background: var(--bg);
}
.app {
  max-width: 1280px;
  margin: 20px auto;
  padding: 0 16px 24px;
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}
.panel {
  background: var(--panel);
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
  border: 1px solid var(--line);
}
.calendar-panel { padding: 12px; }
.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 8px;
  margin-bottom: 10px;
}
.toolbar-left, .toolbar-right { display: flex; gap: 8px; align-items: center; }
button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
}
button:hover { border-color: #c2cbe0; }
.primary-btn {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.month-title { font-size: 20px; font-weight: 700; min-width: 180px; text-align: center; }
.weekday, .grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.weekday div {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  padding: 6px 0;
  font-weight: 600;
}
.day {
  min-height: 115px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px;
  background: #fff;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.day.other-month { opacity: 0.5; }
.day.selected { outline: 2px solid var(--primary); }
.day.today { background: var(--today); }
.day-top {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  align-items: center;
}
.holiday-label {
  color: var(--holiday);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lunar-text, .solar-term {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.solar-term { color: #0b8043; font-weight: 600; }
.event-pill {
  color: #fff;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.side-panel { padding: 14px; display: flex; flex-direction: column; gap: 14px; }
h3 { margin: 0 0 8px; }
.muted { color: var(--muted); font-size: 13px; }
.section { border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.event-list { display: flex; flex-direction: column; gap: 8px; max-height: 290px; overflow: auto; }
.event-item {
  border-left: 6px solid #888;
  background: #f8fafd;
  border-radius: 8px;
  padding: 8px;
  font-size: 13px;
}
.event-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.text-btn {
  border: none;
  background: transparent;
  color: #b3261e;
  padding: 0;
  font-size: 12px;
}
.text-btn:hover {
  text-decoration: underline;
}
.event-meta { color: var(--muted); font-size: 12px; margin-top: 4px; }
form { display: grid; gap: 8px; }
input, select, textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  font-size: 14px;
  font-family: inherit;
}
textarea { resize: vertical; min-height: 52px; }
.row { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; }
.category-filter { width: 100%; }

@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; margin: 10px auto; }
  .day { min-height: 100px; }
}

@media (max-width: 760px) {
  .app { padding: 0 10px 16px; gap: 10px; }
  .calendar-panel, .side-panel { padding: 10px; }
  .toolbar {
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
  }
  .month-title {
    order: -1;
    width: 100%;
    font-size: 18px;
  }
  .toolbar-left, .toolbar-right {
    width: 100%;
    justify-content: center;
  }
  .day {
    min-height: 86px;
    padding: 5px;
  }
  .day-top { font-size: 12px; }
  .holiday-label, .lunar-text, .solar-term, .event-pill {
    font-size: 10px;
  }
  .event-list { max-height: 220px; }
}

@media (max-width: 520px) {
  button { padding: 7px 10px; font-size: 13px; }
  .weekday div { font-size: 12px; padding: 4px 0; }
  .grid { gap: 4px; }
  .day {
    min-height: 76px;
    border-radius: 8px;
  }
  .row { grid-template-columns: 1fr; }
}
