:root {
  --bg: #e7ebf1;
  --side: #f3f5f8;
  --card: #ffffff;
  --ink: #1b1e27;
  --muted: #8d94a0;
  --line: #e8ecf1;
  --soft: #f2f4f7;
  --black: #16181d;
  --hour: 72px;
  --side-w: 248px;
  color-scheme: light;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

button, input { font: inherit; color: inherit; }

button { cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--black);
  outline-offset: 2px;
}

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.gate-card {
  width: min(420px, 100%);
  background: var(--card);
  border-radius: 28px;
  padding: 36px 32px 32px;
  box-shadow: 0 16px 50px rgba(22, 28, 45, 0.08);
}

.mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--black);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: -0.04em;
  flex: none;
}

.gate-card h1 {
  margin: 18px 0 6px;
  font-size: 28px;
  letter-spacing: -0.04em;
}

.lede, .fine { color: var(--muted); margin: 0; }

.field { margin-top: 22px; }

.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
}

.field input {
  width: 100%;
  height: 48px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--soft);
  padding: 0 14px;
}

.btn-dark, .btn-light, .btn-line {
  border: 0;
  border-radius: 999px;
  height: 42px;
  padding: 0 16px;
  font-weight: 600;
}

.btn-dark { background: var(--black); color: #fff; }

.btn-light { background: var(--soft); color: var(--ink); }

.btn-line {
  background: #fff;
  border: 1px solid var(--line);
}

.btn-dark:disabled { opacity: 0.45; cursor: default; }

.gate-card .btn-dark { width: 100%; margin-top: 16px; height: 48px; }

.alert {
  margin: 14px 0 0;
  color: #9a3412;
  font-weight: 600;
}

.app {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  height: calc(100vh - 24px);
  margin: 12px;
  background: var(--side);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(22, 28, 45, 0.06);
}

.side {
  display: flex;
  flex-direction: column;
  padding: 18px 14px 16px;
  min-height: 0;
}

.side-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px 8px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #5d6470;
  display: grid;
  place-items: center;
}

.icon-btn:hover { background: #e7ebf0; }

#side-close { display: none; }

.side-label {
  margin: 18px 12px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #a0a7b2;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  border-radius: 999px;
  min-height: 42px;
  padding: 0 12px;
  color: #3c4250;
  font-weight: 600;
  text-align: left;
}

.nav-item.is-active {
  background: #fff;
  box-shadow: 0 4px 14px rgba(22, 28, 45, 0.06);
}

.nav-item svg { flex: none; }

.week-note {
  margin: 22px 8px 0;
  background: #fff;
  border-radius: 18px;
  padding: 14px 14px 12px;
  box-shadow: 0 4px 14px rgba(22, 28, 45, 0.04);
}

.week-note p { margin: 0; color: var(--muted); font-size: 12px; font-weight: 600; }

.week-note strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
  letter-spacing: -0.03em;
}

.side-foot { margin-top: auto; }

.who {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #d9dee7;
  color: #3c4250;
  display: grid;
  place-items: center;
  position: relative;
  flex: none;
}

.avatar i {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22a06b;
  border: 2px solid var(--side);
}

.who strong { display: block; font-size: 14px; }

.who span { color: var(--muted); font-size: 12px; }

.sign-out {
  width: 100%;
  margin-top: 4px;
}

.main {
  background: var(--card);
  margin: 10px 10px 10px 0;
  border-radius: 22px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.top {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 18px 0;
}

.crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-weight: 600;
}

.crumb b { color: var(--ink); font-weight: 600; }

.top .icon-btn:last-child { margin-left: auto; }

#menu-open { display: none; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 16px 18px 12px;
}

.toolbar h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: -0.045em;
  font-weight: 700;
}

.filters { display: flex; flex-wrap: wrap; gap: 8px; }

.pill {
  border: 0;
  background: var(--soft);
  color: #4b5160;
  border-radius: 999px;
  height: 34px;
  padding: 0 14px;
  font-weight: 600;
}

.pill.is-on { background: var(--black); color: #fff; }

.toolbar-end {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.board {
  overflow: auto;
  flex: 1;
  min-height: 0;
  padding: 0 8px 16px;
}

.cal { min-width: 920px; }

.cal-head {
  display: grid;
  grid-template-columns: 72px repeat(7, minmax(110px, 1fr));
}

.cal-body {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  padding-top: 12px;
}

.cal-head {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #fff;
  padding-bottom: 8px;
}

.day-head {
  display: grid;
  place-items: center;
  min-height: 42px;
}

.day-head span {
  color: #6d7480;
  font-size: 13px;
  font-weight: 600;
}

.day-head.is-today span {
  background: var(--black);
  color: #fff;
  border-radius: 999px;
  padding: 6px 12px;
}

.times { position: relative; }

.tick {
  height: var(--hour);
  position: relative;
}

.tick span {
  position: absolute;
  top: -7px;
  right: 10px;
  font-size: 11px;
  font-weight: 600;
  color: #6d7480;
}

.cols {
  display: grid;
  grid-template-columns: repeat(7, minmax(110px, 1fr));
  position: relative;
}

.col { position: relative; border-left: 1px solid var(--line); }

.line { height: var(--hour); border-top: 1px solid var(--line); }

.party {
  position: absolute;
  left: 6px;
  right: 6px;
  border: 0;
  border-radius: 14px;
  padding: 8px 10px 8px;
  text-align: left;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  overflow: hidden;
  z-index: 1;
}

.party:hover { box-shadow: 0 8px 18px rgba(22, 28, 45, 0.08); }

.party-top {
  display: flex;
  width: 100%;
  align-items: flex-start;
  gap: 6px;
}

.party-name {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.party-more { margin-left: auto; color: currentColor; opacity: 0.55; }

.party-time, .party-meta { font-size: 11px; font-weight: 600; opacity: 0.78; }

.badge {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  color: #178056;
}

.badge.hold { color: #9a3412; }

.now {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 2px solid var(--black);
  z-index: 4;
  pointer-events: none;
}

.now span {
  position: absolute;
  left: 8px;
  top: 0;
  transform: translateY(-50%);
  background: var(--black);
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
}

.empty-note {
  margin: 0 18px 8px;
  color: var(--muted);
  font-weight: 600;
}

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(22, 28, 45, 0.28);
  border: 0;
  z-index: 20;
}

dialog {
  width: min(440px, calc(100vw - 32px));
  border: 0;
  border-radius: 24px;
  padding: 22px 22px 18px;
  box-shadow: 0 24px 60px rgba(22, 28, 45, 0.18);
}

dialog::backdrop { background: rgba(22, 28, 45, 0.35); }

.detail-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.detail-top h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.04em;
}

.detail-top .icon-btn { margin-left: auto; }

.when { margin: 6px 0 14px; color: var(--muted); font-weight: 600; }

dl {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px 12px;
  margin: 0;
}

dt { color: var(--muted); font-weight: 600; }

dd { margin: 0; font-weight: 600; }

dd a { color: inherit; }

.notes {
  margin: 14px 0 0;
  background: var(--soft);
  border-radius: 14px;
  padding: 12px;
}

.detail-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.caution { margin: 12px 0 0; color: #9a3412; font-weight: 600; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  background: var(--black);
  color: #fff;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 600;
  z-index: 40;
  box-shadow: 0 10px 24px rgba(22, 28, 45, 0.2);
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
    height: auto;
    min-height: calc(100vh - 16px);
    margin: 8px;
  }

  .side {
    position: fixed;
    z-index: 30;
    top: 8px;
    bottom: 8px;
    left: 8px;
    width: min(280px, calc(100vw - 24px));
    background: var(--side);
    border-radius: 24px;
    box-shadow: 0 16px 40px rgba(22, 28, 45, 0.16);
    transform: translateX(calc(-100% - 16px));
  }

  .side.is-open { transform: none; }

  #menu-open, #side-close { display: grid; }

  .main { margin: 0; min-height: calc(100vh - 16px); }

  .toolbar h1 { font-size: 22px; }

  .toolbar-end { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
