:root {
  color-scheme: light;
  --bg: #f9fafb;
  --glass: rgba(255, 255, 255, 0.7);
  --glass-strong: rgba(255, 255, 255, 0.86);
  --ink: #111827;
  --muted: #6b7280;
  --line: rgba(17, 24, 39, 0.1);
  --line-strong: rgba(17, 24, 39, 0.18);
  --best: #10b981;
  --best-fill: rgba(16, 185, 129, 0.15);
  --works: #3b82f6;
  --works-fill: rgba(59, 130, 246, 0.15);
  --maybe: #f59e0b;
  --maybe-fill: rgba(245, 158, 11, 0.16);
  --no: #ef4444;
  --no-fill: rgba(239, 68, 68, 0.08);
  --shadow: 0 26px 80px rgba(17, 24, 39, 0.12);
  --shadow-soft: 0 16px 48px rgba(17, 24, 39, 0.1);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(249, 250, 251, 0.95)),
    var(--bg);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1480px, calc(100vw - 28px));
  min-height: calc(100vh - 28px);
  margin: 14px auto;
}

.workspace {
  min-height: calc(100vh - 28px);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
}

.topbar,
.event-strip,
.canvas {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--glass-strong);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(22px);
}

.topbar {
  min-height: 58px;
  display: grid;
  grid-template-columns: auto auto auto auto;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  gap: 12px;
}

.brand {
  color: var(--ink);
  text-decoration: none;
  font-weight: 780;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  letter-spacing: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: white;
}

.mode-switch,
.view-actions,
.band-picker,
.rsvp-buttons,
.social-tabs {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
  gap: 3px;
}

.mode-button,
.drawer-trigger,
.band-button,
.rsvp,
.send-button,
.icon-button,
.social-tab,
.quiet-button,
.more-button,
.close-button {
  border: 0;
  border-radius: 6px;
  min-height: 34px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
}

.mode-button.active,
.drawer-trigger.active,
.social-tab.active {
  background: var(--ink);
  color: white;
}

.access-pill,
.event-meta,
.response-label {
  color: var(--muted);
  font-size: 0.85rem;
}

.access-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  white-space: nowrap;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--best);
}

.event-strip {
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.event-strip h1,
.tray-title-row h2,
.event-card h2 {
  margin: 0;
  letter-spacing: 0;
}

.event-strip h1 {
  font-size: clamp(1.5rem, 2vw, 2.15rem);
  line-height: 1.02;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
}

.event-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.event-meta span,
.save-state {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid var(--line);
  white-space: nowrap;
}

.save-state {
  color: var(--best);
  border-color: rgba(16, 185, 129, 0.26);
  transition: box-shadow 220ms ease, background 220ms ease;
}

.save-state.glow {
  background: rgba(16, 185, 129, 0.12);
  box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.1);
}

.canvas {
  position: relative;
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
}

.calendar-stage {
  min-height: 100%;
  padding: 16px;
  transform-origin: left center;
  transition:
    transform 520ms cubic-bezier(0.16, 1, 0.3, 1),
    filter 520ms cubic-bezier(0.16, 1, 0.3, 1),
    opacity 520ms cubic-bezier(0.16, 1, 0.3, 1);
}

.drawer-open .calendar-stage {
  opacity: 0.78;
  filter: blur(1.2px) saturate(0.92);
  transform: scale(0.98);
}

.social-open .calendar-stage {
  transform-origin: top left;
}

.calendar-panel {
  min-width: 0;
  min-height: 100%;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px;
}

.calendar-toolbar,
.tray-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.month-label {
  font-weight: 820;
  font-size: 1.18rem;
}

.icon-button {
  width: 38px;
  padding: 0;
  font-size: 1.25rem;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--line);
  color: var(--ink);
}

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

.weekday-row {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  text-align: center;
}

.calendar-grid {
  gap: 8px;
  align-content: start;
}

.day-cell {
  position: relative;
  min-height: clamp(72px, 10.8vh, 120px);
  padding: 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.54);
  color: var(--ink);
  text-align: left;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    0 8px 24px rgba(17, 24, 39, 0.045);
  transition:
    transform 180ms cubic-bezier(0.16, 1, 0.3, 1),
    border-color 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

.day-cell:hover,
.day-cell.active {
  transform: translateY(-2px) scale(1.012);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 14px 34px rgba(17, 24, 39, 0.12);
}

.day-cell.active {
  border-color: rgba(17, 24, 39, 0.42);
}

.day-cell.muted {
  min-height: 24px;
  padding: 4px 8px;
  opacity: 0.46;
  background: transparent;
  box-shadow: none;
}

.day-cell.empty {
  border-color: rgba(17, 24, 39, 0.16);
  border-style: dashed;
  background: rgba(255, 255, 255, 0.28);
  box-shadow: none;
}

.day-cell.empty:hover,
.day-cell.empty.active {
  border-style: solid;
  border-color: rgba(17, 24, 39, 0.34);
  background: rgba(255, 255, 255, 0.52);
}

.day-cell.best {
  background: var(--best-fill);
  border-color: rgba(16, 185, 129, 0.42);
}

.day-cell.works {
  background: var(--works-fill);
  border-color: rgba(59, 130, 246, 0.4);
}

.day-cell.maybe {
  background: var(--maybe-fill);
  border-color: rgba(245, 158, 11, 0.42);
  color: #5f3b04;
}

.day-cell.maybe .consensus-badge {
  color: #5f3b04;
  border-color: rgba(95, 59, 4, 0.16);
}

.day-cell.no {
  background: rgba(255, 255, 255, 0.58);
  border-color: rgba(17, 24, 39, 0.1);
}

.day-number {
  font-weight: 780;
}

.range-label {
  display: block;
  margin-top: 8px;
  font-size: 0.8rem;
  font-weight: 760;
}

.consensus-badge,
.blocker-badge,
.my-marker {
  position: absolute;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 820;
}

.consensus-badge {
  right: 8px;
  top: 8px;
  min-width: 28px;
  height: 24px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
  border: 1px solid rgba(17, 24, 39, 0.12);
}

.blocker-badge {
  right: -5px;
  top: -6px;
  min-width: 34px;
  height: 26px;
  padding: 0 8px;
  color: white;
  background: var(--no);
  box-shadow: 0 0 0 3px white, 0 10px 22px rgba(239, 68, 68, 0.22);
}

.my-marker {
  left: 8px;
  bottom: 8px;
  height: 22px;
  padding: 0 8px;
  background: rgba(17, 24, 39, 0.88);
  color: white;
}

.glass-drawer {
  position: absolute;
  z-index: 5;
  background: var(--glass);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(26px) saturate(1.12);
}

.glass-drawer::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.92), inset -1px -1px 0 rgba(17, 24, 39, 0.05);
}

.options-tray {
  top: 14px;
  right: 14px;
  bottom: 14px;
  width: min(376px, calc(100% - 28px));
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transform: translateX(calc(100% + 32px));
  opacity: 0;
  transition:
    transform 520ms cubic-bezier(0.16, 1, 0.3, 1),
    opacity 280ms ease;
}

.options-open .options-tray {
  transform: translateX(0);
  opacity: 1;
}

.close-button {
  width: 34px;
  padding: 0;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--line);
  color: var(--ink);
}

.response-card,
.winner-card,
.event-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
  padding: 13px;
}

.response-card strong,
.winner-card strong {
  display: block;
  margin-top: 5px;
  font-size: 1.1rem;
}

.winner-card p,
.event-card p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.35;
}

.band-picker {
  width: 100%;
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.band-button {
  min-width: 0;
  padding: 0 7px;
  font-size: 0.82rem;
  font-weight: 820;
}

.band-button.active.best,
.date-chip.best,
.rsvp.yes.active {
  background: var(--best);
  color: white;
}

.band-button.active.works,
.date-chip.works {
  background: var(--works);
  color: white;
}

.band-button.active.maybe,
.date-chip.maybe,
.rsvp.maybe.active {
  background: var(--maybe);
  color: white;
}

.band-button.active.no,
.date-chip.no,
.rsvp.no.active {
  background: var(--no);
  color: white;
}

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

.option-row {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
  padding: 8px;
  text-align: left;
}

.option-row.active {
  border-color: rgba(17, 24, 39, 0.32);
  box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.06);
}

.date-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  font-weight: 820;
  font-size: 0.82rem;
}

.option-score {
  color: var(--muted);
  font-size: 0.84rem;
  white-space: nowrap;
}

.event-card {
  display: none;
}

.event-mode .event-card {
  display: block;
}

.event-mode .winner-card,
.event-mode .current-response .band-picker,
.event-mode .option-list {
  display: none;
}

.event-art {
  height: 110px;
  border-radius: 8px;
  margin-bottom: 12px;
  background:
    linear-gradient(135deg, rgba(15, 139, 141, 0.82), rgba(16, 185, 129, 0.72)),
    url("data:image/svg+xml,%3Csvg viewBox='0 0 420 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 128h420v52H0z' fill='%23f7d66d'/%3E%3Ccircle cx='340' cy='42' r='26' fill='%23fff3b0'/%3E%3Cpath d='M48 128c28-38 56-52 84-42s47 2 76-24 67-31 114 66z' fill='%23d8f4e1'/%3E%3Cpath d='M88 128c28-25 50-28 74-9s45 19 67 0 54-24 95 9z' fill='%231d2523' opacity='.12'/%3E%3C/svg%3E");
  background-size: cover;
  overflow: hidden;
}

.event-art span {
  display: block;
  width: 72px;
  height: 72px;
  margin: 26px 0 0 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 -12px 0 rgba(17, 24, 39, 0.08);
}

.rsvp-buttons {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 12px;
}

.drawer-footer {
  margin-top: auto;
  padding-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.quiet-button,
.more-button,
.send-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
  font-weight: 760;
}

.more-button {
  width: 38px;
  padding: 0;
}

.send-button {
  min-height: 38px;
}

.social-tray {
  left: 14px;
  right: 14px;
  bottom: 14px;
  min-height: 150px;
  border-radius: 8px;
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 390px);
  grid-template-rows: auto 1fr;
  gap: 10px;
  transform: translateY(calc(100% + 36px));
  opacity: 0;
  transition:
    transform 520ms cubic-bezier(0.16, 1, 0.3, 1),
    opacity 280ms ease;
}

.social-open .social-tray {
  transform: translateY(0);
  opacity: 1;
}

.social-tray .tray-title-row {
  grid-column: 1 / -1;
}

.people-strip {
  min-width: 0;
  display: flex;
  gap: 9px;
  overflow-x: auto;
  padding: 2px 2px 8px;
}

.person-chip {
  min-width: 122px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.56);
  padding: 8px;
  text-align: left;
}

.person-chip.distribution {
  min-width: 148px;
  border-style: dashed;
  border-color: rgba(17, 24, 39, 0.28);
  background:
    linear-gradient(90deg, rgba(17, 24, 39, 0.04), rgba(255, 255, 255, 0.58));
}

.avatar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar,
.group-avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: white;
  border: 2px solid rgba(255, 255, 255, 0.96);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 820;
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.1);
}

.avatar.best {
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.34), 0 8px 18px rgba(17, 24, 39, 0.1);
}

.avatar.works {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.34), 0 8px 18px rgba(17, 24, 39, 0.1);
}

.avatar.maybe {
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.38), 0 8px 18px rgba(17, 24, 39, 0.1);
}

.avatar.no {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.36), 0 8px 18px rgba(17, 24, 39, 0.1);
}

.group-avatar {
  position: relative;
  border-radius: 8px;
}

.group-avatar::before,
.group-avatar::after {
  content: "";
  position: absolute;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(17, 24, 39, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.8);
  z-index: -1;
}

.group-avatar::before {
  transform: translate(-5px, 5px);
}

.group-avatar::after {
  transform: translate(5px, -5px);
}

.person-name {
  display: block;
  font-weight: 820;
  white-space: nowrap;
}

.person-status {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.comment-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
}

.comment-box label {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 760;
}

.comment-box input {
  min-width: 0;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  padding: 0 11px;
  color: var(--ink);
}

@media (max-width: 1050px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .mode-switch,
  .view-actions {
    justify-self: end;
  }

  .access-pill {
    display: none;
  }

  .drawer-open .calendar-stage {
    transform-origin: top left;
    transform: scale(0.98) translateY(-4px);
  }

  .options-tray,
  .social-tray {
    top: auto;
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    max-height: calc(100% - 24px);
    overflow-y: auto;
    transform: translateY(calc(100% + 40px));
  }

  .options-open .options-tray,
  .social-open .social-tray {
    transform: translateY(0);
  }

  .social-tray {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: min(100vw - 12px, 680px);
    margin: 6px auto;
  }

  .workspace {
    min-height: calc(100vh - 12px);
  }

  .topbar,
  .event-strip {
    align-items: stretch;
    display: flex;
    flex-direction: column;
  }

  .mode-switch,
  .view-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .event-meta {
    justify-content: flex-start;
  }

  .calendar-stage {
    padding: 10px;
  }

  .calendar-grid {
    gap: 5px;
  }

  .day-cell {
    min-height: 56px;
    padding: 6px;
  }

  .range-label,
  .consensus-badge {
    display: none;
  }

  .blocker-badge {
    min-width: 24px;
    height: 22px;
    padding: 0 5px;
    font-size: 0.64rem;
  }

  .my-marker {
    left: 5px;
    bottom: 5px;
    height: 18px;
    padding: 0 6px;
    font-size: 0.62rem;
  }

  .options-tray,
  .social-tray {
    max-height: calc(100% - 24px);
  }
}
