@font-face {
  font-family: "Vallamand Playfair";
  src: url("/assets/fonts/PlayfairDisplay-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Vallamand Playfair";
  src: url("/assets/fonts/PlayfairDisplay-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}
:root {
  color-scheme: light;
  --cream: #f7f5f1;
  --wine: #702b3d;
  --muted: #8b898b;
  --card: rgba(255, 255, 255, .88);
  --line: rgba(112, 43, 61, .10);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  background: var(--cream);
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--cream); overscroll-behavior-y: contain; }
body { margin: 0; min-height: 100vh; background: var(--cream); color: #242124; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
.app-shell { max-width: 1040px; min-height: 100vh; margin: 0 auto; padding: calc(12px + var(--safe-top)) 18px calc(34px + var(--safe-bottom)); }
.brand-header { display: flex; align-items: center; gap: 11px; margin: 5px 0 25px; }
.brand-mark { width: 42px; height: 42px; object-fit: cover; border-radius: 12px; }
.brand-header h1 { margin: 0; color: var(--wine); font: 600 19px/1.2 "Vallamand Playfair", Georgia, serif; }
.brand-header p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.card { border-radius: 22px; background: var(--card); box-shadow: 0 2px 18px rgba(56, 39, 44, .035); }
.hidden { display: none !important; }
.gate { max-width: 520px; margin: 12vh auto 0; padding: 26px 23px; text-align: center; }
.gate h2, .page-heading h2 { color: var(--wine); font: 600 32px/1.12 "Vallamand Playfair", Georgia, serif; margin: 0; }
.gate p, .page-heading p { margin: 8px 0 18px; color: var(--muted); line-height: 1.45; }
#apple-sign-in-button, #apple-sign-out-button { min-height: 42px; display: flex; justify-content: center; align-items: center; }
#apple-sign-in-button button, #apple-sign-out-button button { max-width: 100%; }
.secondary-button { margin-top: 13px; padding: 11px 17px; color: var(--wine); background: #f1e7e9; border: 0; border-radius: 13px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 2px 0 17px; }
.page-heading p { margin: 6px 0 0; }
.icon-button { width: 44px; height: 44px; border: 0; border-radius: 15px; background: var(--wine); color: white; font-size: 30px; line-height: 1; display: grid; place-items: center; }
.icon-button:disabled { opacity: .68; }
.icon-button.spinning span { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.calendar-card { padding: 12px 11px 14px; overflow: hidden; touch-action: pan-y; }
.month-header { height: 43px; display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; margin: 0 0 10px; color: var(--wine); }
.month-header h3 { margin: 0; text-align: center; font-size: 20px; font-weight: 650; }
.month-arrow { width: 42px; height: 42px; border: 0; background: transparent; color: var(--wine); font-size: 38px; line-height: .8; font-weight: 300; }
.weekday-row, .week-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.weekday-row { margin: 0 2px 7px; color: var(--muted); font-size: 12px; font-weight: 650; text-align: center; }
.month-grid { display: grid; gap: 5px; }
.week-row { position: relative; height: 78px; }
.week-days { position: absolute; inset: 0; }
.day-cell { position: relative; display: flex; align-items: flex-start; justify-content: center; padding: 7px 2px 0; height: 78px; border: 1px solid rgba(65, 51, 55, .045); border-radius: 12px; background: var(--event-tint, rgba(255,255,255,.70)); font-size: 14px; z-index: 0; }
.day-cell.outside-month { color: #b1afb0; background: rgba(246, 244, 242, .62); }
.day-cell.today { border: 1.5px solid rgba(112, 43, 61, .52); }
.day-cell:focus-visible, button:focus-visible { outline: 2px solid #b8657e; outline-offset: 2px; }
.week-bars { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.event-bar { position: absolute; top: calc(30px + var(--lane) * 15px); left: calc((100% / 7) * var(--first-column) + 2px); width: calc((100% / 7) * var(--column-count) - 4px); height: 14px; padding: 0 5px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; border: 1px solid color-mix(in srgb, var(--bar-color), #fff 14%); border-radius: 8px; color: #291c20; background: color-mix(in srgb, var(--bar-color), #fff 72%); box-shadow: 0 1px 2px rgba(45, 30, 35, .12); font-size: 9px; font-weight: 700; line-height: 12px; }
.calendar-tools { display: flex; align-items: center; gap: 8px; margin: 14px 3px 23px; }
.legend { display: grid; grid-template-columns: repeat(2, minmax(0, auto)); gap: 9px 14px; color: var(--muted); font-size: 12px; }
.legend span { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.legend i, .upcoming-card > i { width: 9px; height: 9px; flex: 0 0 auto; display: inline-block; border-radius: 50%; background: var(--legend-color, var(--event-dot)); }
.today-button { width: 52px; height: 52px; flex: 0 0 auto; margin-left: auto; border: 1.5px solid rgba(112,43,61,.22); border-radius: 50%; background: white; color: var(--wine); display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 0; }
.today-button span { font-size: 10px; font-weight: 750; }
.today-button strong { font-size: 17px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin: 0 2px 10px; }
.section-heading h3 { margin: 0; font: 600 24px/1.1 "Vallamand Playfair", Georgia, serif; color: #211b1e; }
.upcoming-list { display: grid; gap: 8px; }
.upcoming-card, .empty-card { display: flex; align-items: center; gap: 12px; min-height: 68px; padding: 12px 13px; border-radius: 17px; background: var(--card); }
.upcoming-card > i { width: 10px; height: 10px; margin: 0 3px; }
.upcoming-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.upcoming-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.upcoming-main span { color: var(--muted); font-size: 13px; }
.upcoming-card time { max-width: 42%; color: var(--muted); text-align: right; font-size: 12px; line-height: 1.25; }
.empty-card { justify-content: center; color: var(--muted); }
.updated-at { margin: 20px 0 0; text-align: center; color: #9b999a; font-size: 12px; }
.sync-status { min-height: 16px; margin: 7px 0 0; text-align: center; color: #9b999a; font-size: 11px; }
.offline-banner { position: fixed; left: 15px; right: 15px; bottom: calc(12px + var(--safe-bottom)); z-index: 5; padding: 12px 15px; border-radius: 14px; color: white; background: #3e3337; box-shadow: 0 4px 20px rgba(0,0,0,.18); text-align: center; font-size: 13px; }
.refresh-indicator { position: fixed; z-index: 10; top: calc(7px + var(--safe-top)); left: 50%; opacity: 0; transform: translate(-50%, -14px); transition: opacity .2s ease, transform .2s ease; pointer-events: none; }
.refresh-indicator.visible { opacity: 1; transform: translate(-50%, 0); }
.refresh-indicator span { display: block; width: 24px; height: 24px; border: 2px solid #d8c6cb; border-top-color: var(--wine); border-radius: 50%; animation: spin .7s linear infinite; }
@media (min-width: 760px) {
  .app-shell { padding: calc(26px + var(--safe-top)) 28px calc(40px + var(--safe-bottom)); }
  .brand-header { margin-bottom: 32px; }
  .page-heading h2 { font-size: 38px; }
  .calendar-card { padding: 18px 18px 20px; }
  .week-row, .day-cell { height: 100px; }
  .day-cell { padding: 10px 8px; justify-content: flex-start; font-size: 16px; }
  .event-bar { top: calc(40px + var(--lane) * 18px); height: 16px; line-height: 14px; font-size: 10px; }
  .weekday-row { font-size: 14px; margin-bottom: 10px; }
  .month-grid { gap: 7px; }
  .legend { grid-template-columns: repeat(3, minmax(0, auto)); font-size: 13px; }
  .upcoming-card { padding: 15px 18px; }
  .upcoming-card time { font-size: 14px; }
}
@media (prefers-color-scheme: dark) {
  :root { color-scheme: dark; --cream: #211f21; --wine: #d7829a; --muted: #aaa7aa; --card: rgba(51, 47, 50, .96); --line: rgba(215,130,154,.16); }
  body, html { background: var(--cream); color: #f3eff0; }
  .brand-header h1, .gate h2, .page-heading h2, .month-header, .month-arrow, .today-button, .section-heading h3 { color: var(--wine); }
  .calendar-card, .upcoming-card, .empty-card, .gate { background: var(--card); }
  .day-cell { color: #f3eff0; border-color: rgba(255,255,255,.07); background: var(--event-tint, rgba(255,255,255,.035)); }
  .day-cell.outside-month { color: #7b777a; background: rgba(0,0,0,.12); }
  .today-button { background: #322d30; border-color: rgba(215,130,154,.28); }
  .event-bar { color: #211b1e; }
}
