:root {
  --bg: #f2efe9;
  --panel: #fffdfa;
  --panel-2: #faf7f1;
  --ink: #23262f;
  --ink-soft: #4e505a;
  --muted: #8d8a83;
  --muted-2: #aaa59b;
  --line: #ece8e0;
  --line-strong: #ddd7cb;
  --me: #4f7cff;
  --me-soft: #edf2ff;
  --me-ink: #24345c;
  --her: #e8758a;
  --her-soft: #fdeef1;
  --her-ink: #5a2b35;
  --danger: #d9534f;
  --time-w: 50px;
  --day-w: clamp(168px, 12.6vw, 188px);
  --header-h: 64px;
  --early-h: 66px;
  --grid-h: 960px;
  --radius: 20px;
  --shadow-soft: 0 18px 60px rgba(70, 58, 38, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  background:
    radial-gradient(1100px 680px at 12% -12%, #e8efff 0%, rgba(232, 239, 255, 0) 58%),
    radial-gradient(900px 600px at 92% -8%, #ffeaf0 0%, rgba(255, 234, 240, 0) 55%),
    var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC",
    sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--me);
  outline-offset: 2px;
}

.page {
  display: flex;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.app {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1480px;
  height: 100%;
  min-width: 0;
  overflow: hidden;
  background: linear-gradient(180deg, #fffdfa 0%, #fcfaf5 100%);
}

/* ---------- top bar ---------- */

.topbar {
  position: relative;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex: 0 0 auto;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 18px 12px;
  border-bottom: 1px solid rgba(221, 215, 203, 0.7);
  background: rgba(255, 253, 250, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: linear-gradient(135deg, #5b83ff 0%, #7b9aff 55%, #f08aa0 100%);
  box-shadow: 0 6px 16px rgba(79, 124, 255, 0.24);
}

.brand-mark svg {
  width: 25px;
  height: 25px;
}

.brand-copy {
  min-width: 0;
}

.brand-copy h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 720;
  letter-spacing: -0.02em;
  line-height: 1.2;
  white-space: nowrap;
}

.brand-copy p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.2;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.demo-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 7px;
  border: 1px solid #e7e0d5;
  border-radius: 999px;
  color: #8b8172;
  background: #fbf7ef;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.view-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid #e8e2d8;
  border-radius: 999px;
  background: #f3efe8;
}

.view-label {
  padding: 0 4px 0 7px;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 600;
  white-space: nowrap;
}

.view-switch button {
  min-width: 38px;
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  color: #777269;
  background: transparent;
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.view-switch button:hover {
  color: var(--ink);
}

.view-switch button.is-active {
  color: var(--ink);
  background: #fffdfa;
  box-shadow: 0 1px 3px rgba(50, 42, 28, 0.12);
}

/* ---------- week bar ---------- */

.weekbar {
  position: relative;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex: 0 0 auto;
  padding: 11px 18px 9px;
  border-bottom: 1px solid rgba(236, 232, 224, 0.85);
  background: rgba(255, 253, 250, 0.78);
}

.week-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

.week-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0 7px;
}

.week-copy strong {
  overflow: hidden;
  font-size: 17px;
  font-weight: 720;
  letter-spacing: -0.025em;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.week-copy span {
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  color: #625e56;
  background: transparent;
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.icon-btn:hover {
  border-color: #e6e0d6;
  background: #f7f3ec;
}

.icon-btn:active {
  transform: scale(0.94);
}

.week-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.ghost-btn,
.primary-btn,
.danger-btn,
.reset-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 34px;
  padding: 0 13px;
  border-radius: 10px;
  font-size: 11.5px;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease,
    transform 0.15s ease, box-shadow 0.15s ease;
}

.ghost-btn {
  border: 1px solid #e4ddd2;
  color: #5f5a51;
  background: #fffdfa;
}

.ghost-btn:hover {
  border-color: #d5ccbd;
  background: #faf6ef;
}

.primary-btn {
  border: 1px solid #23262f;
  color: #fff;
  background: #23262f;
  box-shadow: 0 3px 8px rgba(35, 38, 47, 0.16);
}

.primary-btn:hover {
  background: #343742;
}

.primary-btn:active,
.ghost-btn:active,
.danger-btn:active {
  transform: translateY(1px);
}

.plus {
  margin-top: -1px;
  font-size: 15px;
  font-weight: 500;
}

/* ---------- legend ---------- */

.legend {
  position: relative;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 13px;
  flex: 0 0 auto;
  min-height: 28px;
  padding: 0 18px 7px;
  color: var(--muted);
  background: rgba(255, 253, 250, 0.78);
  font-size: 10px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #6f6a61;
  font-weight: 600;
}

.dot {
  display: inline-block;
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.dot-me {
  background: var(--me);
}

.dot-her {
  background: var(--her);
}

.legend-hint {
  overflow: hidden;
  color: var(--muted-2);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reset-btn {
  height: 24px;
  margin-left: auto;
  padding: 0 8px;
  border: 1px solid transparent;
  color: #a09a8f;
  background: transparent;
  font-size: 9.5px;
  font-weight: 600;
}

.reset-btn:hover {
  border-color: #e8e1d6;
  color: #6e675c;
  background: #faf6ef;
}

/* ---------- calendar shell ---------- */

.cal-scroll {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: #d7d0c4 transparent;
  scrollbar-width: thin;
  background: var(--panel);
  scroll-snap-type: x proximity;
  scroll-padding-left: var(--time-w);
  -webkit-overflow-scrolling: touch;
}

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

.cal-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.cal-scroll::-webkit-scrollbar-thumb {
  border: 3px solid var(--panel);
  border-radius: 999px;
  background: #d7d0c4;
}

.cal-content {
  width: max(100%, calc(var(--time-w) + var(--day-w) * 7));
  min-height: 100%;
  margin: 0 auto;
}

.cal-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: var(--time-w) repeat(7, minmax(var(--day-w), 1fr));
  height: var(--header-h);
  border-bottom: 1px solid var(--line-strong);
  background: rgba(255, 253, 250, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.cal-header .corner {
  position: sticky;
  left: 0;
  z-index: 36;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 10px;
  border-right: 1px solid var(--line-strong);
  color: var(--muted-2);
  background: rgba(255, 253, 250, 0.98);
  box-shadow: 7px 0 12px -14px rgba(35, 38, 47, 0.28);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.day-head {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  padding: 8px 8px 7px;
  border-right: 1px solid var(--line);
  scroll-snap-align: start;
}

.day-head:last-child {
  border-right: 0;
}

.day-head-top {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  overflow: hidden;
}

.day-name {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.day-date {
  flex: 0 0 auto;
  color: var(--ink);
  font-size: 13px;
  font-weight: 720;
  letter-spacing: -0.015em;
}

.day-head.is-today .day-name {
  color: var(--me);
}

.day-head.is-today .day-date {
  padding: 1px 5px;
  border-radius: 999px;
  color: #fff;
  background: var(--ink);
}

.member-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-width: 0;
}

.member-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
  color: #6d6860;
  font-size: 9.5px;
  font-weight: 600;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- calendar body ---------- */

.cal-body {
  display: grid;
  grid-template-columns: var(--time-w) repeat(7, minmax(var(--day-w), 1fr));
}

.time-axis {
  position: sticky;
  left: 0;
  z-index: 20;
  align-self: start;
  width: var(--time-w);
  height: calc(var(--early-h) + var(--grid-h));
  border-right: 1px solid var(--line-strong);
  background: var(--panel);
  box-shadow: 7px 0 12px -14px rgba(35, 38, 47, 0.22);
}

.early-label {
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--early-h);
  border-bottom: 1px solid var(--line-strong);
  color: var(--muted-2);
  font-size: 8.5px;
  font-weight: 650;
  letter-spacing: 0.03em;
}

.time-labels {
  position: relative;
  height: var(--grid-h);
}

.time-label {
  position: absolute;
  right: 7px;
  transform: translateY(-50%);
  color: #b0aba1;
  font-size: 8.5px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.time-label.hour {
  color: #746f66;
  font-size: 9px;
  font-weight: 650;
}

.time-label.first {
  transform: translateY(2px);
}

.time-label.last {
  transform: translateY(-100%);
}

.day-col {
  position: relative;
  min-width: 0;
  border-right: 1px solid var(--line);
  background: var(--panel);
  scroll-snap-align: start;
}

.day-col:last-child {
  border-right: 0;
}

.day-col.is-weekend {
  background: rgba(250, 246, 238, 0.48);
}

.day-col.is-today {
  background: rgba(238, 243, 255, 0.55);
}

.early-row {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: var(--early-h);
  border-bottom: 1px solid var(--line-strong);
  background: rgba(255, 253, 250, 0.42);
}

.early-lane {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 5px 4px;
  overflow: hidden;
  cursor: pointer;
}

.early-lane + .early-lane {
  border-left: 1px dashed rgba(190, 183, 170, 0.45);
}

.early-lane:hover {
  background: rgba(255, 255, 255, 0.5);
}

.early-chip {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 0 0 auto;
  width: 100%;
  height: 22px;
  padding: 0 5px;
  overflow: hidden;
  border: 1px solid rgba(221, 215, 203, 0.8);
  border-left: 3px solid var(--person);
  border-radius: 5px;
  color: var(--person-ink);
  background: var(--person-soft);
  font-size: 9px;
  line-height: 1;
  text-align: left;
  cursor: pointer;
  transition: box-shadow 0.14s ease, transform 0.14s ease;
}

.early-chip.is-me {
  --person: var(--me);
  --person-soft: var(--me-soft);
  --person-ink: var(--me-ink);
}

.early-chip.is-her {
  --person: var(--her);
  --person-soft: var(--her-soft);
  --person-ink: var(--her-ink);
}

.early-chip:hover {
  box-shadow: 0 2px 8px rgba(50, 42, 28, 0.12);
}

.early-chip:active {
  transform: scale(0.985);
}

.ec-time {
  flex: 0 0 auto;
  color: var(--person);
  font-size: 8px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.ec-title {
  min-width: 0;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ec-arrow {
  flex: 0 0 auto;
  margin-left: auto;
  color: var(--person);
  font-size: 9px;
  opacity: 0.8;
}

.early-more {
  flex: 0 0 auto;
  align-self: flex-start;
  height: 18px;
  padding: 0 4px;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
  font-size: 8px;
  font-weight: 600;
  line-height: 18px;
  text-align: left;
  cursor: pointer;
}

.early-more:hover {
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.7);
}

.early-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 4px;
}

.early-list-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 43px;
  padding: 8px 10px;
  border: 1px solid rgba(221, 215, 203, 0.8);
  border-left: 3px solid var(--person);
  border-radius: 10px;
  color: var(--person-ink);
  background: var(--person-soft);
  text-align: left;
  cursor: pointer;
}

.early-list-item.is-me {
  --person: var(--me);
  --person-soft: var(--me-soft);
  --person-ink: var(--me-ink);
}

.early-list-item.is-her {
  --person: var(--her);
  --person-soft: var(--her-soft);
  --person-ink: var(--her-ink);
}

.early-list-item:hover {
  box-shadow: 0 4px 14px rgba(50, 42, 28, 0.1);
}

.early-list-time {
  color: var(--person);
  font-size: 10px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.early-list-title {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.early-list-range {
  color: var(--muted);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.day-grid {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: var(--grid-h);
  overflow: hidden;
  background-image:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 59px,
      var(--line-strong) 59px,
      var(--line-strong) 60px
    ),
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 29px,
      var(--line) 29px,
      var(--line) 30px
    );
}

.lane {
  position: relative;
  min-width: 0;
  cursor: pointer;
}

.lane + .lane {
  border-left: 1px dashed rgba(190, 183, 170, 0.42);
}

.lane:hover {
  background: rgba(255, 255, 255, 0.28);
}

.event-block {
  position: absolute;
  right: 3px;
  left: calc(3px + var(--offset, 0px));
  z-index: 2;
  min-height: 14px;
  padding: 4px 5px 4px 7px;
  overflow: hidden;
  border: 0;
  border-left: 3px solid var(--person);
  border-radius: 7px;
  color: var(--person-ink);
  background: var(--person-soft);
  box-shadow: 0 1px 1px rgba(35, 38, 47, 0.04);
  text-align: left;
  cursor: pointer;
  user-select: none;
  transition: box-shadow 0.15s ease, filter 0.15s ease;
}

.event-block.is-me {
  --person: var(--me);
  --person-soft: var(--me-soft);
  --person-ink: var(--me-ink);
}

.event-block.is-her {
  --person: var(--her);
  --person-soft: var(--her-soft);
  --person-ink: var(--her-ink);
}

.event-block:hover {
  z-index: 12 !important;
  box-shadow: 0 5px 16px rgba(50, 42, 28, 0.16);
  filter: saturate(1.04);
}

.event-block:active {
  filter: brightness(0.985);
}

.event-block.continues-up {
  border-top: 1px dashed rgba(35, 38, 47, 0.2);
  border-top-left-radius: 3px;
  border-top-right-radius: 3px;
}

.event-block.continues-down {
  border-bottom: 1px dashed rgba(35, 38, 47, 0.2);
  border-bottom-left-radius: 3px;
  border-bottom-right-radius: 3px;
}

.event-block.has-conflict::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #e05252;
  box-shadow: 0 0 0 2px var(--person-soft);
}

.ev-time {
  overflow: hidden;
  color: var(--person);
  font-size: 8.5px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ev-title {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 1px;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.3;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.event-block.compact {
  padding: 2px 4px 2px 6px;
}

.event-block.compact .ev-time {
  display: none;
}

.event-block.compact .ev-title {
  margin-top: 0;
  font-size: 10px;
  -webkit-line-clamp: 1;
}

.event-block.tiny {
  display: flex;
  align-items: center;
  padding: 0 4px;
}

.event-block.tiny .ev-time,
.event-block.tiny .ev-title {
  display: none;
}

.now-line {
  position: absolute;
  right: 0;
  left: 0;
  z-index: 9;
  height: 1px;
  background: #e05252;
  pointer-events: none;
}

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

/* ---------- scroll hint ---------- */

.scroll-hint {
  position: absolute;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  z-index: 55;
  display: none;
  align-items: center;
  height: 28px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.94);
  background: rgba(35, 38, 47, 0.82);
  box-shadow: 0 6px 18px rgba(35, 38, 47, 0.2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.01em;
  pointer-events: none;
  transform: translateX(-50%);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.scroll-hint.is-hidden {
  opacity: 0;
  transform: translate(-50%, 6px);
}

/* ---------- modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(28, 27, 25, 0.42);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  animation: fade-in 0.16s ease-out;
}

.modal {
  display: flex;
  flex-direction: column;
  width: min(440px, 100%);
  max-height: min(86dvh, 720px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: 0 30px 90px rgba(20, 18, 14, 0.28);
  animation: modal-in 0.19s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex: 0 0 auto;
  padding: 20px 20px 8px;
}

.modal-heading {
  min-width: 0;
}

.modal-kicker {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.modal-head h2 {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-close {
  flex: 0 0 auto;
  margin-top: -3px;
  color: #8f897f;
  font-size: 24px;
  font-weight: 400;
}

.modal-body {
  flex: 1 1 auto;
  padding: 2px 20px 20px;
  overflow: auto;
  overscroll-behavior: contain;
}

/* ---------- detail ---------- */

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin: 6px 0 14px;
}

.owner-pill,
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 650;
  white-space: nowrap;
}

.owner-pill.is-me {
  color: var(--me-ink);
  background: var(--me-soft);
}

.owner-pill.is-her {
  color: var(--her-ink);
  background: var(--her-soft);
}

.owner-pill .dot {
  width: 5px;
  height: 5px;
  background: currentColor;
}

.tag {
  color: #8b6a32;
  background: #fbf1dd;
}

.detail-time {
  color: var(--ink);
  font-size: 27px;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.045em;
  line-height: 1.12;
}

.detail-date {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.4;
}

.detail-note {
  margin-top: 16px;
  padding: 11px 12px;
  border: 1px solid #eee8dd;
  border-radius: 11px;
  color: #5f5a51;
  background: #faf6ef;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.detail-conflict {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 12px;
  padding: 9px 11px;
  border: 1px solid #f2d3ad;
  border-radius: 10px;
  color: #8d5a1f;
  background: #fff6e9;
  font-size: 11px;
  line-height: 1.5;
}

.detail-conflict::before {
  content: "!";
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  margin-top: 1px;
  border-radius: 50%;
  color: #fff;
  background: #d9892b;
  font-size: 10px;
  font-weight: 800;
}

.detail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.detail-actions .primary-btn,
.detail-actions .ghost-btn,
.detail-actions .danger-btn {
  height: 39px;
  padding: 0 17px;
  border-radius: 11px;
  font-size: 12px;
}

.danger-btn {
  border: 1px solid #efd1d0;
  color: #b74a47;
  background: #fff8f7;
}

.danger-btn:hover {
  border-color: #e7b7b4;
  background: #fff1ef;
}

.readonly-note {
  display: inline-flex;
  align-items: center;
  height: 30px;
  color: var(--muted);
  font-size: 10.5px;
}

.detail-actions .spacer {
  flex: 1 1 auto;
}

/* ---------- form ---------- */

.event-form {
  display: flex;
  flex-direction: column;
  gap: 13px;
  padding-top: 4px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field > span {
  color: #777168;
  font-size: 10.5px;
  font-weight: 650;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid #e4ddd2;
  border-radius: 11px;
  color: var(--ink);
  background: #fff;
  font-size: 15px;
  line-height: 1.3;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input {
  height: 44px;
  padding: 0 11px;
}

.field textarea {
  min-height: 78px;
  padding: 10px 11px;
  resize: vertical;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #b9b2a7;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--me);
  box-shadow: 0 0 0 3px rgba(79, 124, 255, 0.11);
}

.field input[type="date"],
.field input[type="time"] {
  font-variant-numeric: tabular-nums;
}

.field-row {
  display: grid;
  grid-template-columns: 1.18fr 1fr 1fr;
  gap: 8px;
}

.form-hint {
  min-height: 16px;
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.form-hint.is-warn {
  color: #a06a24;
}

.form-hint.is-error {
  color: var(--danger);
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.form-actions .ghost-btn,
.form-actions .primary-btn,
.form-actions .danger-btn {
  height: 39px;
  padding: 0 17px;
  border-radius: 11px;
  font-size: 12px;
}

.form-actions .spacer {
  flex: 1 1 auto;
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(420px, calc(100vw - 32px));
  min-height: 40px;
  padding: 8px 12px 8px 15px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 13px;
  color: rgba(255, 255, 255, 0.94);
  background: rgba(35, 38, 47, 0.94);
  box-shadow: 0 12px 32px rgba(20, 18, 14, 0.24);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 12px;
  line-height: 1.35;
  transform: translateX(-50%);
  animation: toast-in 0.18s ease-out;
}

.toast button {
  flex: 0 0 auto;
  padding: 4px 6px;
  border: 0;
  border-radius: 6px;
  color: #ffd27a;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.toast button:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* ---------- animations ---------- */

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- responsive ---------- */

@media (min-width: 1100px) {
  body {
    padding: 18px;
  }

  .app {
    height: 100%;
    border: 1px solid rgba(221, 215, 203, 0.8);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
  }
}

@media (max-width: 720px) {
  .topbar {
    padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 10px;
    gap: 8px;
  }

  .brand {
    gap: 8px;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 10px;
  }

  .brand-mark svg {
    width: 23px;
    height: 23px;
  }

  .brand-copy h1 {
    font-size: 14px;
  }

  .brand-copy p {
    font-size: 9.5px;
  }

  .demo-badge {
    display: none;
  }

  .view-switch {
    padding: 3px;
  }

  .view-label {
    display: none;
  }

  .view-switch button {
    min-width: 31px;
    height: 27px;
    padding: 0 8px;
    font-size: 10.5px;
  }

  .weekbar {
    padding: 9px 12px 7px;
    gap: 8px;
  }

  .week-copy {
    padding: 0 3px;
  }

  .week-copy strong {
    font-size: 15.5px;
  }

  .week-copy span {
    font-size: 9px;
  }

  .icon-btn {
    width: 28px;
    height: 28px;
    font-size: 20px;
  }

  .week-actions {
    gap: 6px;
  }

  .ghost-btn {
    height: 32px;
    padding: 0 10px;
    font-size: 10.5px;
  }

  .primary-btn {
    height: 34px;
    padding: 0 11px;
    font-size: 11px;
  }

  .add-label {
    display: none;
  }

  .primary-btn .plus {
    font-size: 17px;
  }

  .legend {
    gap: 10px;
    min-height: 25px;
    padding: 0 12px 6px;
    font-size: 9.5px;
  }

  .legend-hint {
    display: none;
  }

  .reset-btn {
    height: 22px;
    font-size: 9px;
  }

  .cal-header {
    height: 60px;
  }

  .cal-header .corner {
    padding-bottom: 9px;
  }

  .day-head {
    gap: 3px;
    padding: 7px 6px 6px;
  }

  .day-name {
    font-size: 9.5px;
  }

  .day-date {
    font-size: 12px;
  }

  .member-chip {
    gap: 3px;
    font-size: 8.5px;
  }

  .member-chip .dot {
    width: 5px;
    height: 5px;
  }

  .time-axis {
    width: var(--time-w);
  }

  .time-label {
    right: 5px;
    font-size: 8px;
  }

  .time-label.hour {
    font-size: 8.5px;
  }

  .early-lane {
    padding: 5px 3px;
  }

  .early-chip {
    padding: 0 3px;
    border-left-width: 2.5px;
    font-size: 8.5px;
  }

  .ec-time {
    font-size: 7.5px;
  }

  .event-block {
    right: 2px;
    left: calc(2px + var(--offset, 0px));
    padding: 3px 4px 3px 6px;
    border-left-width: 2.5px;
    border-radius: 6px;
  }

  .ev-time {
    font-size: 8px;
  }

  .ev-title {
    font-size: 10px;
  }

  .scroll-hint {
    display: flex;
  }

  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    width: 100%;
    max-height: 88dvh;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 22px 22px 0 0;
    animation: sheet-in 0.23s cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  .modal-head {
    padding: 18px 16px 8px;
  }

  .modal-head h2 {
    font-size: 18px;
  }

  .modal-body {
    padding: 2px 16px calc(18px + env(safe-area-inset-bottom, 0px));
  }

  .field-row {
    grid-template-columns: 1fr 1fr;
  }

  .field-row .field:first-child {
    grid-column: 1 / -1;
  }

  .field input,
  .field textarea {
    font-size: 16px;
  }

  .detail-time {
    font-size: 24px;
  }

  .toast {
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 390px) {
  .brand-copy p {
    display: none;
  }

  .week-copy strong {
    font-size: 14.5px;
  }

  .ghost-btn {
    padding: 0 8px;
  }

  .primary-btn {
    padding: 0 9px;
  }
}

@keyframes sheet-in {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

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