/* =========================================================
   碰个面 · shared calendar
   Warm paper, vermilion accent, responsive two-pane layout.
   ========================================================= */

:root {
  --bg: #f7f2e8;
  --bg-warm: #f3ead9;
  --surface: #fffdf9;
  --surface-2: #fbf6ed;
  --surface-3: #f6efe3;
  --ink: #24231f;
  --ink-soft: #575247;
  --muted: #6f695d;
  --muted-light: #938b7d;
  --line: #e8dfd0;
  --line-strong: #d7cab5;

  --accent: #c94722;
  --accent-dark: #ae3a19;
  --accent-bright: #e4572e;
  --accent-soft: #fbe7de;
  --accent-ink: #983314;

  --teal: #2a7f7a;
  --teal-soft: #e2f1ee;
  --amber: #d09a24;
  --amber-soft: #fbf0d0;
  --blue: #4c6fa8;
  --blue-soft: #e8eef9;
  --plum: #8a5a83;
  --plum-soft: #f2e7f0;
  --coral: #e4572e;
  --coral-soft: #fbe7de;

  --danger: #a83227;
  --danger-soft: #fbe6e1;

  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;

  --shadow-card:
    0 24px 60px -38px rgba(65, 48, 27, 0.42),
    0 1px 0 rgba(255, 255, 255, 0.9) inset;
  --shadow-float:
    0 22px 44px -20px rgba(97, 48, 22, 0.5),
    0 2px 2px rgba(80, 50, 25, 0.06);

  --font-sans:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-mono:
    "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

  --topbar-h: 72px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

[data-color="coral"] {
  --tone: #e4572e;
  --tone-soft: #fbe7de;
  --tone-ink: #a5381a;
}

[data-color="amber"] {
  --tone: #d09a24;
  --tone-soft: #fbf0d0;
  --tone-ink: #87600f;
}

[data-color="teal"] {
  --tone: #2a7f7a;
  --tone-soft: #e2f1ee;
  --tone-ink: #1f625e;
}

[data-color="blue"] {
  --tone: #4c6fa8;
  --tone-soft: #e8eef9;
  --tone-ink: #36517e;
}

[data-color="plum"] {
  --tone: #8a5a83;
  --tone-soft: #f2e7f0;
  --tone-ink: #694161;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: light;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  background:
    radial-gradient(1100px 680px at 88% -12%, rgba(248, 216, 198, 0.76), transparent 62%),
    radial-gradient(900px 620px at -12% 16%, rgba(240, 230, 209, 0.85), transparent 58%),
    linear-gradient(135deg, #f9f4eb 0%, var(--bg) 52%, #f4eddf 100%);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(36, 35, 31, 0.038) 1px, transparent 1px);
  background-size: 19px 19px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.65), transparent 72%);
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.65), transparent 72%);
}

#boot-screen,
#welcome-view,
#app-view,
.toast-region,
.noscript {
  position: relative;
  z-index: 1;
}

[hidden] {
  display: none !important;
}

body.has-open-dialog {
  overflow: hidden;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

a {
  color: inherit;
}

::selection {
  background: rgba(228, 87, 46, 0.22);
}

:focus-visible {
  outline: 3px solid rgba(201, 71, 34, 0.28);
  outline-offset: 2px;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 1.1em;
  height: 1.1em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- brand + buttons ---------- */

.logo-mark {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 11px;
  background: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.logo-mark::before,
.logo-mark::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  transform: translateY(-50%);
}

.logo-mark::before {
  left: 7px;
  background: var(--accent-bright);
}

.logo-mark::after {
  right: 7px;
  background: #f2b23c;
}

.logo-mark-lg {
  width: 44px;
  height: 44px;
  border-radius: 14px;
}

.logo-mark-lg::before,
.logo-mark-lg::after {
  width: 13px;
  height: 13px;
}

.logo-mark-lg::before {
  left: 9px;
}

.logo-mark-lg::after {
  right: 9px;
}

.logo-mark-xl {
  width: 64px;
  height: 64px;
  border-radius: 20px;
}

.logo-mark-xl::before,
.logo-mark-xl::after {
  width: 19px;
  height: 19px;
}

.logo-mark-xl::before {
  left: 12px;
}

.logo-mark-xl::after {
  right: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  flex: none;
}

.brand-name {
  font-size: 20px;
  font-weight: 760;
  letter-spacing: -0.04em;
  line-height: 1;
}

.brand-hero .brand-name {
  font-size: 24px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  transition:
    background 0.18s var(--ease),
    border-color 0.18s var(--ease),
    color 0.18s var(--ease),
    transform 0.18s var(--ease),
    box-shadow 0.18s var(--ease);
}

.btn .icon {
  width: 17px;
  height: 17px;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 12px 26px -16px rgba(201, 71, 34, 0.82);
}

.btn-primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-soft {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--ink);
}

.btn-soft:hover {
  background: var(--surface);
  border-color: var(--line-strong);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink-soft);
}

.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #8f291f;
  border-color: #8f291f;
}

.btn-block {
  width: 100%;
}

.btn-small {
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 10px;
  font-size: 12.5px;
}

.btn:disabled {
  opacity: 0.56;
  transform: none;
  box-shadow: none;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.icon-btn .icon {
  width: 18px;
  height: 18px;
}

.link-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 12.5px;
  text-decoration: underline;
  text-decoration-color: rgba(87, 82, 71, 0.35);
  text-underline-offset: 3px;
}

.link-button:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

/* ---------- boot ---------- */

.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(760px 500px at 50% 36%, rgba(255, 251, 242, 0.96), rgba(247, 242, 232, 0.94) 56%, rgba(243, 234, 217, 0.98));
  text-align: center;
}

.boot-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.boot-brand {
  margin: 4px 0 0;
  font-size: 26px;
  font-weight: 780;
  letter-spacing: -0.045em;
}

.boot-text {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
}

.boot-bar {
  width: 132px;
  height: 4px;
  margin-top: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(36, 35, 31, 0.08);
}

.boot-bar span {
  display: block;
  width: 46%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  animation: boot-slide 1.2s var(--ease) infinite;
}

.boot-screen.is-error .boot-bar {
  display: none;
}

.boot-screen.is-error .boot-text {
  max-width: 300px;
  color: var(--ink-soft);
  line-height: 1.7;
}

/* ---------- welcome ---------- */

.welcome-view {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  padding: clamp(28px, 5vw, 64px);
}

.welcome-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(360px, 0.88fr);
  align-items: center;
  gap: clamp(36px, 6vw, 96px);
  width: min(1180px, 100%);
  margin: 0 auto;
}

.welcome-intro {
  min-width: 0;
  max-width: 620px;
}

.eyebrow,
.panel-kicker {
  margin: 0;
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.welcome-intro h1 {
  margin: 18px 0 22px;
  font-size: clamp(48px, 6.4vw, 88px);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.065em;
}

.welcome-intro h1 span {
  color: var(--accent);
}

.welcome-lead {
  margin: 0;
  color: var(--ink-soft);
  font-size: 15.5px;
  line-height: 1.85;
}

.feature-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 30px 0 0;
  padding: 0;
  list-style: none;
}

.feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.feature-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border: 1px solid rgba(232, 223, 208, 0.9);
  border-radius: 13px;
  background: rgba(255, 253, 249, 0.76);
  color: var(--accent);
  box-shadow: 0 8px 20px -18px rgba(65, 48, 27, 0.5);
}

.feature-icon .icon {
  width: 18px;
  height: 18px;
}

.feature-list strong,
.feature-list small {
  display: block;
}

.feature-list strong {
  font-size: 13.5px;
  font-weight: 680;
}

.feature-list small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.welcome-art {
  position: relative;
  width: 350px;
  max-width: 100%;
  margin: 40px 0 0 14px;
  transform: rotate(-2.5deg);
}

.mini-cal {
  position: relative;
  padding: 17px 18px 16px;
  border: 1px solid rgba(231, 220, 202, 0.95);
  border-radius: 22px;
  background: rgba(255, 253, 249, 0.94);
  box-shadow: 0 34px 60px -34px rgba(65, 48, 27, 0.43);
}

.mini-cal-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 2px 2px 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.mini-cal-head span:last-child {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
}

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

.mini-week {
  margin-bottom: 4px;
  color: var(--muted-light);
  font-size: 8.5px;
  font-weight: 650;
}

.mini-grid span {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 7px;
  color: var(--ink-soft);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.mini-grid .is-muted {
  color: var(--muted-light);
  opacity: 0.65;
}

.mini-grid .has-dot::after {
  content: "";
  position: absolute;
  bottom: 3px;
  left: 50%;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--tone, var(--accent));
  transform: translateX(-50%);
}

.mini-grid .is-selected {
  background: var(--ink);
  color: #fff;
  box-shadow: 0 8px 16px -8px rgba(36, 35, 31, 0.7);
}

.mini-event {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 12px;
  padding: 10px 10px 10px 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}

.mini-event-bar {
  width: 4px;
  height: 27px;
  flex: none;
  border-radius: 99px;
  background: var(--tone, var(--teal));
}

.mini-event-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.mini-event-copy strong {
  overflow: hidden;
  font-size: 10.5px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-event-copy small {
  margin-top: 1px;
  overflow: hidden;
  color: var(--muted);
  font-size: 8.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-stack {
  flex: none;
}

.mini-stack .avatar {
  width: 19px;
  height: 19px;
  font-size: 8px;
}

.art-chip {
  position: absolute;
  right: -20px;
  top: -15px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.03em;
  box-shadow: 0 12px 24px -14px rgba(36, 35, 31, 0.6);
  transform: rotate(3deg);
}

.welcome-side {
  width: min(430px, 100%);
  justify-self: end;
  min-width: 0;
}

.welcome-panel {
  padding: 32px;
  border: 1px solid rgba(231, 220, 202, 0.95);
  border-radius: var(--radius-xl);
  background: rgba(255, 253, 249, 0.9);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(10px);
}

.welcome-panel h2 {
  margin: 7px 0 8px;
  font-size: 27px;
  font-weight: 750;
  letter-spacing: -0.045em;
  line-height: 1.2;
}

.panel-copy {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.field-label,
.field > label,
.field > legend {
  display: block;
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 660;
  line-height: 1.4;
}

.optional {
  color: var(--muted-light);
  font-size: 10.5px;
  font-weight: 500;
}

.welcome-panel .field-label {
  margin-top: 20px;
  margin-bottom: 7px;
}

.welcome-panel .field-label + .text-input {
  margin-bottom: 0;
}

.text-input {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.4;
  transition:
    background 0.16s var(--ease),
    border-color 0.16s var(--ease),
    box-shadow 0.16s var(--ease);
}

.text-input::placeholder {
  color: var(--muted-light);
}

.text-input:hover {
  border-color: var(--line-strong);
}

.text-input:focus {
  border-color: var(--accent);
  outline: none;
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(201, 71, 34, 0.1);
}

textarea.text-input {
  min-height: 88px;
  resize: vertical;
  line-height: 1.65;
}

.code-input,
.recovery-code-box code {
  font-family: var(--font-mono);
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.form-error {
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(168, 50, 39, 0.14);
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 12px;
  line-height: 1.55;
}

.text-input.is-invalid {
  border-color: var(--danger);
  background: #fffafa;
  box-shadow: 0 0 0 3px rgba(168, 50, 39, 0.1);
}

.welcome-note.is-alert {
  color: var(--danger);
}

.form-error:empty {
  display: none;
}

.btn-block {
  margin-top: 18px;
}

.welcome-panel #show-recover {
  margin-top: 18px;
}

.welcome-note {
  margin: 22px 0 0;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.welcome-foot {
  margin: 16px 4px 0;
  color: var(--muted);
  font-size: 10.5px;
  text-align: center;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin: 0 0 16px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.back-link:hover {
  color: var(--accent);
}

.back-link .icon {
  width: 14px;
  height: 14px;
}

#welcome-recover .field-label {
  margin-top: 16px;
}

/* ---------- app shell ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid rgba(232, 223, 208, 0.72);
  background: rgba(247, 242, 232, 0.82);
  backdrop-filter: blur(16px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  width: min(1180px, 100%);
  height: var(--topbar-h);
  margin: 0 auto;
  padding: 0 24px;
}

.topbar-tag {
  padding-left: 18px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-left: auto;
}

.new-event-btn {
  min-height: 40px;
  padding: 9px 16px;
  font-size: 13px;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 4px 8px 4px 4px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease);
}

.user-chip:hover {
  border-color: var(--line);
  background: rgba(255, 253, 249, 0.66);
}

.user-name {
  max-width: 110px;
  overflow: hidden;
  font-size: 12.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chevron {
  width: 13px;
  height: 13px;
  color: var(--muted);
}

.main-layout {
  display: grid;
  grid-template-columns: minmax(360px, 430px) minmax(0, 1fr);
  align-items: start;
  gap: 24px;
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 32px 24px 8px;
}

.calendar-card,
.agenda-card {
  border: 1px solid rgba(232, 223, 208, 0.95);
  border-radius: var(--radius-xl);
  background: rgba(255, 253, 249, 0.82);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(10px);
}

.calendar-card {
  position: sticky;
  top: calc(var(--topbar-h) + 24px);
  padding: 22px 22px 17px;
}

.calendar-head,
.agenda-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.section-kicker {
  margin: 0;
  color: var(--accent);
  font-size: 10px;
  font-weight: 780;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.calendar-head h2,
.agenda-head h2 {
  margin: 5px 0 0;
  font-size: 27px;
  font-weight: 760;
  letter-spacing: -0.05em;
  line-height: 1.15;
}

.section-sub {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11.5px;
}

.calendar-nav {
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
}

.calendar-nav .icon-btn {
  width: 32px;
  height: 32px;
}

.calendar-nav .icon {
  width: 16px;
  height: 16px;
}

.today-btn {
  height: 32px;
  padding: 0 9px;
  border: 0;
  border-radius: 99px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 650;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}

.today-btn:hover {
  background: var(--surface);
  color: var(--ink);
}

.weekday-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-top: 20px;
  margin-bottom: 4px;
  color: var(--muted-light);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-align: center;
}

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

.day-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-height: 59px;
  padding: 7px 3px 5px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  transition:
    background 0.15s var(--ease),
    color 0.15s var(--ease),
    box-shadow 0.15s var(--ease),
    transform 0.15s var(--ease);
}

.day-cell:hover {
  background: var(--surface-2);
}

.day-cell.is-outside {
  color: var(--muted-light);
  opacity: 0.72;
}

.day-cell.is-outside:hover {
  opacity: 1;
}

.day-cell.is-selected {
  background: var(--ink);
  color: #fff;
  box-shadow: 0 12px 24px -16px rgba(36, 35, 31, 0.8);
}

.day-cell.is-selected:hover {
  background: var(--ink);
}

.day-num {
  position: relative;
  display: inline-block;
  font-size: 13px;
  font-weight: 640;
  line-height: 1.2;
}

.day-cell.is-today .day-num {
  color: var(--accent);
  font-weight: 800;
}

.day-cell.is-today .day-num::after {
  content: "";
  position: absolute;
  top: -3px;
  right: -6px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.day-cell.is-selected .day-num {
  color: #fff;
}

.day-cell.is-selected.is-today .day-num::after {
  background: #fff;
}

.day-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 6px;
  flex-wrap: wrap;
}

.dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--tone, var(--accent));
}

.day-cell.is-selected .dot {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.64);
}

.dot-more {
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  line-height: 1;
}

.day-cell.is-selected .dot-more {
  color: rgba(255, 255, 255, 0.8);
}

.calendar-foot {
  margin-top: 13px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.legend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 10px;
}

.legend-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-bright);
}

/* ---------- agenda ---------- */

.agenda-card {
  min-height: 478px;
  padding: 26px;
  scroll-margin-top: calc(var(--topbar-h) + 12px);
}

.agenda-head {
  align-items: center;
}

.agenda-head h2 {
  font-size: 26px;
}

.add-day-btn {
  min-height: 38px;
  padding: 8px 13px;
  font-size: 12px;
}

.add-day-btn .icon {
  width: 15px;
  height: 15px;
}

.agenda-list {
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin-top: 20px;
  min-height: 280px;
}

.event-card {
  position: relative;
  display: block;
  width: 100%;
  padding: 15px 17px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--tone, var(--line-strong));
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  text-align: left;
  box-shadow: 0 14px 34px -30px rgba(65, 48, 27, 0.55);
  transition:
    transform 0.18s var(--ease),
    box-shadow 0.18s var(--ease),
    border-color 0.18s var(--ease);
}

.event-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  border-left-color: var(--tone, var(--line-strong));
  box-shadow: 0 22px 40px -30px rgba(65, 48, 27, 0.55);
}

.event-card:active {
  transform: translateY(0);
}

.event-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.event-time {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border-radius: 7px;
  background: var(--tone-soft, var(--surface-2));
  color: var(--tone-ink, var(--ink-soft));
  font-size: 10.5px;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.event-time .icon {
  width: 11px;
  height: 11px;
}

.event-pills {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}

.pill-owner {
  border-color: rgba(201, 71, 34, 0.14);
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.pill-going {
  border-color: rgba(42, 127, 122, 0.13);
  background: var(--teal-soft);
  color: var(--teal);
}

.pill-declined {
  border-color: rgba(168, 50, 39, 0.12);
  background: var(--danger-soft);
  color: var(--danger);
}

.pill-range {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--muted);
}

.pill-private {
  border-color: var(--line);
  background: var(--surface-3);
  color: var(--ink-soft);
}

.pill-series {
  border-color: rgba(42, 127, 122, 0.14);
  background: var(--teal-soft);
  color: var(--teal);
}

.event-title {
  display: block;
  margin: 9px 0 6px;
  overflow-wrap: anywhere;
  font-size: 17px;
  font-weight: 720;
  letter-spacing: -0.025em;
  line-height: 1.38;
}

.event-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 11.5px;
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.meta-item .icon {
  width: 13px;
  height: 13px;
  flex: none;
  color: var(--muted-light);
}

.meta-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 260px;
}

.event-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 11px;
  padding-top: 11px;
  border-top: 1px dashed var(--line);
}

.event-private-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1.4;
}

.event-private-note .icon {
  width: 13px;
  height: 13px;
  flex: none;
  color: var(--ink-soft);
}

.attendee-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.avatar-stack {
  display: flex;
  align-items: center;
}

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

.avatar {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border: 1.5px solid var(--surface);
  border-radius: 50%;
  background: var(--tone-soft, var(--surface-3));
  color: var(--tone-ink, var(--ink-soft));
  font-size: 10.5px;
  font-weight: 750;
  line-height: 1;
  letter-spacing: 0;
}

.avatar-sm {
  width: 30px;
  height: 30px;
  font-size: 11px;
}

.avatar-lg {
  width: 54px;
  height: 54px;
  border-width: 2px;
  font-size: 19px;
}

.avatar-xs {
  width: 22px;
  height: 22px;
  font-size: 8.5px;
}

.avatar-ghost {
  background: var(--surface-2);
  color: var(--muted-light);
  border-color: var(--surface);
}

.avatar-ghost .icon {
  width: 14px;
  height: 14px;
}

.avatar-stack .more {
  width: 27px;
  height: 27px;
  display: inline-grid;
  place-items: center;
  margin-left: -7px;
  border: 1.5px solid var(--surface);
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 700;
}

.attendee-count {
  overflow: hidden;
  color: var(--muted);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attendee-count strong {
  color: var(--ink-soft);
  font-weight: 700;
}

.event-arrow {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}

.event-arrow .icon {
  width: 14px;
  height: 14px;
}

.event-card:hover .event-arrow {
  background: var(--tone-soft, var(--surface-3));
  color: var(--tone-ink, var(--ink));
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 20px 28px;
  text-align: center;
}

.empty-art {
  width: 148px;
  height: auto;
  margin-bottom: 10px;
  color: var(--accent);
}

.empty-art svg {
  display: block;
  width: 100%;
  height: auto;
}

.empty-state h3 {
  margin: 6px 0 6px;
  font-size: 18px;
  font-weight: 730;
  letter-spacing: -0.025em;
}

.empty-state p {
  max-width: 280px;
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}

.empty-state .btn {
  min-height: 38px;
  padding: 8px 14px;
  font-size: 12px;
}

.list-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding: 10px 13px;
  border: 1px solid rgba(168, 50, 39, 0.12);
  border-radius: 11px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 11.5px;
}

.list-error .link-button {
  color: var(--danger);
}

.skeleton-card {
  height: 111px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(100deg, var(--surface-2) 20%, #fffdfa 40%, var(--surface-2) 60%);
  background-size: 220% 100%;
  animation: shimmer 1.4s linear infinite;
}

.skeleton-card.short {
  height: 86px;
  opacity: 0.7;
}

.app-foot {
  width: min(1180px, 100%);
  margin: 10px auto 0;
  padding: 0 24px 42px;
  color: var(--muted);
  font-size: 10.5px;
  text-align: center;
}

.fab {
  position: fixed;
  right: 16px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 25;
  display: none;
  place-items: center;
  width: 54px;
  height: 54px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-float);
  transition: background 0.16s var(--ease), transform 0.16s var(--ease);
}

.fab:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.fab:active {
  transform: translateY(0);
}

.fab .icon {
  width: 24px;
  height: 24px;
  stroke-width: 2;
}

/* ---------- dialogs ---------- */

.dialog {
  width: min(560px, calc(100vw - 32px));
  max-width: none;
  max-height: min(88vh, 820px);
  max-height: min(88dvh, 820px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 26px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 40px 100px -30px rgba(30, 24, 15, 0.55);
}

.dialog::backdrop {
  background: rgba(32, 28, 22, 0.43);
  backdrop-filter: blur(4px);
}

.dialog[open] {
  animation: dialog-in 0.2s var(--ease);
}

.detail-dialog {
  width: min(640px, calc(100vw - 32px));
}

.dialog-shell {
  display: flex;
  flex-direction: column;
  max-height: min(88vh, 820px);
  max-height: min(88dvh, 820px);
}

#event-form {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 24px 0;
}

.dialog-kicker {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 9.5px;
  font-weight: 780;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.dialog-head h2 {
  margin: 0;
  max-width: 470px;
  overflow-wrap: anywhere;
  font-size: 24px;
  font-weight: 750;
  letter-spacing: -0.045em;
  line-height: 1.22;
}

.dialog-close {
  margin: -4px -6px 0 0;
  flex: none;
}

.dialog-body {
  min-height: 0;
  padding: 20px 24px 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.dialog-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  padding: 15px 24px calc(15px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.dialog-foot-between {
  justify-content: space-between;
}

.dialog-foot .btn {
  min-height: 40px;
}

.dialog-note {
  margin: 15px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.75;
}

.dialog-body .field + .field,
.dialog-body .field + .field-row,
.dialog-body .field-row + .field,
.dialog-body .switch-field + .field-row {
  margin-top: 14px;
}

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

.visibility-field {
  min-width: 0;
  margin: 16px 0 0;
  padding: 0;
  border: 0;
}

.visibility-field > legend {
  margin-bottom: 8px;
}

.visibility-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.visibility-option {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  cursor: pointer;
  transition:
    border-color 0.16s var(--ease),
    background 0.16s var(--ease),
    box-shadow 0.16s var(--ease);
}

.visibility-option:hover {
  border-color: rgba(201, 71, 34, 0.25);
}

.visibility-option:has(input:checked) {
  border-color: rgba(201, 71, 34, 0.42);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px rgba(201, 71, 34, 0.08);
}

.visibility-option:has(input:focus-visible) {
  outline: 3px solid rgba(201, 71, 34, 0.25);
  outline-offset: 2px;
}

.visibility-option input {
  width: 16px;
  height: 16px;
  flex: none;
  margin: 2px 0 0;
  accent-color: var(--accent);
  cursor: pointer;
}

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

.visibility-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.4;
}

.visibility-label .icon {
  width: 12px;
  height: 12px;
  color: var(--ink-soft);
}

.visibility-help {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 400;
  line-height: 1.5;
}

.repeat-field {
  margin-top: 14px;
}

#event-repeat-until-field {
  margin-top: 12px;
}

#event-scope-note {
  margin: 10px 0 0;
}

select.text-input {
  min-height: 43px;
  cursor: pointer;
}

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

.field-row .field {
  gap: 7px;
}

.range-hint {
  margin: 6px 0 0;
  padding-left: 2px;
  color: var(--muted);
  font-size: 10.5px;
}

.range-hint.is-warning {
  color: var(--danger);
}

.switch-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
}

.switch-field .field-label {
  display: block;
}

.field-help {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 400;
}

.switch {
  position: relative;
  display: inline-flex;
  width: 44px;
  height: 26px;
  flex: none;
  cursor: pointer;
}

.switch input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.switch-track {
  position: relative;
  display: block;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background 0.18s var(--ease);
}

.switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(40, 30, 20, 0.2);
  transition: transform 0.18s var(--ease);
}

.switch input:checked + .switch-track {
  background: var(--teal);
}

.switch input:checked + .switch-track .switch-thumb {
  transform: translateX(18px);
}

.switch input:focus-visible + .switch-track {
  outline: 3px solid rgba(201, 71, 34, 0.25);
  outline-offset: 2px;
}

.color-field {
  margin: 14px 0 0;
  padding: 0;
  border: 0;
}

.color-field > legend {
  margin-bottom: 9px;
}

.color-picker {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-swatch {
  position: relative;
  display: inline-block;
  width: 33px;
  height: 33px;
  flex: none;
  cursor: pointer;
}

.color-swatch input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.swatch-dot {
  display: block;
  width: 29px;
  height: 29px;
  border-radius: 50%;
  background: var(--tone, var(--accent));
  box-shadow: inset 0 0 0 1px rgba(36, 35, 31, 0.08);
  transition: box-shadow 0.16s var(--ease), transform 0.16s var(--ease);
}

.color-swatch:hover .swatch-dot {
  transform: scale(1.06);
}

.color-swatch input:checked + .swatch-dot {
  box-shadow:
    0 0 0 3px var(--surface),
    0 0 0 5px var(--tone, var(--accent));
}

.color-swatch input:focus-visible + .swatch-dot {
  outline: 3px solid rgba(201, 71, 34, 0.25);
  outline-offset: 3px;
}

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

.detail-head {
  align-items: flex-start;
}

.detail-heading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.detail-color-bar {
  width: 5px;
  height: 48px;
  flex: none;
  margin-top: 4px;
  border-radius: 999px;
  background: var(--tone, var(--accent));
}

.detail-body {
  padding-top: 16px;
}

.detail-meta {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface-2);
}

.detail-meta-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.55;
}

.detail-meta-row .icon {
  width: 16px;
  height: 16px;
  flex: none;
  margin-top: 2px;
  color: var(--tone, var(--accent));
}

.detail-meta-row span {
  overflow-wrap: anywhere;
}

.detail-description {
  margin: 16px 0 0;
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.78;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.detail-private-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.6;
}

.detail-private-note .icon {
  width: 15px;
  height: 15px;
  flex: none;
  margin-top: 2px;
  color: var(--ink-soft);
}

/* ---------- comments ---------- */

.comments-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.comments-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.comments-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
}

.comments-count {
  color: var(--muted);
  font-size: 10.5px;
}

.comment-list {
  display: flex;
  flex-direction: column;
  gap: 13px;
  margin-top: 12px;
}

.comment-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.comment-main {
  min-width: 0;
  flex: 1;
}

.comment-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.comment-author {
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.comment-time {
  color: var(--muted);
  font-size: 10px;
}

.comment-delete {
  margin-left: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 10px;
  cursor: pointer;
}

.comment-delete:hover {
  color: var(--danger);
}

.comment-body {
  margin: 3px 0 0;
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.comment-empty,
.comment-loading {
  padding: 12px 0;
  color: var(--muted);
  font-size: 11.5px;
}

.comment-form {
  margin-top: 14px;
}

.comment-input {
  min-height: 72px;
  resize: vertical;
}

.comment-form-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}

.comment-form-note {
  color: var(--muted);
  font-size: 10px;
}

.comment-form .btn {
  min-height: 32px;
  padding: 7px 12px;
  font-size: 11px;
}

.comment-delete-confirm {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 5px;
  color: var(--danger);
  font-size: 10.5px;
}

.comment-delete-confirm .btn {
  min-height: 27px;
  padding: 5px 8px;
  font-size: 10px;
}

.rsvp-panel {
  margin-top: 18px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface-2);
}

.rsvp-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.rsvp-title {
  margin: 0;
  font-size: 13px;
  font-weight: 720;
}

.rsvp-status {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.rsvp-count {
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
}

.rsvp-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.rsvp-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 660;
  transition:
    background 0.16s var(--ease),
    border-color 0.16s var(--ease),
    color 0.16s var(--ease);
}

.rsvp-btn .icon {
  width: 15px;
  height: 15px;
}

.rsvp-btn:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.rsvp-btn.is-active[data-rsvp="going"] {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
}

.rsvp-btn.is-active[data-rsvp="declined"] {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.rsvp-btn:disabled {
  opacity: 0.55;
}

.rsvp-clear {
  margin-top: 9px;
  font-size: 11px;
}

.attendee-section {
  margin-top: 18px;
}

.attendee-section-head {
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.attendee-section-head h3 {
  margin: 0;
  font-size: 12.5px;
  font-weight: 720;
}

.attendee-section-head span {
  color: var(--muted);
  font-size: 10.5px;
}

.attendee-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 9px;
}

.attendee-list.is-empty {
  display: block;
  padding: 11px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 11px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.6;
}

.attendee-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 11.5px;
}

.attendee-chip .avatar {
  width: 22px;
  height: 22px;
  border-width: 1px;
  font-size: 8.5px;
}

.attendee-chip.is-me {
  border-color: rgba(201, 71, 34, 0.28);
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.attendee-chip .me-label {
  color: var(--accent);
  font-size: 9px;
  font-weight: 700;
}

.declined-section {
  margin-top: 15px;
}

.declined-section .attendee-chip {
  background: var(--surface-2);
  color: var(--muted);
}

.declined-section .attendee-section-head h3 {
  color: var(--muted);
}

.detail-creator {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 11px;
}

.detail-creator .avatar {
  width: 22px;
  height: 22px;
  border-width: 1px;
  font-size: 8.5px;
}

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

.detail-actions .btn {
  min-height: 36px;
  padding: 8px 13px;
  font-size: 11.5px;
}

.detail-actions .icon {
  width: 14px;
  height: 14px;
}

.detail-actions .danger-text {
  color: var(--danger);
}

.detail-actions .danger-text:hover {
  border-color: rgba(168, 50, 39, 0.16);
  background: var(--danger-soft);
  color: var(--danger);
}

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

.delete-confirm {
  margin-top: 14px;
  padding: 13px;
  border: 1px solid rgba(168, 50, 39, 0.18);
  border-radius: 13px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 11.5px;
  line-height: 1.6;
}

.delete-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 11px;
}

/* ---------- profile / recovery ---------- */

.profile-summary {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 2px 0 18px;
  border-bottom: 1px dashed var(--line);
}

.profile-summary strong {
  display: block;
  font-size: 19px;
  font-weight: 750;
  letter-spacing: -0.03em;
}

.profile-summary p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.profile-actions {
  margin-top: 4px;
}

.profile-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  padding: 14px 2px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.profile-action > span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profile-action strong {
  font-size: 13px;
  font-weight: 680;
}

.profile-action small {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 400;
}

.profile-action .icon {
  width: 17px;
  height: 17px;
  flex: none;
  color: var(--muted);
  transition: color 0.16s var(--ease);
}

.profile-action:hover {
  color: var(--accent);
}

.profile-action:hover .icon {
  color: var(--accent);
}

.profile-action.danger {
  color: var(--danger);
}

.profile-action.danger .icon,
.profile-action.danger small {
  color: var(--danger);
}

.inline-confirm {
  margin-top: 16px;
  padding: 13px;
  border: 1px solid rgba(168, 50, 39, 0.15);
  border-radius: 13px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 11.5px;
  line-height: 1.65;
}

.inline-confirm p {
  margin: 0;
}

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

.recovery-code-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0;
  padding: 16px;
  border-radius: 16px;
  background: var(--ink);
  color: #fff;
}

.recovery-code-box code {
  overflow-wrap: anywhere;
  font-size: 23px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

#recovery-code[data-ready="false"] {
  color: rgba(255, 255, 255, 0.62);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0;
}

#generate-recovery {
  margin-top: 2px;
}

#recovery-dialog .dialog-foot .btn-primary {
  margin-left: auto;
}

.recovery-code-box .btn-soft {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.recovery-code-box .btn-soft:hover {
  background: rgba(255, 255, 255, 0.16);
}

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

.toast-region {
  position: fixed;
  bottom: calc(22px + env(safe-area-inset-bottom));
  left: 50%;
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(420px, calc(100vw - 32px));
  pointer-events: none;
  transform: translateX(-50%);
}

.toast {
  max-width: 100%;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 16px 40px -18px rgba(36, 35, 31, 0.7);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
  animation: toast-in 0.2s var(--ease);
}

.toast.is-error {
  background: var(--danger);
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.noscript {
  position: fixed;
  inset: auto 16px 16px;
  padding: 14px;
  border-radius: 12px;
  background: var(--danger-soft);
  color: var(--danger);
  text-align: center;
  font-size: 13px;
}

/* ---------- keyframes ---------- */

@keyframes boot-slide {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(330%);
  }
}

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

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

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

@keyframes shimmer {
  from {
    background-position: 120% 0;
  }
  to {
    background-position: -120% 0;
  }
}

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

@media (min-width: 981px) and (max-height: 1080px) {
  .welcome-art {
    display: none;
  }

  .welcome-intro h1 {
    font-size: clamp(50px, 5.7vw, 74px);
  }
}

@media (max-width: 1040px) {
  .topbar-tag {
    display: none;
  }

  .welcome-layout {
    gap: 48px;
  }
}

@media (max-width: 980px) {
  .welcome-view {
    align-items: flex-start;
    padding: 44px 24px 36px;
  }

  .welcome-layout {
    grid-template-columns: 1fr;
    max-width: 620px;
    gap: 30px;
  }

  .welcome-intro {
    max-width: none;
  }

  .welcome-intro h1 {
    font-size: clamp(44px, 9.5vw, 64px);
    margin: 14px 0 16px;
  }

  .welcome-lead br {
    display: none;
  }

  .feature-list,
  .welcome-art,
  .welcome-foot {
    display: none;
  }

  .welcome-side {
    width: 100%;
    justify-self: stretch;
  }

  .welcome-panel {
    padding: 28px;
  }

  .main-layout {
    grid-template-columns: 1fr;
    padding: 20px 20px 0;
  }

  .calendar-card {
    position: static;
  }

  .new-event-btn {
    display: none;
  }

  .fab {
    display: grid;
  }

  .app-foot {
    padding-bottom: 92px;
  }

  .agenda-card {
    min-height: 360px;
  }

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

@media (max-width: 640px) {
  :root {
    --topbar-h: 62px;
  }

  body {
    font-size: 14px;
  }

  .topbar-inner {
    gap: 12px;
    padding: 0 15px;
  }

  .brand {
    gap: 8px;
  }

  .brand-name {
    font-size: 18px;
  }

  .logo-mark {
    width: 31px;
    height: 31px;
    border-radius: 10px;
  }

  .logo-mark::before,
  .logo-mark::after {
    width: 9px;
    height: 9px;
  }

  .logo-mark::before {
    left: 6px;
  }

  .logo-mark::after {
    right: 6px;
  }

  .user-name,
  .user-chevron {
    display: none;
  }

  .user-chip {
    padding: 3px;
  }

  .avatar-sm {
    width: 32px;
    height: 32px;
  }

  .welcome-view {
    padding: 26px 16px 32px;
  }

  .welcome-layout {
    gap: 24px;
  }

  .brand-hero .brand-name {
    font-size: 21px;
  }

  .logo-mark-lg {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }

  .logo-mark-lg::before,
  .logo-mark-lg::after {
    width: 11px;
    height: 11px;
  }

  .logo-mark-lg::before {
    left: 8px;
  }

  .logo-mark-lg::after {
    right: 8px;
  }

  .welcome-intro h1 {
    margin: 13px 0 13px;
    font-size: clamp(38px, 11.8vw, 47px);
    letter-spacing: -0.06em;
  }

  .welcome-lead {
    font-size: 13.5px;
    line-height: 1.75;
  }

  .welcome-panel {
    padding: 23px 20px;
    border-radius: 24px;
  }

  .text-input {
    font-size: 16px;
  }

  .welcome-panel h2 {
    font-size: 24px;
  }

  .welcome-note {
    margin-top: 17px;
    padding-top: 14px;
  }

  .main-layout {
    gap: 15px;
    padding: 14px 13px 0;
  }

  .calendar-card,
  .agenda-card {
    border-radius: 23px;
  }

  .calendar-card {
    padding: 14px 12px 11px;
  }

  .calendar-head h2 {
    font-size: 22px;
  }

  .calendar-head {
    gap: 8px;
  }

  .section-kicker {
    font-size: 9px;
  }

  .section-sub {
    font-size: 10.5px;
  }

  .calendar-nav .icon-btn {
    width: 29px;
    height: 29px;
  }

  .today-btn {
    height: 29px;
    padding: 0 8px;
    font-size: 10.5px;
  }

  .weekday-row {
    margin-top: 13px;
    font-size: 9px;
  }

  .calendar-grid {
    gap: 2px;
  }

  .day-cell {
    min-height: 44px;
    gap: 3px;
    padding: 5px 2px 4px;
    border-radius: 10px;
  }

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

  .dot {
    width: 4px;
    height: 4px;
  }

  .calendar-foot {
    display: none;
  }

  .legend {
    font-size: 9.5px;
  }

  .agenda-card {
    padding: 17px 15px 20px;
    min-height: 300px;
  }

  .agenda-head {
    align-items: flex-start;
    gap: 8px;
  }

  .agenda-head h2 {
    font-size: 22px;
  }

  .add-day-btn {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 10.5px;
  }

  .add-day-btn .icon {
    width: 14px;
    height: 14px;
  }

  .add-day-btn span {
    display: none;
  }

  .agenda-list {
    gap: 9px;
    margin-top: 16px;
    min-height: 180px;
  }

  .event-card {
    padding: 12px 13px 11px;
    border-radius: 18px;
  }

  .event-title {
    margin: 8px 0 5px;
    font-size: 16px;
  }

  .event-arrow {
    display: none;
  }

  .event-meta {
    gap: 9px;
    font-size: 10.5px;
  }

  .meta-item span {
    max-width: 190px;
  }

  .event-bottom {
    margin-top: 9px;
    padding-top: 9px;
  }

  .avatar {
    width: 26px;
    height: 26px;
    font-size: 9.5px;
  }

  .avatar-stack .more {
    width: 25px;
    height: 25px;
    font-size: 8px;
  }

  .attendee-count {
    font-size: 9.5px;
  }

  .empty-state {
    padding: 24px 12px 22px;
  }

  .empty-art {
    width: 124px;
  }

  .empty-state h3 {
    font-size: 16.5px;
  }

  .empty-state p {
    font-size: 11.5px;
  }

  .app-foot {
    padding: 6px 18px 86px;
    font-size: 9.5px;
  }

  .dialog {
    position: fixed;
    inset: auto 0 0 0;
    width: 100%;
    max-width: none;
    max-height: 94vh;
    max-height: 94dvh;
    margin: 0;
    border-radius: 24px 24px 0 0;
  }

  .dialog[open] {
    animation: sheet-up 0.23s var(--ease);
  }

  .dialog-shell {
    max-height: 94vh;
    max-height: 94dvh;
  }

  .dialog-head {
    padding: 20px 18px 0;
  }

  .dialog-head h2 {
    max-width: none;
    font-size: 21px;
  }

  .dialog-body {
    padding: 16px 18px 15px;
  }

  .dialog-foot {
    padding: 13px 18px calc(13px + env(safe-area-inset-bottom));
  }

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

  .visibility-options {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .visibility-option {
    padding: 10px 11px;
  }

  .comment-input {
    font-size: 16px;
  }

  .detail-dialog {
    width: 100%;
  }

  .detail-body {
    padding-top: 13px;
  }

  .detail-meta {
    padding: 12px 13px;
  }

  .rsvp-panel {
    padding: 13px;
  }

  .recovery-code-box {
    flex-wrap: wrap;
    padding: 14px;
  }

  .recovery-code-box code {
    font-size: 20px;
  }

  .dialog-foot-between {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .dialog-foot-between .link-button {
    margin-right: auto;
  }

  .toast-region {
    bottom: calc(18px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 380px) {
  .welcome-intro h1 {
    font-size: 36px;
  }

  .list-error {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .day-cell {
    min-height: 44px;
  }

  .add-day-btn {
    padding: 7px 8px;
  }

  .rsvp-buttons {
    grid-template-columns: 1fr;
  }
}

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