/* Layout: top bar → sidebar (create, people toggles) beside a full-height FullCalendar */
/* Look: blush paper background, white "printed sheet" panels, black ink, tracked classical capitals */
:root {
  --bg: #ece3da; --surface: #ffffff; --surface-2: #f7f2ed; --fg: #141211; --muted: #6e6560;
  --line: #e7dfd7; --accent: #141211; --accent-fg: #ffffff; --danger: #9b3b2f; --today: #f6efe8;
  --shadow: 0 10px 30px rgba(70, 55, 45, .22);
  --f-display: "Marcellus", Georgia, serif;
  --f-body: "Lora", Georgia, serif;
  --f-mono: "Lora", Georgia, serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 var(--f-body); }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .tiny { font-size: 12px; margin: 0; }
[hidden] { display: none !important; }

.eyebrow { font: 500 12px var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
h1 { font: 700 30px/1.1 var(--f-display); margin: 6px 0 16px; }
h2 { font: 600 16px/1.2 var(--f-display); margin: 0; }

.btn { font: 500 14px var(--f-body); border: 1px solid var(--line); background: var(--surface); color: var(--fg); border-radius: 8px; padding: 8px 14px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.danger { color: var(--danger); }
.btn.danger.armed { background: var(--danger); border-color: var(--danger); color: var(--surface); }
.linkbtn { background: none; border: 0; color: var(--accent); font: 500 13px var(--f-body); cursor: pointer; padding: 2px 4px; }
.linkbtn.left { justify-self: start; padding-left: 0; }
.iconbtn { background: none; border: 0; color: var(--fg); font-size: 20px; cursor: pointer; padding: 4px 8px; border-radius: 6px; }

input, textarea { font: inherit; font-size: 15px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); width: 100%; min-width: 0; }
textarea { resize: vertical; min-height: 72px; }
input[type=color] { width: 28px; height: 28px; padding: 1px; flex: none; cursor: pointer; }
.field { display: grid; gap: 5px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stack { display: grid; gap: 14px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.addrow { display: flex; gap: 8px; margin-top: 10px; }
.err { color: var(--danger); font-size: 13px; margin: 0; min-height: 1em; }

/* auth pages */
body.auth { display: grid; place-items: center; padding: 24px 16px; }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px; width: min(420px, 100%); }
.flash { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); padding: 8px 12px; border-radius: 8px; font-size: 14px; }
code { font-family: var(--f-mono); font-size: 13px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

/* app shell */
body.app { display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 8px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.brand { font: 700 19px var(--f-display); letter-spacing: -.01em; }
.spacer { flex: 1; }
.layout { flex: 1; display: flex; min-height: 0; }
.side { width: 260px; flex: none; padding: 16px; border-right: 1px solid var(--line); background: var(--surface); overflow-y: auto; display: grid; align-content: start; gap: 18px; }
.side .create { width: 100%; padding: 10px; font-size: 15px; }
.side-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.main { flex: 1; min-width: 0; padding: 12px 16px 16px; display: flex; flex-direction: column; }
#calendar { flex: 1; min-height: 520px; }

.people { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.people li { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 8px; }
.people li:hover { background: var(--surface-2); }
.people label { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; cursor: pointer; font-size: 14px; }
.people .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people .you, .people .pending { font-size: 11px; color: var(--muted); }
.people input[type=checkbox] { appearance: none; width: 18px; height: 18px; border-radius: 4px; border: 2px solid var(--c); margin: 0; flex: none; display: grid; place-items: center; cursor: pointer; padding: 0; background: transparent; }
.people input[type=checkbox]:checked { background: var(--c); }
.people input[type=checkbox]:checked::after { content: ""; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.people .only { visibility: hidden; }
.people li:hover .only, .people .only:focus-visible { visibility: visible; }

/* people chips in the editor */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 7px; border-radius: 999px; padding: 5px 12px 5px 8px; border: 1px dashed var(--line); background: transparent; cursor: pointer; font: 500 13px var(--f-body); color: var(--muted); }
.chip .dot { width: 12px; height: 12px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--c); flex: none; }
.chip[aria-pressed="true"] { border-style: solid; border-color: color-mix(in srgb, var(--c) 50%, var(--line)); background: color-mix(in srgb, var(--c) 12%, var(--surface)); color: var(--fg); }
.chip[aria-pressed="true"] .dot { background: var(--c); }
.chip:disabled { cursor: default; }

/* dialog */
.ov { position: fixed; inset: 0; background: rgba(40, 32, 22, .45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.dlg { background: var(--surface); color: var(--fg); border-radius: 14px; width: min(560px, 100%); max-height: calc(100dvh - 32px); overflow: auto; padding: 20px; display: grid; gap: 14px; box-shadow: var(--shadow); }
.dlg-foot { display: flex; gap: 8px; justify-content: space-between; flex-wrap: wrap; align-items: center; }
.dlg-foot .r { display: flex; gap: 8px; margin-left: auto; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 9px 16px; border-radius: 8px; font-size: 14px; z-index: 60; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }

/* FullCalendar theming */
.fc { --fc-border-color: var(--line); --fc-page-bg-color: var(--surface); --fc-neutral-bg-color: var(--surface-2); --fc-today-bg-color: var(--today);
  --fc-button-bg-color: var(--surface); --fc-button-border-color: var(--line); --fc-button-text-color: var(--fg);
  --fc-button-hover-bg-color: var(--surface-2); --fc-button-hover-border-color: var(--muted);
  --fc-button-active-bg-color: var(--surface-2); --fc-button-active-border-color: var(--muted);
  --fc-list-event-hover-bg-color: var(--surface-2); --fc-now-indicator-color: var(--danger);
  background: var(--surface); border-radius: 12px; font-size: 14px; }
.fc .fc-toolbar { gap: 8px; flex-wrap: wrap; }
.fc .fc-toolbar-title { font: 600 22px var(--f-display); }
.fc .fc-button { font: 500 13px var(--f-body); text-transform: none; box-shadow: none !important; }
.fc .fc-button-primary:not(:disabled).fc-button-active { color: var(--accent); font-weight: 600; }
.fc .fc-col-header-cell-cushion, .fc .fc-daygrid-day-number { color: var(--fg); text-decoration: none; }
.fc .fc-timegrid-slot-label, .fc .fc-list-event-time { font-family: var(--f-mono); font-size: 12px; }
.fc .fc-event { cursor: pointer; border-radius: 5px; }
.ev { display: flex; align-items: center; gap: 5px; overflow: hidden; padding: 0 3px; min-width: 0; color: #fff; }
.ev .t { font-family: var(--f-mono); font-size: 11.5px; opacity: .9; flex: none; }
.ev .ttl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.fc-timegrid-event .ev { flex-wrap: wrap; align-items: flex-start; }
.fc-timegrid-event .ev .ttl { white-space: normal; }
.ev .dots { display: inline-flex; flex: none; }
.ev .dots i { width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 0 1.5px #fff; margin-right: -2px; }
.fc-list .ev { color: var(--fg); }
.fc-list .ev .dots i { box-shadow: 0 0 0 1.5px var(--surface); }

/* ---- modern rounded styling ---- */
:root { --f-ui: "Anthropic Sans", "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --r-lg: 18px; --r-md: 12px; --r-sm: 8px; --line: #ece4dc; --shadow: 0 1px 2px rgba(70, 55, 45, .06), 0 8px 28px rgba(70, 55, 45, .10); }
body { font: 15px/1.5 var(--f-ui); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
.eyebrow { font: 500 12px var(--f-ui); letter-spacing: .04em; color: var(--muted); text-transform: none; }
h1 { font: 400 32px/1.15 var(--f-display); letter-spacing: .02em; }
h2 { font: 400 20px/1.2 var(--f-display); letter-spacing: .01em; }
.field > span { font: 500 12.5px var(--f-ui); letter-spacing: 0; text-transform: none; color: var(--muted); }
.brand { font: 400 20px var(--f-display); letter-spacing: .04em; }
.topbar { background: var(--bg); border-bottom-color: transparent; padding: 12px 20px; }
.btn { border-radius: 999px; font: 500 14px var(--f-ui); border-color: #ddd3c9; padding: 8px 16px; }
.btn.primary { padding: 10px 18px; }
.btn.ghost { font: 500 14px var(--f-ui); }
.linkbtn { font: 500 13px var(--f-ui); color: var(--muted); text-decoration: none; border-radius: var(--r-sm); padding: 3px 8px; }
.linkbtn:hover { background: var(--surface-2); color: var(--fg); }
input, textarea { border-radius: var(--r-md); background: var(--surface); font: 15px var(--f-ui); padding: 9px 12px; border-color: #e2d9d0; }
input:focus, textarea:focus { outline: none; border-color: var(--fg); box-shadow: 0 0 0 3px rgba(20, 18, 17, .08); }
.auth-card, .dlg { border-radius: 22px; border: 0; box-shadow: var(--shadow); padding: 32px; }
.auth-card h1, .auth-card .eyebrow, .auth-card .switch { text-align: center; }
.auth-card { width: min(460px, 100%); }
.side { grid-template-columns: minmax(0, 1fr); }
.people .you { white-space: nowrap; flex: none; }
.people { grid-template-columns: minmax(0, 1fr); }
.people li { min-width: 0; gap: 4px; }
.people .only { padding: 2px 6px; display: none; }
.people li:hover .only, .people li:focus-within .only { display: inline-block; }
.fc .off-trip { background: repeating-linear-gradient(135deg, #f1ece7 0 6px, #ebe5df 6px 12px); }
.fc .off-trip .fc-daygrid-day-number, .fc .fc-col-header-cell.off-trip .fc-col-header-cell-cushion { color: #b8aea5; }
.fc .fc-day-today.off-trip .fc-daygrid-day-number { color: var(--surface); }
.trip-grid { display: grid; gap: 8px; }
.trip-dates input { font-size: 13px; padding: 7px 8px; }
.cats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.cat { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 8px; border: 1px solid #e2d9d0; border-radius: var(--r-md); background: var(--surface); color: var(--muted); font: 500 13.5px var(--f-ui); cursor: pointer; }
.cat:hover { border-color: #cfc3b8; color: var(--fg); }
.cat[aria-pressed="true"] { background: var(--fg); border-color: var(--fg); color: var(--surface); }
.cat:disabled { cursor: default; }
.cat-ic { display: inline-flex; flex: none; }
.cat-ic svg { width: 15px; height: 15px; display: block; }
.ev .cat-ic svg { width: 12px; height: 12px; }
.add-person { display: grid; gap: 8px; margin-top: 10px; }
.add-names input { min-width: 0; }
.add-names { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.add-names input { font-size: 14px; padding: 8px 10px; }
.btn.wide { width: 100%; text-decoration: none; }
.or { display: flex; align-items: center; gap: 12px; color: #a2968c; font-size: 13px; margin: 18px 0 14px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-card .tiny { margin-top: 2px; }
.opt { font-style: normal; font-weight: 400; color: #a2968c; margin-left: 4px; }
.code-input { text-transform: uppercase; letter-spacing: .12em; font-variant-numeric: tabular-nums; }
.code-pill { display: inline-flex; align-items: center; gap: 8px; border: 1px solid #ddd3c9; background: var(--surface); border-radius: 999px; padding: 5px 6px 5px 12px; font: 500 13px var(--f-ui); color: var(--muted); }
.code-pill b { color: var(--fg); letter-spacing: .12em; font-weight: 600; }
.code-pill button { border: 0; background: var(--surface-2); color: var(--fg); border-radius: 999px; padding: 3px 10px; font: 500 12px var(--f-ui); cursor: pointer; }
.code-pill button:hover { background: #e9e0d6; }
.welcome { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 14px 18px; margin-bottom: 12px; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; }
.welcome b { letter-spacing: .12em; }
.flash { border-radius: var(--r-md); }
.side { background: transparent; border-right: 0; padding: 12px 8px 16px 20px; overflow-x: hidden; scrollbar-gutter: stable; scrollbar-width: thin; }
.side > section, .side > .field { background: var(--surface); border-radius: var(--r-lg); padding: 14px; box-shadow: var(--shadow); }
.people li { border-radius: var(--r-sm); padding: 6px 8px; }
.people li:hover { background: var(--surface-2); }
.people label { font: 500 14.5px var(--f-ui); }
.people input[type=checkbox] { border-radius: 6px; }
.people input[type=color] { border-radius: 50%; width: 22px; height: 22px; padding: 0; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); overflow: hidden; }
.people input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.people input[type=color]::-webkit-color-swatch { border: 0; border-radius: 50%; }
.people input[type=color]::-moz-color-swatch { border: 0; border-radius: 50%; }
.side-head h2 { font: 600 13px var(--f-ui); letter-spacing: 0; color: var(--muted); }
.chip { border-radius: 999px; font: 500 14px var(--f-ui); }
.toast { border-radius: 999px; font-family: var(--f-ui); background: var(--fg); color: var(--surface); padding: 10px 18px; }
.main { padding: 12px 20px 20px 12px; }

.fc { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 18px 18px 10px; font: 14px var(--f-ui); overflow: hidden; }
.fc .fc-toolbar-title { font: 600 22px var(--f-ui); letter-spacing: -.01em; }
.fc .fc-button { font: 500 13px var(--f-ui); text-transform: none; letter-spacing: 0; padding: 6px 12px; }
.fc .fc-button-group > .fc-button { border-radius: 0; }
.fc .fc-button-group > .fc-button:first-child { border-radius: 999px 0 0 999px; }
.fc .fc-button-group > .fc-button:last-child { border-radius: 0 999px 999px 0; }
.fc .fc-today-button { border-radius: 999px; margin-left: 8px !important; }
.fc .fc-button-primary:not(:disabled).fc-button-active { color: var(--surface); background: var(--fg); border-color: var(--fg); }
.fc .fc-scrollgrid { border-radius: var(--r-md); overflow: hidden; }
.fc .fc-col-header-cell { border-color: transparent; background: var(--surface-2); }
.fc .fc-col-header-cell-cushion { font: 500 12px var(--f-ui); letter-spacing: .03em; color: var(--muted); padding: 8px 4px; }
.fc .fc-daygrid-day-number { font: 500 13px var(--f-ui); padding: 6px 8px; }
.fc .fc-day-today { background: transparent !important; }
.fc .fc-day-today .fc-daygrid-day-number { background: var(--fg); color: var(--surface); border-radius: 999px; min-width: 24px; height: 24px; padding: 0 7px; margin: 4px; display: inline-flex; align-items: center; justify-content: center; }
.fc .fc-day-other .fc-daygrid-day-number { color: #c2b7ae; }
.fc .fc-timegrid-slot-label, .fc .fc-list-event-time { font: 12.5px var(--f-ui); color: var(--muted); }
.fc .fc-list { border-radius: var(--r-md); overflow: hidden; }
.fc .fc-list-day-cushion { background: var(--surface-2); font: 600 13px var(--f-ui); }
.fc .fc-event { border-radius: 6px; border-width: 0; padding: 1px 2px; }
.fc .fc-daygrid-event { margin-top: 2px; }
.ev { font: 500 12.5px var(--f-ui); }
.ev .t { font: 12px var(--f-ui); opacity: .85; }
.ev .ttl { font-weight: 500; }

@media (max-width: 760px) {
  .side { background: var(--bg); padding: 16px; }
  .fc { padding: 10px 8px; border-radius: var(--r-md); }
  .fc .fc-toolbar-title { font-size: 18px; }
}
}

@media (max-width: 760px) {
  .side { position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; width: min(300px, 85vw); box-shadow: var(--shadow); transform: translateX(-105%); transition: transform .2s; }
  body.side-open .side { transform: none; }
  .hide-sm { display: none; }
  .main { padding: 8px; }
  .fc .fc-toolbar-title { font-size: 18px; }
  .row2 { grid-template-columns: 1fr; }
}
@media (min-width: 761px) { body.side-closed .side { display: none; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
