:root {
  color-scheme: light;
  --ink: #25232d;
  --muted: #777382;
  --line: #e9e6ee;
  --soft-line: #f1eff4;
  --paper: #ffffff;
  --page: #f7f6f9;
  --purple: #7357d8;
  --purple-dark: #6045c3;
  --purple-soft: #eeebfa;
  --hour-width: 64px;
  --member-width: 176px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--page);
  color: var(--ink);
}

body {
  min-width: 320px;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  color: inherit;
}

button,
select,
input[type="color"],
.upload-zone {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.upload-zone:focus-within {
  outline: 3px solid rgba(115, 87, 216, 0.18);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
  padding: 28px 20px 20px;
  display: flex;
  flex-direction: column;
  background: #fbfafc;
  border-right: 1px solid var(--line);
}

.brand-row,
.space-title-row,
.sidebar-profile,
.topbar,
.topbar-left,
.topbar-right,
.date-controls,
.page-intro,
.timeline-toolbar,
.dialog-header,
.dialog-actions,
.tag-row,
.time-fields,
.permission-row {
  display: flex;
  align-items: center;
}

.brand-row {
  justify-content: space-between;
  padding: 0 5px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  font-size: 20px;
  font-weight: 760;
  letter-spacing: -0.5px;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  padding: 7px;
  background: var(--purple);
  box-shadow: 0 7px 18px rgba(115, 87, 216, 0.24);
}

.brand-mark span {
  width: 4px;
  border-radius: 3px;
  background: white;
}

.brand-mark span:nth-child(1) { height: 7px; opacity: 0.75; }
.brand-mark span:nth-child(2) { height: 16px; }
.brand-mark span:nth-child(3) { height: 11px; opacity: 0.88; }

.primary-button,
.secondary-button,
.today-button,
.danger-button,
.text-button,
.icon-button,
.tiny-icon-button,
.nav-item,
.calendar-actions button,
.filter-chip,
.dialog-close {
  border: 0;
  background: none;
}

.primary-button,
.secondary-button,
.danger-button {
  min-height: 42px;
  border-radius: 12px;
  padding: 0 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 680;
  white-space: nowrap;
}

.primary-button {
  color: #fff;
  background: var(--purple);
  box-shadow: 0 7px 16px rgba(115, 87, 216, 0.2);
}

.primary-button:hover {
  background: var(--purple-dark);
  transform: translateY(-1px);
}

.secondary-button {
  color: #4e4a59;
  background: #fff;
  border: 1px solid var(--line);
}

.secondary-button:hover,
.today-button:hover,
.icon-button:hover,
.tiny-icon-button:hover {
  background: #f1eef8;
}

.button-plus {
  font-size: 19px;
  line-height: 1;
  font-weight: 400;
}

.sidebar-create {
  width: 100%;
  margin: 30px 0 18px;
}

.main-nav {
  display: grid;
  gap: 5px;
}

.nav-item {
  width: 100%;
  min-height: 44px;
  border-radius: 11px;
  padding: 0 13px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #686371;
  text-align: left;
  font-weight: 600;
}

.nav-item:hover {
  color: var(--ink);
  background: #f1eff5;
}

.nav-item.active {
  color: var(--purple-dark);
  background: var(--purple-soft);
}

.nav-icon {
  width: 21px;
  text-align: center;
  font-size: 20px;
}

.mini-calendar {
  margin-top: 28px;
  padding: 0 4px;
}

.calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 0 2px;
}

.calendar-head strong {
  font-size: 13px;
  letter-spacing: 0.1px;
}

.calendar-actions {
  display: flex;
  gap: 3px;
}

.calendar-actions button,
.tiny-icon-button {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  padding: 0;
  display: grid;
  place-items: center;
}

.calendar-weekdays,
.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  text-align: center;
}

.calendar-weekdays span {
  color: #aaa5b1;
  font-size: 10px;
  padding-bottom: 5px;
}

.calendar-day {
  border: 0;
  padding: 0;
  aspect-ratio: 1;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: #6e6977;
  background: transparent;
  font-size: 11px;
}

.calendar-day:hover {
  background: #efedf3;
}

.calendar-day.outside {
  color: #cbc7d0;
}

.calendar-day.today:not(.selected) {
  box-shadow: inset 0 0 0 1px #c2b7e8;
  color: var(--purple);
}

.calendar-day.selected {
  color: #fff;
  background: var(--purple);
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(115, 87, 216, 0.22);
}

.space-card {
  margin-top: 24px;
  padding: 16px;
  border-radius: 15px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 7px 22px rgba(45, 39, 60, 0.035);
}

.space-title-row {
  justify-content: space-between;
}

.space-title-row > div {
  display: grid;
  gap: 3px;
}

.section-eyebrow {
  color: #9a95a4;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 1.1px;
  text-transform: uppercase;
}

.space-title-row strong {
  font-size: 14px;
}

.space-members {
  display: flex;
  align-items: center;
  margin: 14px 0 10px;
}

.space-members .avatar + .avatar,
.avatar-stack .avatar + .avatar {
  margin-left: -7px;
}

.avatar {
  width: 31px;
  height: 31px;
  flex: 0 0 31px;
  display: grid;
  place-items: center;
  border: 2px solid white;
  border-radius: 50%;
  color: white;
  font-size: 11px;
  font-weight: 760;
  box-shadow: 0 2px 6px rgba(40, 35, 50, 0.1);
}

.avatar-me { background: linear-gradient(135deg, #775ce0, #9e7deb); }
.avatar-lin { background: linear-gradient(135deg, #e47f7f, #e9a26f); }
.avatar-mia { background: linear-gradient(135deg, #3b9c94, #73b48e); }
.avatar-luo { background: linear-gradient(135deg, #4c83cb, #70a8e0); }

.text-button {
  padding: 0;
  color: var(--purple);
  font-size: 11px;
  font-weight: 650;
}

.sidebar-profile {
  margin-top: auto;
  padding: 16px 5px 0;
  border-top: 1px solid var(--line);
  gap: 10px;
}

.sidebar-profile > div:nth-child(2) {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 2px;
}

.sidebar-profile strong {
  font-size: 12px;
}

.sidebar-profile span {
  color: var(--muted);
  font-size: 10px;
}

#logoutButton {
  width: auto;
  min-width: 36px;
  padding: 0 6px;
  color: #8b8492;
  font-size: 9px;
}

.main-content {
  min-width: 0;
  padding: 0 38px 40px;
}

.topbar {
  min-height: 82px;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
}

.topbar-left,
.topbar-right,
.date-controls {
  gap: 9px;
}

.icon-button {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #5c5764;
  font-size: 20px;
}

.date-button {
  position: relative;
  border: 0;
  background: transparent;
  padding: 8px 4px;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 720;
}

.date-button:hover {
  color: var(--purple);
}

.chevron {
  color: #a09ba8;
}

.native-date-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.today-button {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: #6e6876;
  font-size: 12px;
  font-weight: 650;
}

.avatar-stack {
  display: flex;
  padding-left: 6px;
}

.mobile-menu,
.sidebar-close {
  display: none;
}

.page-intro {
  justify-content: space-between;
  gap: 30px;
  padding: 38px 2px 27px;
}

.intro-kicker {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #817b89;
  font-size: 11px;
  font-weight: 600;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #43aa82;
  box-shadow: 0 0 0 4px rgba(67, 170, 130, 0.11);
}

.page-intro h1 {
  margin: 9px 0 7px;
  font-size: clamp(28px, 3vw, 39px);
  line-height: 1.12;
  letter-spacing: -1.3px;
}

.page-intro p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.day-summary {
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 220px;
  padding: 17px 21px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid var(--line);
}

.summary-item {
  display: grid;
  gap: 2px;
}

.summary-item strong {
  font-size: 20px;
}

.summary-item span {
  color: var(--muted);
  font-size: 10px;
}

.summary-divider {
  width: 1px;
  height: 32px;
  background: var(--line);
}

.timeline-card {
  overflow: hidden;
  border-radius: 21px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 17px 48px rgba(38, 33, 48, 0.055);
}

.timeline-toolbar {
  min-height: 66px;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}

.overlap-member-picker {
  width: 100%;
  padding-top: 11px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--soft-line);
}

.overlap-member-picker > span {
  flex: 0 0 auto;
  color: #8e8795;
  font-size: 10px;
  font-weight: 680;
}

.member-choice-list,
.tag-filter-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.member-choice,
.tag-filter {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 11px 0 7px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #777180;
  background: #fff;
  font-size: 10px;
  font-weight: 650;
}

.member-choice i {
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 8px;
  font-style: normal;
}

.member-choice.selected,
.tag-filter.selected {
  color: var(--purple-dark);
  border-color: #cfc5f2;
  background: var(--purple-soft);
  box-shadow: 0 3px 10px rgba(85, 62, 157, .08);
}

.member-choice.selected::after {
  content: "✓";
  color: var(--purple);
  font-size: 9px;
}

.view-panel {
  animation: view-in 220ms ease both;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(5px); }
}

.week-view,
.memories-view {
  display: grid;
  gap: 18px;
}

.view-toolbar {
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(38, 33, 48, .045);
}

.week-toolbar {
  display: grid;
  grid-template-columns: .8fr 1.2fr;
  gap: 24px;
}

.view-toolbar > div {
  min-width: 0;
}

.view-toolbar .section-eyebrow {
  display: block;
  margin-bottom: 10px;
}

.tag-filter {
  padding-inline: 12px;
}

.week-insight {
  min-height: 150px;
  padding: 27px 30px;
  border-radius: 21px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  color: #fff;
  background:
    radial-gradient(circle at 88% 20%, rgba(255,255,255,.24), transparent 28%),
    linear-gradient(135deg, #6f53d2, #8e70e6);
  box-shadow: 0 18px 44px rgba(96, 69, 195, .2);
}

.week-insight .section-eyebrow {
  color: rgba(255,255,255,.64);
}

.week-insight h2 {
  margin: 7px 0 7px;
  font-size: clamp(19px, 2.5vw, 28px);
  letter-spacing: -.6px;
}

.week-insight p {
  margin: 0;
  color: rgba(255,255,255,.72);
  font-size: 11px;
  line-height: 1.7;
}

.week-total-orb {
  width: 104px;
  height: 104px;
  flex: 0 0 104px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 50%;
  display: grid;
  place-content: center;
  gap: 2px;
  text-align: center;
  background: rgba(255,255,255,.12);
  box-shadow: inset 0 0 0 8px rgba(255,255,255,.035);
}

.week-total-orb strong {
  font-size: 20px;
}

.week-total-orb span {
  color: rgba(255,255,255,.65);
  font-size: 8px;
}

.week-chart-card {
  padding: 22px 24px 17px;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(38, 33, 48, .045);
}

.week-chart-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.week-chart-heading strong {
  font-size: 13px;
}

.week-chart-heading span {
  color: var(--muted);
  font-size: 10px;
}

.week-bars {
  height: 190px;
  margin-top: 17px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  align-items: end;
  border-bottom: 1px solid var(--line);
  background: repeating-linear-gradient(to bottom, transparent 0, transparent 44px, #f3f1f5 45px);
}

.week-bar-column {
  height: 100%;
  min-width: 0;
  border: 0;
  padding: 23px 3px 9px;
  display: grid;
  grid-template-rows: 1fr auto auto;
  place-items: end center;
  position: relative;
  background: transparent;
}

.week-bar-column:hover {
  background: rgba(115,87,216,.035);
}

.week-bar-value {
  position: absolute;
  top: 3px;
  color: #81798d;
  font-size: 8px;
}

.week-bar {
  width: min(32px, 64%);
  height: var(--bar-height);
  min-height: 3px;
  align-self: end;
  border-radius: 9px 9px 3px 3px;
  background: linear-gradient(180deg, #9a83e9, #7256d4);
  box-shadow: 0 7px 17px rgba(115,87,216,.15);
  transition: height 240ms ease;
}

.week-bar-column strong {
  margin-top: 7px;
  font-size: 10px;
}

.week-bar-column small {
  color: #aaa3b0;
  font-size: 8px;
}

.week-day-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.week-day-card {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(38, 33, 48, .04);
}

.week-day-heading {
  width: 100%;
  border: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  text-align: left;
}

.week-day-heading > span {
  display: grid;
  gap: 2px;
}

.week-day-heading strong {
  font-size: 13px;
}

.week-day-heading small {
  color: #aaa3af;
  font-size: 9px;
}

.week-day-heading em {
  color: var(--purple);
  font-size: 10px;
  font-style: normal;
  font-weight: 670;
}

.week-mini-timeline {
  margin: 16px 0 13px;
}

.week-time-ruler {
  display: flex;
  justify-content: space-between;
  color: #bbb5c0;
  font-size: 7px;
}

.week-time-track {
  position: relative;
  height: 14px;
  margin-top: 4px;
  overflow: hidden;
  border-radius: 5px;
  background: repeating-linear-gradient(to right, #f1eff4 0, #f1eff4 1px, #faf9fb 1px, #faf9fb 25%);
}

.week-time-block {
  position: absolute;
  top: 2px;
  height: 10px;
  min-width: 3px;
  border: 0;
  border-radius: 4px;
  background: var(--event-color);
  box-shadow: 0 2px 6px var(--event-border);
}

.week-entry-list {
  display: grid;
  gap: 6px;
}

.week-entry {
  width: 100%;
  min-width: 0;
  border: 0;
  border-radius: 10px;
  padding: 8px 9px;
  display: grid;
  grid-template-columns: 5px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  background: #f9f8fa;
  text-align: left;
}

.week-entry:hover {
  background: #f3f0fa;
}

.week-entry > i {
  width: 4px;
  height: 26px;
  border-radius: 4px;
}

.week-entry > span {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.week-entry strong,
.week-entry small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.week-entry strong {
  font-size: 10px;
}

.week-entry small,
.week-entry em {
  color: #97909e;
  font-size: 8px;
  font-style: normal;
}

.week-entry em {
  padding: 3px 6px;
  border-radius: 6px;
  background: #eeebf5;
}

.week-empty-day {
  padding: 10px;
  border-radius: 10px;
  color: #aaa4af;
  background: #faf9fb;
  text-align: center;
  font-size: 9px;
}

.memory-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
}

.memory-toolbar strong {
  display: block;
  font-size: 13px;
}

.memory-stage {
  min-height: 360px;
  padding: 28px 26px;
  border: 1px solid var(--line);
  border-radius: 21px;
  background:
    radial-gradient(circle at 82% 8%, rgba(226,109,143,.08), transparent 25%),
    linear-gradient(180deg, #fff, #fbf9fc);
  box-shadow: 0 16px 45px rgba(38, 33, 48, .055);
}

.memory-timeline {
  position: relative;
  display: grid;
  gap: 28px;
}

.memory-timeline::before {
  content: "";
  position: absolute;
  left: 121px;
  top: 12px;
  bottom: 12px;
  width: 2px;
  background: linear-gradient(#ded7ef, #e6dbe3);
}

.memory-node {
  position: relative;
  display: grid;
  grid-template-columns: 105px 34px minmax(0, 1fr);
  align-items: start;
}

.memory-time {
  padding-top: 13px;
  display: grid;
  gap: 3px;
  text-align: right;
}

.memory-time strong {
  font-size: 11px;
}

.memory-time span {
  color: #9d96a3;
  font-size: 8px;
}

.memory-dot {
  z-index: 2;
  width: 22px;
  height: 22px;
  margin: 9px auto 0;
  border: 5px solid #fbf9fc;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: #a69caf;
  font-size: 7px;
}

.memory-node.shared .memory-dot {
  width: 28px;
  height: 28px;
  margin-top: 6px;
  background: linear-gradient(135deg, #7357d8, #e26d8f);
  box-shadow: 0 0 0 5px rgba(115,87,216,.09);
}

.memory-moment-card {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.88);
  box-shadow: 0 10px 29px rgba(43, 35, 52, .06);
}

.memory-node.shared .memory-moment-card {
  border-color: #ded5f4;
  background: linear-gradient(135deg, #fff, #fdf9ff);
  box-shadow: 0 14px 36px rgba(91, 63, 148, .1);
}

.memory-moment-copy h2 {
  margin: 5px 0 5px;
  font-size: 17px;
  letter-spacing: -.3px;
}

.memory-moment-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.65;
}

.memory-photo-grid {
  margin-top: 15px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.memory-photo {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 0;
  border-radius: 14px;
  padding: 0;
  display: grid;
  grid-template-rows: 150px auto;
  background: #f5f2f6;
  text-align: left;
  box-shadow: inset 0 0 0 1px rgba(44,36,53,.05);
}

.memory-photo:hover {
  transform: translateY(-2px) rotate(calc((var(--photo-index) - 1) * .15deg));
  box-shadow: 0 10px 24px rgba(40,32,49,.1);
}

.memory-photo img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  background: #eeeaf0;
}

.memory-photo > span {
  position: relative;
  min-width: 0;
  padding: 10px 10px 10px 38px;
  display: grid;
  gap: 2px;
  background: #fff;
}

.memory-photo > span > i {
  position: absolute;
  left: 9px;
  top: 10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 8px;
  font-style: normal;
}

.memory-photo strong,
.memory-photo small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.memory-photo strong {
  font-size: 10px;
}

.memory-photo small {
  color: #9992a0;
  font-size: 8px;
}

.memory-empty {
  min-height: 310px;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
}

.memory-empty > span {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  color: var(--purple);
  background: var(--purple-soft);
  font-size: 25px;
}

.memory-empty h2 {
  margin: 15px 0 6px;
  font-size: 18px;
}

.memory-empty p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 10px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px;
  border-radius: 11px;
  background: #f4f2f6;
}

.filter-chip {
  min-height: 31px;
  padding: 0 12px;
  border-radius: 8px;
  color: #777180;
  font-size: 11px;
  font-weight: 650;
}

.filter-chip.active {
  color: #443f4c;
  background: #fff;
  box-shadow: 0 2px 8px rgba(45, 39, 60, 0.08);
}

.legend {
  display: flex;
  align-items: center;
  gap: 16px;
  color: #918b98;
  font-size: 10px;
}

.legend > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.legend-dot.work { background: #7357d8; }
.legend-dot.life { background: #2f9b7c; }
.legend-dot.social { background: #e26d8f; }
.legend-dot.custom { background: linear-gradient(135deg, #df8b3f, #3c82d4); }

.timeline-scroll {
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #d4cfdb transparent;
}

.timeline-scroll::-webkit-scrollbar {
  height: 10px;
}

.timeline-scroll::-webkit-scrollbar-thumb {
  background: #d8d3df;
  border: 3px solid white;
  border-radius: 20px;
}

.timeline-content {
  min-width: calc(var(--member-width) + 24 * var(--hour-width));
}

.timeline-header-row,
.person-row {
  display: grid;
  grid-template-columns: var(--member-width) calc(24 * var(--hour-width));
}

.timeline-header-row {
  position: sticky;
  top: 0;
  z-index: 25;
  height: 48px;
  background: white;
  border-bottom: 1px solid var(--line);
}

.member-column-head {
  position: sticky;
  left: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  padding-left: 21px;
  color: #aaa4b0;
  background: white;
  border-right: 1px solid var(--line);
  font-size: 10px;
  font-weight: 700;
}

.time-scale {
  position: relative;
  height: 48px;
  background: #fdfcfe;
}

.hour-label {
  position: absolute;
  top: 18px;
  width: var(--hour-width);
  color: #9f99a7;
  font-size: 10px;
  text-align: center;
  transform: translateX(-50%);
}

.person-row {
  min-height: 116px;
  border-bottom: 1px solid var(--soft-line);
}

.person-row:last-child {
  border-bottom: 0;
}

.person-info {
  position: sticky;
  left: 0;
  z-index: 15;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 25px 18px;
  background: white;
  border-right: 1px solid var(--line);
}

.person-info .avatar {
  width: 34px;
  height: 34px;
  flex-basis: 34px;
}

.person-copy {
  min-width: 0;
  padding-top: 2px;
  display: grid;
  gap: 3px;
}

.person-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.person-copy span {
  color: #aaa4b0;
  font-size: 9px;
}

.time-track {
  position: relative;
  min-height: 116px;
  background-color: #fff;
  background-image:
    linear-gradient(to right, rgba(229, 225, 233, 0.95) 1px, transparent 1px),
    linear-gradient(to right, rgba(239, 237, 242, 0.75) 1px, transparent 1px);
  background-size: var(--hour-width) 100%, calc(var(--hour-width) / 2) 100%;
}

.time-track:hover {
  background-color: #fdfcff;
}

.quick-add-marker {
  position: absolute;
  top: 8px;
  bottom: 8px;
  width: 2px;
  display: none;
  background: rgba(115, 87, 216, 0.32);
  pointer-events: none;
}

.time-track:hover .quick-add-marker {
  display: block;
}

.timeline-event {
  position: absolute;
  top: 17px;
  height: 80px;
  min-width: 46px;
  overflow: hidden;
  border: 0;
  border-radius: 13px;
  padding: 10px 11px;
  display: flex;
  align-items: stretch;
  gap: 8px;
  color: var(--event-ink);
  background: var(--event-bg);
  box-shadow: inset 0 0 0 1px var(--event-border), 0 5px 12px rgba(42, 35, 54, 0.05);
  text-align: left;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.timeline-event:hover {
  z-index: 10;
  transform: translateY(-2px);
  box-shadow: inset 0 0 0 1px var(--event-border), 0 9px 19px rgba(42, 35, 54, 0.11);
}

.event-accent {
  width: 4px;
  flex: 0 0 4px;
  border-radius: 4px;
  background: var(--event-color);
}

.event-body {
  min-width: 0;
  flex: 1;
  display: grid;
  align-content: center;
  gap: 4px;
}

.event-body strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  line-height: 1.25;
}

.event-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--event-muted);
  font-size: 9px;
}

.event-image {
  width: 48px;
  flex: 0 0 48px;
  object-fit: cover;
  border-radius: 9px;
  background: rgba(255,255,255,0.6);
}

.timeline-event.compact {
  padding: 9px 8px;
}

.timeline-event.compact .event-image,
.timeline-event.compact .event-meta {
  display: none;
}

.timeline-event.micro {
  padding: 9px 5px;
  justify-content: center;
}

.timeline-event.micro .event-accent,
.timeline-event.micro .event-image,
.timeline-event.micro .event-meta {
  display: none;
}

.timeline-event.micro .event-body strong {
  writing-mode: vertical-rl;
  max-height: 57px;
  font-size: 9px;
}

.now-line {
  position: absolute;
  z-index: 8;
  top: 0;
  bottom: 0;
  width: 1px;
  background: #e75868;
  pointer-events: none;
}

.now-line::before {
  content: "";
  position: absolute;
  top: -4px;
  left: -3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e75868;
}

.overlap-highlight {
  position: absolute;
  top: 7px;
  bottom: 7px;
  border-radius: 9px;
  background: repeating-linear-gradient(-45deg, rgba(115,87,216,.09), rgba(115,87,216,.09) 5px, rgba(115,87,216,.02) 5px, rgba(115,87,216,.02) 10px);
  border: 1px dashed rgba(115,87,216,.2);
  pointer-events: none;
}

.empty-state-row {
  padding: 44px;
  color: var(--muted);
  text-align: center;
}

.timeline-footnote {
  min-height: 44px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #aaa5b0;
  border-top: 1px solid var(--line);
  font-size: 9px;
}

.footnote-tip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.footnote-tip i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e75868;
}

dialog {
  border: 0;
}

dialog::backdrop {
  background: rgba(37, 32, 47, 0.36);
  backdrop-filter: blur(4px);
}

.event-dialog,
.invite-dialog {
  width: min(620px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow: auto;
  margin: auto;
  padding: 0;
  border-radius: 22px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 28px 80px rgba(31, 26, 40, 0.22);
}

.event-dialog form,
.invite-dialog form {
  padding: 25px 27px 22px;
}

.dialog-header {
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 22px;
}

.dialog-header h2 {
  margin: 5px 0 0;
  font-size: 23px;
  letter-spacing: -0.5px;
}

.dialog-close {
  width: 33px;
  height: 33px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #8a8491;
  background: #f4f2f5;
  font-size: 22px;
}

.form-grid {
  display: grid;
  grid-template-columns: 0.88fr 1.12fr;
  gap: 17px 15px;
}

.full-field {
  grid-column: 1 / -1;
}

.field {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.field > span {
  color: #635e6b;
  font-size: 11px;
  font-weight: 680;
}

.field em {
  color: #aaa4b0;
  font-style: normal;
  font-weight: 500;
}

.field input,
.field textarea,
.field select,
.tag-row > select,
.permission-row select,
.invite-link-box input {
  width: 100%;
  border: 1px solid #dedbe3;
  border-radius: 11px;
  color: var(--ink);
  background: #fbfafc;
}

.field input,
.field select,
.tag-row > select,
.permission-row select,
.invite-link-box input {
  min-height: 43px;
  padding: 0 12px;
}

.field textarea {
  min-height: 76px;
  padding: 11px 12px;
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.tag-row > select:focus {
  border-color: #a799db;
  background: #fff;
}

.time-fields {
  gap: 8px;
}

.time-fields .field {
  flex: 1;
}

.time-arrow {
  margin-top: 20px;
  color: #aaa5af;
}

.tag-row {
  gap: 13px;
}

.tag-row > select {
  width: 135px;
  flex: 0 0 135px;
}

.custom-label-input {
  width: 140px;
  flex: 0 1 140px;
}

.custom-label-input input {
  width: 100%;
  min-height: 43px;
  border: 1px solid #dedbe3;
  border-radius: 11px;
  padding: 0 12px;
  color: var(--ink);
  background: #fbfafc;
}

.color-swatches {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.color-swatch,
.custom-color {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.color-swatch {
  position: relative;
  background: var(--swatch);
}

.color-swatch.selected::after {
  content: "";
  width: 8px;
  height: 5px;
  border-left: 2px solid white;
  border-bottom: 2px solid white;
  transform: translateY(-1px) rotate(-45deg);
}

.color-swatch.selected {
  box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--swatch);
}

.custom-color {
  position: relative;
  overflow: hidden;
  border: 1px dashed #a59ead;
  color: #77717f;
}

.custom-color input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
}

.custom-color span {
  pointer-events: none;
}

.upload-zone {
  min-height: 91px;
  border: 1px dashed #cfc9d7;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 3px;
  color: #918a99;
  background: #fbfafc;
  text-align: center;
  font-size: 10px;
}

.upload-zone:hover,
.upload-zone.dragging {
  border-color: #907ddb;
  background: #f6f3fe;
}

.upload-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.upload-zone strong {
  color: var(--purple);
}

.upload-zone small {
  color: #b4aeba;
  font-size: 9px;
}

.upload-icon {
  color: var(--purple);
  font-size: 22px;
  line-height: 1;
}

.image-preview {
  min-height: 70px;
  margin-top: 9px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.image-preview[hidden] {
  display: none;
}

.image-preview img {
  width: 80px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
}

.image-preview button {
  border: 0;
  background: none;
  color: #d05060;
  font-size: 11px;
}

.dialog-actions {
  gap: 9px;
  margin-top: 23px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.action-spacer {
  flex: 1;
}

.danger-button {
  color: #c84958;
  background: #fff0f2;
}

.invite-copy {
  margin: -7px 0 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.invite-copy strong {
  color: var(--purple-dark);
}

.invite-method {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fbfafc;
}

.invite-method + .invite-method {
  margin-top: 10px;
}

.recommended-method {
  border-color: #d9d0f3;
  background: linear-gradient(135deg, #fbfaff, #f6f2ff);
}

.invite-method-head {
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.invite-method-head > div {
  display: grid;
  gap: 2px;
}

.invite-method-head strong {
  font-size: 12px;
}

.invite-method-head small {
  color: var(--muted);
  font-size: 9px;
}

.method-badge {
  min-width: 39px;
  height: 23px;
  padding: 0 8px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  color: #fff;
  background: var(--purple);
  font-size: 8px;
  font-weight: 720;
}

.method-badge.secondary {
  color: #77717e;
  background: #ece9ef;
}

.invite-link-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
}

.invite-link-box input {
  min-width: 0;
}

.invite-code-row {
  width: 100%;
  border: 0;
  padding: 11px 14px;
  border-radius: 11px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  background: #f2f0f5;
  font-size: 11px;
  text-align: left;
}

.invite-code-row:hover {
  background: #ece8f5;
}

.invite-code-row strong {
  color: var(--purple-dark);
  font-size: 14px;
  letter-spacing: 2px;
  text-align: center;
}

.invite-code-row em {
  color: var(--purple);
  font-size: 9px;
  font-style: normal;
  font-weight: 650;
}

.invite-steps {
  margin: 17px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  list-style: none;
}

.invite-steps li {
  min-width: 0;
  padding: 10px;
  border-radius: 11px;
  display: flex;
  align-items: flex-start;
  gap: 7px;
  color: #827b89;
  background: #f8f7fa;
  font-size: 8px;
  line-height: 1.55;
}

.invite-steps i {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--purple);
  background: var(--purple-soft);
  font-size: 8px;
  font-style: normal;
  font-weight: 740;
}

.permission-row {
  justify-content: space-between;
  gap: 18px;
  margin-top: 18px;
  padding: 16px;
  border-radius: 13px;
  background: #f8f7fa;
}

.permission-row > div {
  display: grid;
  gap: 4px;
}

.permission-row strong {
  font-size: 12px;
}

.permission-row span {
  color: var(--muted);
  font-size: 10px;
}

.permission-row select {
  width: 100px;
  min-height: 36px;
  background: white;
}

.toast {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: 28px;
  max-width: calc(100vw - 32px);
  padding: 11px 17px;
  border-radius: 12px;
  color: white;
  background: rgba(40, 36, 47, 0.92);
  box-shadow: 0 9px 28px rgba(30, 25, 38, 0.2);
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.auth-dialog,
.join-dialog {
  width: min(460px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow: auto;
  margin: auto;
  padding: 0;
  border-radius: 24px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 30px 90px rgba(31, 26, 40, 0.24);
}

.auth-dialog::backdrop,
.join-dialog::backdrop {
  background:
    radial-gradient(circle at 20% 20%, rgba(115,87,216,.2), transparent 35%),
    rgba(244, 242, 248, .88);
  backdrop-filter: blur(10px);
}

.auth-dialog form,
.join-dialog form {
  padding: 31px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 780;
}

.auth-brand .brand-mark {
  width: 30px;
  height: 30px;
}

.auth-copy {
  margin: 28px 0 20px;
}

.auth-copy h2 {
  margin: 6px 0 8px;
  font-size: 27px;
  letter-spacing: -0.8px;
}

.auth-copy p,
.auth-terms {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

.auth-invite-card {
  margin: -5px 0 18px;
  padding: 14px;
  border: 1px solid #d9d0f3;
  border-radius: 15px;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  background:
    radial-gradient(circle at 100% 0, rgba(226,109,143,.13), transparent 35%),
    linear-gradient(135deg, #fbfaff, #f6f2ff);
}

.invite-gift {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--purple), #e26d8f);
  box-shadow: 0 7px 16px rgba(115,87,216,.19);
}

.auth-invite-card > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.auth-invite-card small {
  color: #938b9a;
  font-size: 8px;
}

.auth-invite-card strong {
  font-size: 12px;
}

.auth-invite-card p {
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.55;
}

.auth-invite-card em {
  color: var(--purple-dark);
  font-style: normal;
  font-weight: 720;
  letter-spacing: 1px;
}

.auth-tabs {
  margin-bottom: 18px;
  padding: 4px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-radius: 12px;
  background: #f1eff5;
}

.auth-tabs button {
  min-height: 36px;
  border: 0;
  border-radius: 9px;
  color: #817b89;
  background: transparent;
  font-size: 11px;
  font-weight: 680;
}

.auth-tabs button.active {
  color: var(--purple-dark);
  background: white;
  box-shadow: 0 3px 10px rgba(45,39,60,.08);
}

.auth-dialog .field + .field,
.join-dialog .field + .field {
  margin-top: 14px;
}

.auth-submit {
  width: 100%;
  min-height: 46px;
  margin-top: 8px;
}

.auth-submit:disabled,
.primary-button:disabled {
  cursor: wait;
  opacity: .62;
  transform: none;
}

.auth-message {
  min-height: 20px;
  margin: 10px 0 0;
  color: #c24e5d;
  font-size: 10px;
  line-height: 1.6;
}

.auth-message.success {
  color: #27856a;
}

.auth-terms {
  margin-top: 14px;
  text-align: center;
  font-size: 9px;
}

.join-dialog .dialog-header {
  margin-bottom: 10px;
}

.join-dialog .dialog-actions {
  margin-top: 14px;
}

.syncing .live-dot {
  background: #d49a48;
  animation: sync-pulse 1.2s ease-in-out infinite;
}

.offline .live-dot {
  background: #d45d69;
  box-shadow: 0 0 0 4px rgba(212,93,105,.11);
}

@keyframes sync-pulse {
  50% { opacity: .35; }
}

.sidebar-scrim {
  display: none;
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .sidebar {
    padding-inline: 16px;
  }

  .main-content {
    padding-inline: 24px;
  }

  .legend {
    display: none;
  }
}

@media (max-width: 820px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    transform: translateX(-105%);
    transition: transform 220ms ease;
    box-shadow: 12px 0 40px rgba(30, 25, 38, 0.15);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-scrim {
    position: fixed;
    z-index: 35;
    inset: 0;
    display: block;
    background: rgba(30, 25, 38, 0.32);
    opacity: 0;
    visibility: hidden;
    transition: opacity 200ms ease, visibility 200ms ease;
  }

  .sidebar-scrim.visible {
    opacity: 1;
    visibility: visible;
  }

  .mobile-menu,
  .sidebar-close {
    display: grid;
  }

  .main-content {
    padding-inline: 18px;
  }

  .share-button,
  .avatar-stack {
    display: none;
  }

  .week-day-list {
    grid-template-columns: 1fr;
  }

  .memory-toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
  }
}

@media (max-width: 620px) {
  .main-content {
    padding-inline: 12px;
    padding-bottom: 24px;
  }

  .topbar {
    min-height: 68px;
  }

  .today-button,
  .header-create span:not(.button-plus),
  .date-controls > .icon-button {
    display: none;
  }

  .header-create {
    width: 40px;
    min-height: 40px;
    padding: 0;
  }

  .topbar-left,
  .date-controls {
    min-width: 0;
  }

  .date-button {
    min-width: 0;
    font-size: 12px;
  }

  .page-intro {
    align-items: flex-start;
    padding-block: 27px 20px;
  }

  .page-intro p {
    line-height: 1.7;
  }

  .day-summary {
    display: none;
  }

  .timeline-toolbar {
    overflow-x: auto;
    padding-inline: 11px;
  }

  .filter-group {
    flex: 0 0 auto;
  }

  .timeline-card {
    border-radius: 17px;
  }

  :root {
    --member-width: 126px;
    --hour-width: 58px;
  }

  .person-info {
    gap: 7px;
    padding-inline: 11px;
  }

  .person-info .avatar {
    width: 29px;
    height: 29px;
    flex-basis: 29px;
  }

  .person-copy strong {
    font-size: 10px;
  }

  .timeline-footnote span:first-child {
    display: none;
  }

  .timeline-footnote {
    justify-content: flex-end;
  }

  .event-dialog form,
  .invite-dialog form {
    padding: 21px 17px 18px;
  }

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

  .date-field,
  .time-fields,
  .full-field {
    grid-column: 1;
  }

  .tag-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .custom-label-input {
    width: 100%;
    flex-basis: auto;
  }

  .week-toolbar {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .view-toolbar {
    padding: 17px;
  }

  .week-insight {
    padding: 22px 19px;
  }

  .week-total-orb {
    width: 82px;
    height: 82px;
    flex-basis: 82px;
  }

  .week-total-orb strong {
    font-size: 15px;
  }

  .week-bars {
    gap: 2px;
  }

  .week-bar {
    width: 20px;
  }

  .week-bar-value {
    font-size: 7px;
  }

  .week-chart-card,
  .week-day-card {
    padding-inline: 14px;
  }

  .memory-stage {
    padding: 20px 12px;
  }

  .memory-timeline::before {
    left: 82px;
  }

  .memory-node {
    grid-template-columns: 69px 26px minmax(0, 1fr);
  }

  .memory-time strong {
    font-size: 9px;
  }

  .memory-time span {
    font-size: 7px;
  }

  .memory-moment-card {
    padding: 13px;
  }

  .memory-photo-grid {
    grid-template-columns: 1fr;
  }

  .overlap-member-picker {
    align-items: flex-start;
    flex-direction: column;
  }

  .dialog-actions {
    flex-wrap: wrap;
  }

  .dialog-actions .action-spacer {
    display: none;
  }

  .dialog-actions .danger-button {
    margin-right: auto;
  }

  .invite-link-box {
    grid-template-columns: 1fr;
  }

  .invite-steps {
    grid-template-columns: 1fr;
  }

  .auth-dialog form,
  .join-dialog form {
    padding: 25px 19px 21px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
