:root {
  --bg: #f6f3ee;
  --ink: #1c1917;
  --muted: #78716c;
  --card: #fffdf9;
  --line: #e7e0d6;
  --accent: #0f766e;
  --accent-soft: #ccfbf1;
  --warn: #b45309;
  --done: #a8a29e;
  --today: #0f766e;
  --font: "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(ellipse at top left, #d8f3ef 0%, transparent 45%),
    linear-gradient(180deg, #f6f3ee 0%, #efe8dc 100%);
  min-height: 100vh;
  line-height: 1.55;
}
.wrap { max-width: 960px; margin: 0 auto; padding: 0 1.25rem; }
.site-header {
  padding: 1.75rem 0 1rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 249, 0.7);
  backdrop-filter: blur(8px);
}
.brand {
  margin: 0;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}
.site-header h1 {
  margin: 0.35rem 0 0.75rem;
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 700;
}
.title-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin: 0.35rem 0 0.75rem;
}
.title-row h1 { margin: 0; }
.title-logo {
  width: 4.5rem;
  height: 4.5rem;
  flex-shrink: 0;
  object-fit: contain;
  display: block;
}
.nav { font-size: 0.9rem; display: flex; flex-wrap: wrap; gap: 0.35rem 0.75rem; }
.nav a { color: var(--ink); text-decoration: none; border-bottom: 1px solid transparent; }
.nav a:hover, .nav a.active { color: var(--accent); border-bottom-color: var(--accent); }
main.wrap { padding-top: 1.5rem; padding-bottom: 3rem; }
.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
}
.stat .num { display: block; font-size: 1.35rem; font-weight: 700; color: var(--accent); }
.stat .lbl { font-size: 0.8rem; color: var(--muted); }
.lede { color: var(--muted); }
.btn {
  display: inline-block;
  margin: 0.25rem 0.5rem 1rem 0;
  padding: 0.55rem 0.9rem;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
}
.btn.secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
section { margin: 2rem 0; }
h2 { font-size: 1.15rem; margin: 0 0 0.75rem; }
.ms-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  font-size: 0.92rem;
}
.ms-table th, .ms-table td {
  text-align: left;
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.ms-table th { background: #f0ebe3; font-size: 0.8rem; color: var(--muted); }
.ms-table tr.done td { color: var(--done); }
.ms-table tr.today td { background: var(--accent-soft); }
.ms-table .body { color: var(--muted); font-size: 0.85rem; }
.tag {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: #ffedd5;
  color: var(--warn);
  font-size: 0.75rem;
}
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-right: 0.35rem;
}
.badge.open { background: #dcfce7; color: #166534; }
.badge.closed { background: #e7e5e4; color: #44403c; }
.issue-list { list-style: none; padding: 0; margin: 0.5rem 0 0; }
.issue-list li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  padding: 0.65rem 0.75rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 0.4rem;
}
.issue-list a { color: var(--ink); font-weight: 600; text-decoration: none; }
.issue-list a:hover { color: var(--accent); }
.issue-list .meta { color: var(--muted); font-size: 0.85rem; }
.issue.closed a { color: var(--done); font-weight: 500; }
.muted { color: var(--muted); font-size: 0.9rem; }
.site-footer {
  padding: 1.5rem 1.25rem 2.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--line);
}
code { font-size: 0.88em; background: #efe8dc; padding: 0.1em 0.35em; border-radius: 4px; }

/* Calendar */
.calendar-section { margin: 2rem 0; }
.cal-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.65rem;
  margin-bottom: 0.75rem;
}
.cal-month-label {
  margin: 0;
  min-width: 7.5rem;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 700;
}
.cal-nav-btn,
.cal-today-btn {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 8px;
  padding: 0.35rem 0.7rem;
}
.cal-nav-btn { min-width: 2.25rem; font-size: 1.15rem; line-height: 1; }
.cal-nav-btn:hover,
.cal-today-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.cal-today-btn { margin-left: auto; font-size: 0.85rem; font-weight: 600; }
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 2px;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  font-weight: 600;
}
.cal-weekdays span:first-child { color: #b91c1c; }
.cal-weekdays span:last-child { color: #1d4ed8; }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-rows: 6.75rem;
  gap: 2px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.cal-cell {
  background: var(--card);
  height: 100%;
  min-width: 0;
  padding: 0.35rem 0.3rem 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  overflow: hidden;
}
.cal-cell-out {
  background: #f0ebe3;
  height: 100%;
  min-width: 0;
}
.cal-cell.is-today {
  box-shadow: inset 0 0 0 2px var(--accent);
  background: #f0fdfa;
}
.cal-daynum {
  flex: 0 0 auto;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  padding: 0 0.15rem;
  line-height: 1.2;
}
.cal-cell.is-today .cal-daynum { color: var(--accent); }
.cal-events {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}
.cal-event,
.cal-more {
  display: block;
  width: 100%;
  max-width: 100%;
  flex: 0 0 auto;
  border: none;
  border-radius: 4px;
  padding: 0.12rem 0.3rem;
  font: inherit;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-event:hover { filter: brightness(0.92); }
.cal-more {
  background: transparent;
  color: var(--accent);
  padding-left: 0.2rem;
}
.cal-more:hover { text-decoration: underline; }
.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
  margin-top: 0.85rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.cal-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.cal-swatch {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 3px;
  flex-shrink: 0;
}

/* Modal */
body.cal-modal-open { overflow: hidden; }
.cal-modal[hidden] { display: none; }
.cal-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.cal-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 25, 23, 0.45);
}
.cal-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  max-height: min(80vh, 560px);
  overflow: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.25rem 1.35rem 1.4rem;
  box-shadow: 0 12px 40px rgba(28, 25, 23, 0.18);
}
.cal-modal-close {
  position: absolute;
  top: 0.55rem;
  right: 0.65rem;
  border: none;
  background: transparent;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0.2rem 0.4rem;
}
.cal-modal-close:hover { color: var(--ink); }
.cal-modal-date {
  margin: 0 0 0.25rem;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}
.cal-modal-body h3 {
  margin: 0 0 0.65rem;
  font-size: 1.1rem;
  padding-right: 1.5rem;
}
.cal-modal-body-text {
  margin: 0 0 0.75rem;
  color: var(--ink);
  font-size: 0.92rem;
}
.cal-modal-meta {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.cal-modal-teams {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.cal-team-chip {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}
.cal-day-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.cal-day-list-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 8px;
  background: #fff;
  padding: 0.55rem 0.7rem;
  color: var(--ink);
}
.cal-day-list-item:hover { border-color: var(--accent); }
.cal-day-list-swatch {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 3px;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .ms-table th:nth-child(3), .ms-table td:nth-child(3) { display: none; }
  .cal-grid { grid-auto-rows: 5.5rem; }
  .cal-cell { padding: 0.25rem 0.15rem; }
  .cal-event { font-size: 0.6rem; padding: 0.08rem 0.2rem; }
  .cal-today-btn { margin-left: 0; }
  .cal-toolbar { justify-content: center; }
}
