:root {
  --ink: #0e2a3b;
  --blue: #3b97c9;
  --blue-deep: #2b7fae;
  --blue-soft: #e8f3fa;
  --gold: #f2b705;
  --text: #1f2a33;
  --muted: #5f6f7a;
  --line: #dbe3e9;
  --hover: #f1f5f8;
  --bg: #ffffff;
  --danger: #c62828;
  --fc-border-color: #e3e9ee;
  --fc-today-bg-color: transparent;
  --fc-now-indicator-color: #f2b705;
  --fc-page-bg-color: #ffffff;
  --fc-neutral-bg-color: #f6f8fa;
  --fc-list-event-hover-bg-color: #f1f5f8;
  --fc-highlight-color: rgba(59, 151, 201, .12);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }

/* brand */
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; margin-right: 18px; }
.brand img { width: 36px; height: 36px; }
.brand-name { font-size: 21px; font-weight: 600; color: var(--blue); letter-spacing: -.2px; white-space: nowrap; margin: 0; }
.brand-name .x { color: var(--gold); }
.brand-name .product { color: var(--muted); font-weight: 400; margin-left: 5px; }
.brand-name.big { font-size: 30px; }

/* sign in */
.signin { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; background: linear-gradient(180deg, #f5f9fc 0%, #ffffff 60%); }
.signin-card { width: 100%; max-width: 420px; text-align: center; padding: 40px 28px 34px; }
.signin-logo { width: 76px; height: 76px; }
.signin-text { color: var(--muted); font-size: 16px; line-height: 1.55; margin: 10px auto 28px; max-width: 30ch; }
.gbtn { display: flex; justify-content: center; min-height: 44px; }
.signin-msg { color: var(--danger); font-size: 14px; min-height: 20px; margin-top: 14px; }
.signin-foot { color: var(--muted); font-size: 12px; margin-top: 24px; }

/* layout */
.app { height: 100%; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 6px; height: 64px; flex: none;
  padding: 0 14px; padding-top: env(safe-area-inset-top, 0px);
  border-bottom: 1px solid var(--line); background: #fff;
}
.spacer { flex: 1; }
.range-title { font-size: 21px; font-weight: 500; color: var(--ink); margin: 0 0 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-arrows { display: flex; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: transparent; color: var(--muted);
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.small { width: 28px; height: 28px; }
.pill-btn {
  height: 38px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; font-weight: 500; margin: 0 6px;
}
.pill-btn:hover { background: var(--hover); }
.view-select select {
  height: 38px; border: 1px solid var(--line); border-radius: 999px; padding: 0 34px 0 16px; background: #fff;
  font-weight: 500; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%235f6f7a' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.account { position: relative; margin-left: 10px; }
.avatar-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 0; padding: 0; overflow: hidden;
  background: var(--blue); color: #fff; font-weight: 600; display: grid; place-items: center;
}
.avatar-btn img { width: 100%; height: 100%; object-fit: cover; }
.account-menu {
  position: absolute; right: 0; top: 46px; z-index: 30; width: 260px; background: #fff;
  border-radius: 12px; box-shadow: 0 8px 28px rgba(14, 42, 59, .18); padding: 16px 0 8px;
}
.account-name { font-weight: 600; padding: 0 18px; }
.account-email { color: var(--muted); font-size: 13px; padding: 0 18px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; word-break: break-all; }
.menu-link { display: block; width: 100%; text-align: left; padding: 10px 18px; border: 0; background: none; text-decoration: none; color: var(--text); font-size: 14px; }
.menu-link:hover { background: var(--hover); }

.body { flex: 1; display: flex; min-height: 0; position: relative; }
.sidebar {
  width: 256px; flex: none; padding: 14px 14px 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 18px;
  transition: margin-left .2s ease;
}
.app.side-closed .sidebar { margin-left: -256px; }
.cal-wrap { flex: 1; min-width: 0; padding: 6px 14px 10px 4px; }
#calendar { height: 100%; }

.create-btn {
  align-self: flex-start; display: flex; align-items: center; gap: 10px;
  height: 54px; padding: 0 22px 0 16px; border: 0; border-radius: 16px;
  background: #fff; box-shadow: 0 1px 3px rgba(14, 42, 59, .2), 0 4px 10px rgba(14, 42, 59, .08);
  font-weight: 500; font-size: 15px; color: var(--ink);
}
.create-btn svg { color: var(--blue); }
.create-btn:hover { background: var(--blue-soft); }

/* mini calendar */
.mini-head { display: flex; align-items: center; justify-content: space-between; font-size: 14px; font-weight: 500; padding: 0 2px 4px 6px; }
.mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 11px; row-gap: 2px; }
.mini-grid .wd { color: var(--muted); font-weight: 500; padding: 4px 0; }
.mini-grid button {
  width: 28px; height: 28px; margin: 0 auto; border-radius: 50%; border: 0; background: none; font-size: 11px; padding: 0;
}
.mini-grid button:hover { background: var(--hover); }
.mini-grid button.out { color: #a5b2bb; }
.mini-grid button.in-range { background: var(--blue-soft); }
.mini-grid button.today { background: var(--blue); color: #fff; font-weight: 600; }
.mini-grid button.sel:not(.today) { background: #cfe6f3; color: var(--ink); font-weight: 600; }

.upcoming h3 { font-size: 14px; font-weight: 500; margin: 0 0 6px 6px; color: var(--ink); }
.upcoming ul { list-style: none; margin: 0; padding: 0; }
.upcoming li button {
  display: grid; grid-template-columns: 10px 1fr; gap: 2px 10px; width: 100%; text-align: left;
  border: 0; background: none; padding: 7px 6px; border-radius: 8px; font-size: 13px;
}
.upcoming li button:hover { background: var(--hover); }
.upcoming .u-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; grid-row: span 2; }
.upcoming .u-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upcoming .u-when { color: var(--muted); font-size: 12px; }
.upcoming .u-empty { color: var(--muted); font-size: 13px; padding: 4px 6px; }
.side-foot { margin-top: auto; font-size: 11px; color: #9aa8b2; padding: 0 6px; }

.scrim { position: absolute; inset: 0; background: rgba(14, 42, 59, .3); z-index: 19; }
.fab {
  display: none; position: fixed; right: 18px; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 15;
  width: 58px; height: 58px; border-radius: 18px; border: 0; background: #fff; color: var(--blue);
  box-shadow: 0 2px 6px rgba(14, 42, 59, .25), 0 8px 20px rgba(14, 42, 59, .15);
  place-items: center;
}

/* FullCalendar look */
.fc { font-size: 13px; }
.fc .fc-col-header-cell-cushion { color: var(--muted); font-weight: 500; text-decoration: none; padding: 8px 4px; text-transform: none; }
.fc .fc-daygrid-day-number { color: var(--text); text-decoration: none; font-size: 12px; padding: 6px 8px; }
.fc .fc-day-today .fc-daygrid-day-number { background: var(--blue); color: #fff; border-radius: 50%; min-width: 26px; height: 26px; display: grid; place-items: center; padding: 0; margin: 4px; font-weight: 600; }
.fc .fc-timegrid-slot { height: 2.6em; }
.fc .fc-timegrid-slot-label-cushion, .fc .fc-timegrid-axis-cushion { color: var(--muted); font-size: 11px; }
.fc .fc-timegrid-now-indicator-line { border-width: 2px 0 0; }
.fc .fc-timegrid-now-indicator-arrow { border-color: var(--gold); border-top-color: transparent; border-bottom-color: transparent; }
.fc-theme-standard .fc-scrollgrid { border: 0; }
.fc-theme-standard td, .fc-theme-standard th { border-color: var(--fc-border-color); }
.fc .fc-timegrid-event, .fc .fc-daygrid-block-event { border-radius: 6px; padding: 1px 3px; }
.fc .fc-event { cursor: pointer; }
.fc .fc-event-title { font-weight: 500; }
.fc .fc-timegrid-event .fc-event-time { font-size: 11px; }
.fc .sx-pending { background: #fff !important; }
.fc .sx-pending .fc-event-main, .fc .sx-pending .fc-event-title, .fc .sx-pending .fc-event-time { color: var(--ink) !important; }
.fc .sx-tentative { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.25) 0 6px, transparent 6px 12px); }
.fc .sx-declined { opacity: .55; }
.fc .sx-declined .fc-event-title { text-decoration: line-through; }
.fc .fc-list-event-title a { text-decoration: none; color: var(--text); }
.fc .fc-list-day-cushion { background: #f6f8fa; }
.fc .fc-list-empty { background: #fff; }
.fc-col-header-cell.fc-day-today .fc-col-header-cell-cushion { color: var(--blue); font-weight: 600; }
.fc .fc-daygrid-more-link { color: var(--blue); font-weight: 500; }
.fc .fc-highlight { background: var(--fc-highlight-color); }

/* dialogs */
.dlg {
  border: 0; border-radius: 16px; padding: 0; width: min(520px, calc(100vw - 24px));
  max-height: calc(100dvh - 32px); box-shadow: 0 18px 50px rgba(14, 42, 59, .28); color: var(--text);
}
.dlg::backdrop { background: rgba(14, 42, 59, .32); }
.dlg-tools { display: flex; align-items: center; justify-content: flex-end; gap: 2px; padding: 8px 8px 0 18px; }
.dlg-heading { font-size: 16px; font-weight: 500; margin: 0 auto 0 0; color: var(--muted); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 16px; flex-wrap: wrap; }
.primary-btn {
  height: 40px; padding: 0 22px; border-radius: 999px; border: 0; background: var(--blue); color: #fff; font-weight: 600;
}
.primary-btn:hover { background: var(--blue-deep); }
.primary-btn:disabled { opacity: .6; cursor: default; }
.ghost-btn { height: 40px; padding: 0 18px; border-radius: 999px; border: 0; background: none; color: var(--blue-deep); font-weight: 600; }
.ghost-btn:hover { background: var(--blue-soft); }
.ghost-btn.danger { color: var(--danger); }
.ghost-btn.danger:hover { background: #fdecec; }
.text-btn { border: 0; background: none; color: var(--blue-deep); font-weight: 600; font-size: 13px; padding: 2px 4px; }

/* detail */
.detail { padding-bottom: 18px; }
.detail-head { display: grid; grid-template-columns: 22px 1fr; gap: 14px; padding: 4px 24px 10px; }
.detail-head h2 { margin: 0 0 4px; font-size: 21px; font-weight: 500; color: var(--ink); line-height: 1.3; word-break: break-word; }
.dot { width: 16px; height: 16px; border-radius: 5px; margin-top: 7px; }
.detail-row { display: grid; grid-template-columns: 22px 1fr; gap: 14px; padding: 10px 24px; align-items: start; font-size: 14px; }
.detail-row > svg { color: var(--muted); margin-top: 2px; }
.detail-row.video .primary-btn { margin-bottom: 6px; }
.link-line { font-size: 13px; color: var(--muted); word-break: break-all; }
.pre { white-space: pre-line; word-break: break-word; }
.guest-sum { color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.guest-list { list-style: none; margin: 0; padding: 0; }
.guest-list li { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; padding: 3px 0; word-break: break-all; }
.g-badge { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; flex: none; color: #fff; }
.g-accepted { background: #0b8043; }
.g-declined { background: var(--danger); }
.g-tentative { background: #8a99a4; }
.g-needsAction { background: #fff; border: 1.5px solid #b5c1c9; color: #8a99a4; }
.g-owner { font-size: 12px; color: var(--muted); white-space: nowrap; }
.rsvp { display: flex; align-items: center; gap: 8px; padding: 14px 24px 0; margin-top: 6px; border-top: 1px solid var(--line); font-size: 14px; flex-wrap: wrap; }
.rsvp span { margin-right: 6px; color: var(--muted); }
.chip-btn { height: 34px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-weight: 500; }
.chip-btn:hover { background: var(--hover); }
.chip-btn.on { background: var(--blue-soft); border-color: var(--blue); color: var(--blue-deep); }

/* edit form */
.edit form { padding: 0 22px 20px; overflow-y: auto; max-height: calc(100dvh - 32px); }
.edit .dlg-tools { padding: 8px 0 0; }
.edit .title-input {
  width: 100%; border: 0; border-radius: 0; box-shadow: none; border-bottom: 2px solid var(--line); font-size: 22px; padding: 8px 2px; margin-bottom: 12px; outline: none;
}
.edit .title-input:focus { border-bottom-color: var(--blue); box-shadow: none; }
.field-row { margin-bottom: 8px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--blue); }
.when-grid { display: grid; grid-template-columns: 1fr 120px; gap: 8px 10px; margin-bottom: 14px; }
.when-grid label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.when-grid .time-only { justify-content: flex-end; }
.when-grid.all-day { grid-template-columns: 1fr 1fr; }
.when-grid.all-day .time-only { display: none; }
input[type=date], input[type=time], input[type=text], input[type=email], select, textarea {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; font-size: 14px; color: var(--text); width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px rgba(59, 151, 201, .15); }
textarea { resize: vertical; }
.video-toggle { display: block; margin-bottom: 14px; cursor: pointer; }
.video-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.vt-box { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px; border: 1px dashed #b9cfdc; color: var(--blue-deep); font-weight: 500; font-size: 14px; }
.video-toggle input:checked + .vt-box { background: var(--blue); border: 1px solid var(--blue); color: #fff; }
.video-toggle input:focus-visible + .vt-box { outline: 2px solid var(--blue); outline-offset: 2px; }
.field { display: block; margin-bottom: 12px; }
.field-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
.chips:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(59, 151, 201, .15); }
.chips input { border: 0; flex: 1; min-width: 160px; padding: 4px; box-shadow: none !important; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--blue-soft); color: var(--ink); border-radius: 999px; padding: 3px 4px 3px 11px; font-size: 13px; max-width: 100%; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip button { border: 0; background: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); padding: 0; }
.chip button:hover { background: rgba(14, 42, 59, .1); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 4px; }
.swatches button { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); padding: 0; }
.swatches button[aria-checked=true] { box-shadow: 0 0 0 2px var(--ink); }
.notify { margin-top: 2px; }
.form-error { color: var(--danger); font-size: 13px; min-height: 18px; margin: 8px 0 0; }

.confirm { padding: 22px 22px 16px; width: min(420px, calc(100vw - 24px)); }
.confirm p { margin: 0; font-size: 15px; line-height: 1.5; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 50;
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 10px; font-size: 14px; max-width: calc(100vw - 32px);
  box-shadow: 0 8px 24px rgba(14, 42, 59, .3);
}

/* tablet and phone */
@media (max-width: 900px) {
  .sidebar {
    position: absolute; top: 0; bottom: 0; left: 0; z-index: 20; background: #fff; margin-left: 0;
    box-shadow: 4px 0 24px rgba(14, 42, 59, .2); transform: translateX(-105%); transition: transform .2s ease;
  }
  .app.side-closed .sidebar { margin-left: 0; }
  .app.side-open .sidebar { transform: none; }
  .cal-wrap { padding: 4px 8px 8px; }
  .fab { display: grid; }
  .create-btn { display: none; }
}
@media (max-width: 640px) {
  .topbar { height: 58px; padding: 0 6px; gap: 2px; }
  .brand { display: none; }
  .nav-arrows .icon-btn { width: 32px; height: 36px; }
  .spacer { display: none; }
  .range-title { font-size: 17px; margin-left: 2px; flex: 1; min-width: 0; }
  .pill-btn { padding: 0 10px; margin: 0 2px; height: 34px; font-size: 14px; }
  .topbar > .icon-btn { width: 36px; }
  .view-select select { height: 34px; padding: 0 24px 0 10px; background-position: right 8px center; font-size: 14px; }
  .account { margin-left: 4px; }
  .avatar-btn { width: 34px; height: 34px; }
  .fc .fc-col-header-cell-cushion { padding: 6px 2px; font-size: 11px; }
  .two { grid-template-columns: 1fr; }
  .when-grid { grid-template-columns: 1fr 110px; }
  .dlg { width: 100vw; max-width: 100vw; max-height: 100dvh; border-radius: 16px 16px 0 0; margin: auto 0 0; }
  .edit form { max-height: 92dvh; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}
.primary-btn.danger-fill { background: var(--danger); }
.primary-btn.danger-fill:hover { background: #a91f1f; }

/* day headers in day and week views */
.fc .dh { display: flex; flex-direction: column; align-items: center; gap: 2px; line-height: 1.1; }
.fc .dh-wd { font-size: 12px; color: var(--muted); font-weight: 500; }
.fc .dh-num { font-size: 22px; font-weight: 400; color: var(--ink); width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; }
.fc .fc-day-today .dh-wd { color: var(--blue); }
.fc .fc-day-today .dh-num { background: var(--blue); color: #fff; font-weight: 500; }
.fc a.fc-col-header-cell-cushion:hover .dh-num { background: var(--hover); }
.fc .fc-day-today a.fc-col-header-cell-cushion:hover .dh-num { background: var(--blue-deep); }
.detail h2:focus { outline: none; }
@media (max-width: 640px) {
  .fc .dh-num { font-size: 17px; width: 32px; height: 32px; }
  .fc .dh-wd { font-size: 11px; }
}
@media (max-width: 640px) {
  .view-select select { width: 92px; }
}
@media (max-width: 420px) {
  .nav-arrows { display: none; }
}
