/* Work schedule calendar, modelled on minimals.cc/dashboard/calendar (FullCalendar 6).
   Tokens fall back to Minimal UI values so the admin page, which lacks the --list-* set, renders the same. */
.ws {
  --ws-surface: var(--list-surface, #fff);
  --ws-ink: var(--list-ink, #1c252e);
  --ws-muted: var(--list-muted, #637381);
  --ws-faint: rgba(145, 158, 171, .8);
  --ws-line: rgba(145, 158, 171, .2);
  --ws-weekend: rgba(145, 158, 171, .08);
  --ws-hover: rgba(145, 158, 171, .08);
  --ws-field: rgba(145, 158, 171, .2);
  --ws-shadow: var(--list-shadow, 0 0 2px rgba(145, 158, 171, .2), 0 12px 24px -4px rgba(145, 158, 171, .12));
  --ws-primary: var(--list-primary, #1c252e);
  --ws-on-primary: var(--list-on-primary, #fff);
  --ws-today: #ff5630;
  --ws-overlay: rgba(255, 255, 255, .76);
  --ws-focus: #00a76f;
  --ws-ease: cubic-bezier(.4, 0, .2, 1);
  display: block;
  color: var(--ws-ink);
  font-family: inherit;
}
:root[data-theme="dark"] .ws {
  --ws-surface: var(--list-surface, #1c252e);
  --ws-ink: var(--list-ink, #f4f6f8);
  --ws-muted: var(--list-muted, #a6b1bc);
  --ws-overlay: rgba(20, 26, 33, .72);
  --ws-primary: var(--list-primary, #f4f6f8);
  --ws-on-primary: var(--list-on-primary, #1c252e);
}

/* Category colours: Minimal UI palette; ink is the darker step so chip text stays readable. */
.ws .ws-cat-meeting { --ws-ev: #00b8d9; --ws-ev-ink: #006c9c; }
.ws .ws-cat-business_trip { --ws-ev: #22c55e; --ws-ev-ink: #118d57; }
.ws .ws-cat-reception { --ws-ev: #ffab00; --ws-ev-ink: #b76e00; }
.ws .ws-cat-other { --ws-ev: #919eab; --ws-ev-ink: #454f5b; }
.ws .ws-cat-personal { --ws-ev: #8e33ff; --ws-ev-ink: #5119b7; }
:root[data-theme="dark"] .ws {
  & .ws-cat-meeting { --ws-ev-ink: #61f3f3; }
  & .ws-cat-business_trip { --ws-ev-ink: #77ed8b; }
  & .ws-cat-reception { --ws-ev-ink: #ffd666; }
  & .ws-cat-other { --ws-ev-ink: #c4cdd5; }
  & .ws-cat-personal { --ws-ev-ink: #c684ff; }
}

.ws-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 40px; }
.ws-heading { margin: 0; color: var(--ws-ink); font-size: 24px; font-weight: 700; line-height: 1.5; letter-spacing: 0; }

.ws-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 36px; padding: 6px 12px; border: 0; border-radius: 8px;
  font: inherit; font-size: 14px; font-weight: 700; line-height: 24px; cursor: pointer;
  transition: background-color .2s var(--ws-ease), box-shadow .2s var(--ws-ease), color .2s var(--ws-ease);
}
.ws-btn-primary { background: var(--ws-primary); color: var(--ws-on-primary); }
.ws-btn-primary:hover { background: #454f5b; }
:root[data-theme="dark"] .ws .ws-btn-primary:hover { background: #c4cdd5; }
.ws-btn-primary:disabled { opacity: .48; cursor: default; }
.ws-btn-outline { background: transparent; color: var(--ws-ink); box-shadow: inset 0 0 0 1px rgba(145, 158, 171, .32); }
.ws-btn-outline:hover { background: var(--ws-hover); box-shadow: inset 0 0 0 1px currentColor; }
.ws-btn-today { min-height: 30px; padding: 4px 8px; background: var(--ws-today); color: #fff; font-size: 13px; line-height: 22px; }
.ws-btn-today:hover { background: #b71d18; }
.ws-icon-btn {
  position: relative; display: inline-grid; place-items: center; flex: none;
  width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--ws-muted); cursor: pointer;
  transition: background-color .15s var(--ws-ease), color .15s var(--ws-ease);
}
.ws-icon-btn:hover { background: var(--ws-hover); color: var(--ws-ink); }
.ws :is(button, input, select, textarea, a):focus-visible { outline: 2px solid var(--ws-focus); outline-offset: 2px; }

.ws-card { overflow: hidden; border-radius: 16px; background: var(--ws-surface); box-shadow: var(--ws-shadow); }
.ws-toolbar { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 12px 20px 20px; }
.ws-views { display: flex; gap: 4px; padding: 4px; border-radius: 8px; background: rgba(145, 158, 171, .08); }
.ws-view-btn { width: 32px; height: 32px; border-radius: 6px; }
.ws-view-btn[aria-pressed="true"] { background: var(--ws-surface); color: var(--ws-ink); box-shadow: 0 1px 2px rgba(145, 158, 171, .24), 0 0 0 1px rgba(145, 158, 171, .12); }
.ws-nav { position: absolute; left: 50%; display: flex; align-items: center; gap: 8px; transform: translateX(-50%); }
.ws-title { min-width: 0; margin: 0; color: var(--ws-ink); font-size: 18px; font-weight: 600; line-height: 28px; white-space: nowrap; letter-spacing: 0; }
.ws-actions { display: flex; align-items: center; gap: 8px; }
.ws-filter-badge { position: absolute; top: 4px; right: 4px; display: grid; place-items: center; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--ws-today); color: #fff; font-size: 10px; font-weight: 700; }
.ws-filter-badge[hidden] { display: none; }

/* FullCalendar skin */
.ws .fc { --fc-border-color: var(--ws-line); --fc-page-bg-color: var(--ws-surface); --fc-neutral-bg-color: var(--ws-weekend); --fc-today-bg-color: transparent; --fc-now-indicator-color: var(--ws-today); --fc-highlight-color: rgba(0, 167, 111, .08); --fc-list-event-hover-bg-color: var(--ws-hover); color: var(--ws-ink); font-size: 14px; }
.ws .fc .fc-scrollgrid { border-right: 0; border-left: 0; }
.ws .fc th, .ws .fc td { border-color: var(--ws-line); }
.ws .fc .fc-scrollgrid-section-header > th { border-top: 2px solid var(--ws-line); }
.ws .fc .fc-col-header-cell { background: transparent; }
.ws .fc .fc-col-header-cell-cushion { padding: 12.5px 4px; color: var(--ws-ink); font-size: 14px; font-weight: 600; line-height: 22px; text-decoration: none; }
.ws .fc .fc-day-sat, .ws .fc .fc-day-sun { background: var(--ws-weekend); }
.ws .fc .fc-col-header-cell.fc-day-sat .fc-col-header-cell-cushion, .ws .fc .fc-col-header-cell.fc-day-sun .fc-col-header-cell-cushion { color: var(--ws-muted); }
.ws .fc .fc-daygrid-day-frame { min-height: 76px; }
.ws .fc .fc-daygrid-day-top { flex-direction: row; justify-content: flex-end; }
.ws .fc .fc-daygrid-day-number { display: grid; place-items: center; min-width: 26px; height: 26px; margin: 4px 8px 0 0; padding: 0 4px; border-radius: 13px; color: var(--ws-faint); font-size: 14px; line-height: 26px; text-decoration: none; }
.ws .fc .fc-day-today .fc-daygrid-day-number { background: var(--ws-today); color: #fff; font-weight: 600; }
.ws .fc .fc-day-other .fc-daygrid-day-top { opacity: .48; }
.ws .fc .fc-daygrid-day-events { margin: 4px 0 0; }
.ws .fc .fc-daygrid-event-harness { margin: 0 4px 4px; }
.ws .fc .fc-daygrid-more-link { margin: 0 8px; padding: 0; color: var(--ws-muted); font-size: 12px; font-weight: 500; line-height: 18px; text-decoration: none; }
.ws .fc .fc-daygrid-more-link:hover { background: transparent; color: var(--ws-ink); text-decoration: underline; }
.ws .fc .fc-popover { overflow: hidden; border: 0; border-radius: 10px; background: var(--ws-surface); box-shadow: 0 0 2px rgba(145, 158, 171, .24), -20px 20px 40px -4px rgba(145, 158, 171, .24); }
.ws .fc .fc-popover-header { padding: 8px 12px; background: rgba(145, 158, 171, .08); color: var(--ws-ink); font-weight: 600; }

.ws .fc .fc-event.ws-ev { margin: 0; overflow: hidden; border: 0; border-radius: 6px; background: var(--ws-ev); box-shadow: none; cursor: pointer; transition: filter .2s var(--ws-ease); }
.ws .fc .fc-event.ws-ev .fc-event-main { padding: 2px 6px; border-radius: 6px; background: var(--ws-overlay); color: var(--ws-ev-ink); font-size: 13px; line-height: 19.5px; }
.ws .fc .fc-event.ws-ev .fc-event-main-frame { color: var(--ws-ev-ink); }
.ws .fc .fc-event.ws-ev .fc-event-time { flex: none; margin-right: 4px; font-weight: 700; overflow: visible; }
.ws .fc .fc-event.ws-ev .fc-event-title { overflow: hidden; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.ws .fc .fc-event.ws-ev:hover { filter: brightness(.94); }
.ws .fc .fc-daygrid-dot-event .fc-daygrid-event-dot { display: none; }
.ws .fc .fc-timegrid-event.ws-ev .fc-event-main { height: 100%; }
.ws .fc .fc-timegrid-slot { height: 40px; }
.ws .fc .fc-timegrid-slot-label-cushion, .ws .fc .fc-timegrid-axis-cushion { color: var(--ws-muted); font-size: 12px; }
.ws .fc .fc-timegrid-col.fc-day-today { background: rgba(255, 86, 48, .04); }

.ws .fc .fc-list { border: 0; }
.ws .fc .fc-list-day-cushion { padding: 8px 20px; background: rgba(145, 158, 171, .08); color: var(--ws-ink); font-size: 14px; font-weight: 600; }
.ws .fc .fc-list-day-cushion a { color: inherit; text-decoration: none; }
.ws .fc .fc-list-event td { padding: 12px 20px; border-color: var(--ws-line); font-size: 14px; }
.ws .fc .fc-list-event-time { color: var(--ws-muted); }
.ws .fc .fc-list-event.ws-ev { background: transparent; cursor: pointer; }
.ws .fc .fc-list-event-dot { border-color: var(--ws-ev); }
.ws .fc .fc-list-empty { background: transparent; color: var(--ws-muted); }

/* Filter drawer */
.ws-drawer-backdrop, .ws-modal-backdrop { position: fixed; inset: 0; z-index: 1300; background: rgba(28, 37, 46, .48); }
.ws-drawer-backdrop { background: transparent; }
.ws-drawer-backdrop[hidden], .ws-modal-backdrop[hidden], .ws-toast[hidden], .ws [hidden] { display: none; }
.ws-drawer {
  position: absolute; top: 0; right: 0; bottom: 0; display: flex; flex-direction: column;
  width: min(320px, 100%); background: var(--ws-surface);
  box-shadow: -40px 40px 80px -8px rgba(145, 158, 171, .24);
  animation: ws-drawer-in .22s var(--ws-ease);
}
.ws-drawer-head { display: flex; align-items: center; gap: 4px; padding: 16px 8px 16px 20px; }
.ws-drawer-head h3 { flex: 1; margin: 0; font-size: 18px; font-weight: 600; letter-spacing: 0; }
.ws-drawer-body { flex: 1; overflow-y: auto; padding: 0 20px 24px; border-top: 1px dashed var(--ws-line); }
.ws-drawer-body section { padding: 20px 0 0; }
.ws-drawer-body h4 { margin: 0 0 12px; color: var(--ws-ink); font-size: 14px; font-weight: 600; letter-spacing: 0; }
.ws-event-list { display: grid; margin: 0 -20px; padding: 0; list-style: none; }
.ws-event-item { position: relative; display: grid; gap: 2px; padding: 12px 20px 12px 28px; border-bottom: 1px dashed var(--ws-line); }
.ws-event-item::before { content: ""; position: absolute; top: 14px; left: 14px; width: 0; height: 0; border-top: 8px solid var(--ws-ev); border-right: 8px solid transparent; }
.ws-event-item-time { color: var(--ws-muted); font-size: 12px; }
.ws-event-item strong { font-size: 14px; font-weight: 600; }
.ws-empty { padding: 12px 20px; color: var(--ws-muted); font-size: 13px; list-style: none; }
@keyframes ws-drawer-in { from { transform: translateX(100%); } to { transform: none; } }

/* Dialogs */
.ws-modal-backdrop { display: grid; place-items: center; padding: 16px; }
.ws-modal {
  display: flex; flex-direction: column; width: min(480px, 100%); max-height: calc(100dvh - 32px);
  overflow: hidden; border-radius: 16px; background: var(--ws-surface); color: var(--ws-ink);
  box-shadow: -40px 40px 80px -8px rgba(0, 0, 0, .24);
  animation: ws-modal-in .2s var(--ws-ease);
}
.ws-modal-head { display: flex; align-items: center; gap: 8px; padding: 24px 24px 16px; }
.ws-modal-head h3 { flex: 1; margin: 0; font-size: 18px; font-weight: 600; line-height: 28px; letter-spacing: 0; }
.ws-delete-btn:hover { background: rgba(255, 86, 48, .08); color: #b71d18; }
.ws-modal-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; margin: 0; padding: 20px 24px; overflow-x: hidden; overflow-y: auto; background: rgba(145, 158, 171, .04); }
.ws .ws-field input { min-width: 0; }
.ws-modal-foot { display: flex; justify-content: flex-end; gap: 12px; padding: 24px; }
@keyframes ws-modal-in { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }

.ws-field { position: relative; display: grid; gap: 6px; margin: 0; min-width: 0; }
.ws-field > span { color: var(--ws-muted); font-size: 12px; font-weight: 600; line-height: 1; }
.ws-field b { font-weight: 600; }
.ws :is(.ws-field input, .ws-field textarea, .ws-field select, .ws-attendee-search) {
  width: 100%; min-height: 54px; padding: 16px 14px; box-sizing: border-box;
  border: 0; border-radius: 8px; background: var(--ws-field); color: var(--ws-ink);
  font: inherit; font-size: 15px; line-height: 1.4375;
  transition: background-color .2s var(--ws-ease), box-shadow .2s var(--ws-ease);
}
.ws .ws-field textarea { min-height: 96px; resize: vertical; }
.ws :is(.ws-field input, .ws-field textarea, .ws-field select, .ws-attendee-search):hover { background: rgba(145, 158, 171, .28); }
.ws :is(.ws-field input, .ws-field textarea, .ws-field select, .ws-attendee-search):focus { outline: 0; background: rgba(145, 158, 171, .16); box-shadow: inset 0 0 0 2px var(--ws-ink); }
.ws-field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ws-fieldset { margin: 0; padding: 0; border: 0; }
.ws-fieldset legend { margin-bottom: 10px; color: var(--ws-muted); font-size: 12px; font-weight: 600; }
.ws-category-list { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.ws-category { display: inline-flex; align-items: center; gap: 8px; color: var(--ws-ink); font-size: 14px; cursor: pointer; }
.ws-category input { position: absolute; opacity: 0; pointer-events: none; }
.ws-dot { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--ws-ev); box-shadow: inset 0 0 0 2px var(--ws-surface); outline: 2px solid transparent; transition: outline-color .15s var(--ws-ease); }
.ws-category input:checked + .ws-dot { outline-color: var(--ws-ev); }
.ws-category input:checked + .ws-dot::after { content: ""; width: 8px; height: 4px; margin-top: -2px; border-bottom: 2px solid #fff; border-left: 2px solid #fff; transform: rotate(-45deg); }
.ws-category input:focus-visible + .ws-dot { outline-color: var(--ws-focus); }

.ws-switch { position: relative; display: inline-flex; align-items: center; gap: 10px; color: var(--ws-ink); font-size: 14px; cursor: pointer; }
.ws-switch input { position: absolute; opacity: 0; }
.ws-switch-track { position: relative; flex: none; width: 33px; height: 20px; border-radius: 10px; background: rgba(145, 158, 171, .48); transition: background-color .2s var(--ws-ease); }
.ws-switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .2s var(--ws-ease); }
.ws-switch input:checked + .ws-switch-track { background: var(--ws-focus); }
.ws-switch input:checked + .ws-switch-track::after { transform: translateX(13px); }
.ws-switch input:focus-visible + .ws-switch-track { outline: 2px solid var(--ws-focus); outline-offset: 2px; }

.ws .ws-attendee-search { min-height: 44px; padding: 10px 14px; }
.ws-attendee-list { max-height: 200px; margin: 0; padding: 4px; overflow-y: auto; border-radius: 8px; background: var(--ws-surface); box-shadow: inset 0 0 0 1px var(--ws-line); list-style: none; }
.ws-attendee-list label { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.ws-attendee-list label:hover { background: var(--ws-hover); }
.ws-attendee-list input { grid-row: span 2; width: 16px; height: 16px; accent-color: var(--ws-focus); }
.ws-attendee-list span { font-size: 14px; }
.ws-attendee-list small { color: var(--ws-muted); font-size: 12px; }
.ws-note { margin: 0; color: var(--ws-muted); font-size: 13px; }
.ws-error { margin: 0; padding: 10px 12px; border-radius: 8px; background: rgba(255, 86, 48, .12); color: #b71d18; font-size: 14px; }
:root[data-theme="dark"] .ws .ws-error { color: #ffac82; }

.ws-details > div { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; }
.ws-details dt { color: var(--ws-muted); font-size: 13px; }
.ws-details dd { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.ws-chip { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: 6px; background: color-mix(in srgb, var(--ws-ev) 16%, transparent); color: var(--ws-ev-ink); font-size: 12px; font-weight: 700; }

.ws-toast { position: fixed; right: 24px; bottom: 24px; z-index: 1400; max-width: min(360px, calc(100vw - 32px)); padding: 12px 16px; border-radius: 10px; background: var(--ws-primary); color: var(--ws-on-primary); font-size: 14px; font-weight: 500; box-shadow: 0 8px 16px rgba(0, 0, 0, .16); }
.ws-toast[data-tone="error"] { background: #b71d18; color: #fff; }
body.ws-modal-open { overflow: hidden; }

@media (max-width: 720px) {
  .ws-head { margin-bottom: 20px; }
  .ws-heading { font-size: 20px; }
  .ws-toolbar { flex-wrap: wrap; padding: 12px; }
  .ws-nav { position: static; order: 3; width: 100%; justify-content: space-between; transform: none; }
  .ws-title { font-size: 16px; }
  .ws-field-row { grid-template-columns: minmax(0, 1fr); }
  .ws .fc .fc-daygrid-day-frame { min-height: 56px; }
  .ws .fc .fc-col-header-cell-cushion { padding: 8px 2px; font-size: 12px; }
  .ws-modal-head, .ws-modal-body, .ws-modal-foot { padding-inline: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .ws *, .ws-drawer, .ws-modal { animation: none !important; transition: none !important; }
}
