:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-muted: #eef1f6;
  --text: #17202f;
  --muted: #687386;
  --line: #d9dee8;
  --orange: #e97825;
  --blue: #2867c7;
  --pink: #d94d83;
  --focus: #1d4ed8;
  --shadow: 0 8px 20px rgba(31, 42, 68, 0.06);
}

* {
  box-sizing: border-box;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

button,
a {
  touch-action: manipulation;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.site-header,
main,
.site-footer {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 8px;
  padding: 18px 0 12px;
}

.eyebrow,
.notice,
.section-heading p,
.control-label,
.site-footer {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 3px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  color: #707b8c;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.15;
  white-space: nowrap;
}

h2 {
  margin-bottom: 0;
  font-size: 17px;
}

h3 {
  margin-bottom: 14px;
  font-size: 16px;
}

.notice {
  max-width: 360px;
  margin-bottom: 2px;
  text-align: right;
  color: #5b6678;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.overview,
.toolbar,
.member-panel,
.view {
  margin-bottom: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
}

.overview > div {
  display: grid;
  gap: 1px;
  padding: 5px 9px;
  background: var(--surface);
}

.metric-value {
  font-size: 12px;
  font-weight: 760;
  line-height: 1.2;
}

.metric-label {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 10px 12px;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.control-label {
  font-size: 14px;
  font-weight: 700;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.segmented button,
#clearMembers,
.member-chip {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.segmented button {
  padding: 0 9px;
  font-size: 15px;
}

.team-tabs button {
  min-height: 32px;
  padding: 0 10px;
}

.segmented button.is-active,
.member-chip.is-selected {
  border-color: #9eacb4;
  background: #e7edf1;
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(158, 172, 180, 0.26);
  font-weight: 800;
}

.team-tabs [data-team="orange"].is-active {
  border-color: var(--orange);
  background: var(--orange);
}

.team-tabs [data-team="blue"].is-active {
  border-color: var(--blue);
  background: var(--blue);
}

.team-tabs [data-team="pink"].is-active {
  border-color: var(--pink);
  background: var(--pink);
}

.member-panel,
.view {
  padding: 12px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 6px;
}

.section-heading > div {
  min-width: 0;
}

.section-heading p {
  margin-bottom: 0;
}

#clearMembers {
  min-height: 24px;
  padding: 0 8px;
  font-size: 13px;
  font-weight: 700;
}

.selected-members {
  min-height: 0;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.member-selection-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.member-selection-meta #clearMembers {
  flex: 0 0 auto;
}

.member-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: 5px;
  max-height: 148px;
  overflow: auto;
  padding-right: 2px;
}

.member-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 7px;
  font-size: 14px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-chip.is-selected {
  border-color: #b7bec7;
}

.member-chip:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.event-list {
  display: grid;
  gap: 8px;
}

.event-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 28px;
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.event-card.orange {
  border-left-color: var(--orange);
}

.event-card.blue {
  border-left-color: var(--blue);
}

.event-card.pink {
  border-left-color: var(--pink);
}

.event-time {
  margin-bottom: 2px;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  line-height: 1.2;
}

.event-date {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.event-title {
  margin-bottom: 6px;
  font-size: 15px;
  font-weight: 800;
}

.event-body {
  min-width: 0;
}

.event-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-bottom: 5px;
}

.member-statuses {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.member-statuses {
  margin-bottom: 6px;
}

.member-statuses:empty {
  margin-bottom: 0;
}

.status-pill,
.team-badge {
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 13px;
  font-weight: 700;
}

.status-pill {
  background: var(--surface-muted);
}

.status-pill.present {
  background: #e7f5ed;
  color: #17633a;
  font-size: 13px;
}

.member-text {
  color: #465366;
  font-size: 13px;
  line-height: 1.55;
}

.team-badge {
  display: inline-flex;
  width: fit-content;
  color: #fff;
}

.team-badge.orange {
  background: var(--orange);
}

.team-badge.blue {
  background: var(--blue);
}

.team-badge.pink {
  background: var(--pink);
}

.official-link {
  width: 28px;
  height: 28px;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.official-link svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.official-link:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.calendar-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
  gap: 16px;
  align-items: start;
}

.calendar-main {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: linear-gradient(180deg, #fcfdff 0%, #ffffff 100%);
}

.calendar-summary-inline {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.1;
  text-align: right;
}

.section-summary-inline {
  margin: 0 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.1;
  text-align: right;
  white-space: nowrap;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.calendar-label,
.calendar-day {
  min-height: 44px;
}

.calendar-label {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.calendar-label.is-sunday,
.calendar-label.is-saturday {
  color: var(--text);
}

.calendar-label.is-sunday {
  color: #b4233a;
}

.calendar-label.is-saturday {
  color: #245fb5;
}

.calendar-day {
  display: grid;
  align-content: space-between;
  gap: 6px;
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.calendar-day.is-sunday,
.calendar-day.is-holiday {
  background: #fff7f8;
  border-color: #f0c8ce;
}

.calendar-day.is-saturday {
  background: #f5f9ff;
  border-color: #c8d8f2;
}

.calendar-day.is-muted {
  opacity: 0.35;
  cursor: default;
}

.calendar-day.is-selected {
  border-color: #9eacb4;
  background: #f8fbfc;
  box-shadow: 0 0 0 2px rgba(158, 172, 180, 0.24);
}

.day-number {
  font-size: 16px;
  font-weight: 800;
}

.day-topline {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 6px;
}

.day-topline-main {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.calendar-day.is-sunday .day-number,
.calendar-day.is-holiday .day-number {
  color: #b4233a;
}

.calendar-day.is-saturday .day-number {
  color: #245fb5;
}

.holiday-name {
  max-width: 64px;
  color: #b4233a;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  text-align: right;
}

.day-special-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 6px;
  border-radius: 999px;
  background: #fff0d7;
  color: #8b5b1f;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.selected-date-note {
  display: none;
  margin: -6px 0 10px;
  color: #7a6a4e;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.selected-date-note:not(:empty) {
  display: block;
}

.day-count {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.15;
}

.calendar-time {
  white-space: nowrap;
}

.day-shows {
  display: grid;
  gap: 3px;
}

.day-show {
  display: inline-flex;
  align-items: center;
  gap: 0;
  min-width: 0;
  color: var(--text);
}

.day-show.is-hidden {
  visibility: hidden;
}

.day-show-more {
  color: var(--muted);
  font-size: 11px;
}

.day-show-track {
  position: relative;
  display: inline-flex;
  width: 16px;
  height: 18px;
  align-items: center;
  justify-content: center;
}

.day-show.slot-1 .team-dot,
.day-show.slot-2 .team-dot {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.day-show.slot-1 .team-dot {
  top: 2px;
}

.day-show.slot-2 .team-dot {
  bottom: 2px;
}

.team-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: var(--line);
}

.team-dot.orange {
  background: var(--orange);
}

.team-dot.blue {
  background: var(--blue);
}

.team-dot.pink {
  background: var(--pink);
}

.day-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: linear-gradient(180deg, #fbfcfe 0%, #ffffff 100%);
}

.compact .event-card {
  grid-template-columns: 60px minmax(0, 1fr) 26px;
  gap: 8px;
  padding: 9px 10px;
}

.empty-message {
  margin: 0;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 10px 0 26px;
  color: #8a93a2;
  font-size: 12px;
  line-height: 1.4;
}

.site-footer strong {
  font-weight: 700;
}

.site-credit {
  margin-left: auto;
  color: #98a1ad;
  font-size: 11px;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .site-header,
  .calendar-shell {
    display: grid;
  }

  .site-credit {
    margin-left: 0;
    font-size: 10px;
  }

  .site-header {
    align-items: start;
  }

  .notice {
    text-align: left;
  }

  .eyebrow {
    font-size: 14px;
  }

  .notice {
    font-size: 13px;
  }

  h1 {
    font-size: 21px;
  }

  .event-card {
    grid-template-columns: 58px minmax(0, 1fr) 24px;
    gap: 6px;
    padding: 8px 9px;
  }

  .overview {
    grid-template-columns: 1fr;
  }

  .overview > div {
    padding: 4px 7px;
  }

  .metric-value {
    font-size: 11px;
  }

  .metric-label {
    font-size: 8px;
  }

  .calendar-shell {
    grid-template-columns: 1fr;
  }

  .calendar-main {
    padding: 8px;
  }

  .calendar-summary-inline {
    margin-bottom: 4px;
    font-size: 9px;
  }

  .section-summary-inline {
    font-size: 10px;
  }

  .calendar-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 3px;
  }

  .calendar-label {
    display: grid;
    min-height: 22px;
    font-size: 10px;
  }

  .calendar-day {
    min-height: 54px;
    grid-template-columns: 1fr;
    align-items: stretch;
    align-content: space-between;
    gap: 1px;
    padding: 3px;
    border-radius: 5px;
  }

  .member-list {
    grid-template-columns: repeat(auto-fit, minmax(78px, 1fr));
    max-height: 148px;
  }

  .day-topline {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 2px;
  }

  .day-topline-main {
    gap: 3px;
  }

  .day-number {
    font-size: 11px;
  }

  .holiday-name {
    max-width: none;
    font-size: 0;
    text-align: right;
  }

  .holiday-name::after {
    content: "祝";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 13px;
    height: 13px;
    border-radius: 999px;
    background: #f6d7dc;
    color: #b4233a;
    font-size: 8px;
    line-height: 1;
  }

  .day-special-badge {
    min-width: 12px;
    height: 12px;
    padding: 0;
    font-size: 0;
    border-radius: 999px;
  }

  .day-special-badge::before {
    content: "特";
    font-size: 8px;
    line-height: 1;
  }

  .selected-date-note {
    margin: -2px 0 8px;
    font-size: 12px;
    line-height: 1.4;
  }

  .day-shows {
    display: grid;
    gap: 1px;
  }

  .day-show {
    display: flex;
    align-items: center;
    gap: 0;
    min-width: 0;
    line-height: 1;
  }

  .team-dot {
    width: 6px;
    height: 6px;
    flex-basis: 6px;
  }

  .day-show-track {
    width: 10px;
    height: 10px;
  }

  .day-show.slot-1 .team-dot {
    top: 1px;
  }

  .day-show.slot-2 .team-dot {
    bottom: 1px;
  }

  .day-count {
    display: flex;
    flex-wrap: wrap;
    gap: 1px 4px;
    margin-top: 1px;
    font-size: 8px;
    line-height: 1.05;
  }
}
