:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --text: #1c2233;
  --muted: #6b7489;
  --border: #dde2ee;
  --accent: #3b82f6;
  --accent-soft: #e3edff;
  --friday: #fff7e0;
  --danger: #dc2626;
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11141c;
    --surface: #1a1f2b;
    --text: #e6e9f2;
    --muted: #8f98ad;
    --border: #2b3242;
    --accent: #60a5fa;
    --accent-soft: #1e2b45;
    --friday: #2a2615;
    --danger: #f87171;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 14px;
}
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { color: var(--danger); }
button:disabled { opacity: .5; cursor: default; }

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
header h1 { font-size: 1.15rem; margin: 0; }
.me { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .9rem; }
.me a { color: var(--muted); }

main { max-width: 1000px; margin: 0 auto; padding: 16px; }

.month-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.month-nav h2 { margin: 0; font-size: 1.2rem; text-transform: capitalize; }

.calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}
.weekday { text-align: center; font-size: .8rem; color: var(--muted); padding: 4px 0; }

.day {
  min-height: 92px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.day.other-month { opacity: .4; }
.day.friday { background: var(--friday); }
.day.today { outline: 2px solid var(--accent); outline-offset: -2px; }
.day .num { font-size: .85rem; font-weight: 600; }
.day .people { display: flex; flex-direction: column; gap: 2px; }

.chip {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: .75rem;
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 2px 6px 2px 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.avatar { width: 18px; height: 18px; border-radius: 50%; flex: none; }
.avatar.lg { width: 28px; height: 28px; }

.upcoming { margin-top: 24px; }
.upcoming h3 { font-size: 1rem; }
.upcoming ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.upcoming li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.upcoming .date { font-weight: 600; min-width: 140px; text-transform: capitalize; }

dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  width: min(460px, calc(100vw - 32px));
  padding: 0;
}
dialog::backdrop { background: rgb(0 0 0 / .45); }
.dialog-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.dialog-body h3 { margin: 0; text-transform: capitalize; }
.notice { font-size: .85rem; background: var(--friday); padding: 8px 10px; border-radius: 8px; }
.search {
  font: inherit;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}
.member-list { max-height: 50vh; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.member-list label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
}
.member-list label:hover { background: var(--accent-soft); }
.member-list input { width: 18px; height: 18px; }
.dialog-actions { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.dialog-actions .right { display: flex; gap: 8px; }
.count { color: var(--muted); font-size: .85rem; }

.centered {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
  text-align: center;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 24px;
  max-width: 380px;
}
.card .big { font-size: 3rem; }
.card a.primary {
  display: inline-block;
  margin-top: 12px;
  background: #5865f2;
  color: #fff;
  text-decoration: none;
  padding: 10px 18px;
  border-radius: 8px;
}

@media (max-width: 640px) {
  .day { min-height: 64px; padding: 4px; }
  .chip span { display: none; }
  .chip { padding: 2px; background: none; }
  .day .people { flex-direction: row; flex-wrap: wrap; }
}
