/* ================================================================
   WORK CALENDAR — Canvas-inspired calendar system
   Monthly grid with events, mini calendar sidebar, category filters
   ================================================================ */

/* ── Main calendar layout ── */
.wkc-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 20px;
  animation: wkFadeUp .35s var(--ease-spring) both;
}

/* ── Calendar header toolbar ── */
.wkc-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  margin-bottom: 8px;
}
.wkc-toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.wkc-month-label {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  min-width: 200px;
}
.wkc-nav-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surf);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink2);
  transition: all .15s ease;
}
.wkc-nav-btn:hover {
  background: var(--wt-neutral-bg);
  color: var(--ink);
}
.wkc-nav-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.wkc-today-btn {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surf);
  color: var(--ink2);
  transition: all .15s ease;
}
.wkc-today-btn:hover {
  background: var(--c-blue-bg);
  color: var(--c-blue);
  border-color: var(--c-blue);
}
.wkc-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.wkc-view-toggle {
  display: inline-flex;
  align-items: center;
  background: var(--wt-neutral-bg, #f1f5f9);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.wkc-view-btn {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--ink3, #64748b);
  cursor: pointer;
  transition: all .15s ease;
}
.wkc-view-btn.is-active {
  background: var(--surf, #fff);
  color: var(--ink, #0f172a);
  box-shadow: 0 1px 3px rgba(15,23,42,.08), 0 0 0 1px rgba(15,23,42,.04);
}
.wkc-view-btn:hover:not(.is-active) {
  color: var(--ink, #0f172a);
}

/* ── Month grid ── */
.wkc-grid-wrap {
  background: var(--surf);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.wkc-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}
.wkc-day-head {
  padding: 10px 8px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink3);
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}
.wkc-day-head.wkc-weekend {
  color: var(--ink4);
}

/* ── Day cells ── */
.wkc-cell {
  height: 110px;
  overflow: hidden;
  padding: 6px;
  border-right: 1px solid #f1f5f9;
  border-bottom: 1px solid #f1f5f9;
  position: relative;
  cursor: pointer;
  transition: background .12s ease;
}
.wkc-cell:nth-child(7n) {
  border-right: none;
}
.wkc-cell:hover {
  background: #fafbfd;
}
.wkc-cell.is-today {
  background: var(--c-blue-bg);
}
.wkc-cell.is-today .wkc-cell-num {
  background: var(--c-blue);
  color: #fff;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wkc-cell.is-outside {
  background: #fafbfc;
}
.wkc-cell.is-outside .wkc-cell-num {
  color: var(--ink4);
}
.wkc-cell-num {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink2);
  margin-bottom: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
}

/* ── Calendar events inside cells ── */
.wkc-event {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  margin-bottom: 2px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1.35;
  cursor: pointer;
  transition: opacity .12s ease;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.wkc-event:hover {
  opacity: .85;
}
/* Event type colors */
.wkc-event--task {
  background: #dbeafe;
  color: #1e40af;
  border-left: 3px solid #3b82f6;
}
.wkc-event--deliverable {
  background: #d1fae5;
  color: #065f46;
  border-left: 3px solid #10b981;
}
.wkc-event--milestone {
  background: #fef3c7;
  color: #92400e;
  border-left: 3px solid #f59e0b;
}
.wkc-event--meeting {
  background: #ede9fe;
  color: #5b21b6;
  border-left: 3px solid #7c3aed;
}
.wkc-event--deadline {
  background: #fee2e2;
  color: #991b1b;
  border-left: 3px solid #ef4444;
}
.wkc-event--program {
  background: #e0f2fe;
  color: #0c4a6e;
  border-left: 3px solid #0ea5e9;
}
.wkc-event--approval {
  background: #f0fdf4;
  color: #166534;
  border-left: 3px solid #22c55e;
}
.wkc-event-icon {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
}
.wkc-event-icon svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}
.wkc-event-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* More events overflow */
.wkc-more {
  font-size: 10px;
  font-weight: 600;
  color: var(--c-blue);
  padding: 2px 6px;
  cursor: pointer;
  border-radius: 4px;
}
.wkc-more:hover {
  background: var(--c-blue-bg);
}

/* ── Right sidebar ── */
.wkc-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Mini calendar */
.wkc-mini {
  background: var(--surf);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}
.wkc-mini-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.wkc-mini-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}
.wkc-mini-nav {
  display: flex;
  gap: 4px;
}
.wkc-mini-nav-btn {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink3);
  transition: all .12s ease;
}
.wkc-mini-nav-btn:hover {
  background: var(--wt-neutral-bg);
  color: var(--ink);
}
.wkc-mini-nav-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}
.wkc-mini-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
}
.wkc-mini-dh {
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--ink4);
  padding: 4px 0;
}
.wkc-mini-d {
  text-align: center;
  font-size: 11px;
  padding: 4px 0;
  border-radius: 6px;
  cursor: pointer;
  color: var(--ink2);
  transition: all .1s ease;
}
.wkc-mini-d:hover {
  background: var(--wt-neutral-bg);
}
.wkc-mini-d.is-today {
  background: var(--c-blue);
  color: #fff;
  font-weight: 700;
}
.wkc-mini-d.is-selected {
  background: var(--c-blue-bg);
  color: var(--c-blue);
  font-weight: 600;
}
.wkc-mini-d.is-outside {
  color: var(--ink4);
  opacity: .5;
}
.wkc-mini-d.has-events::after {
  content: '';
  display: block;
  width: 4px;
  height: 4px;
  background: var(--c-blue);
  border-radius: 50%;
  margin: 1px auto 0;
}

/* ── Calendars / category filter panel ── */
.wkc-calendars {
  background: var(--surf);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}
.wkc-calendars-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink3);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.wkc-calendars-title svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}
.wkc-cal-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .12s ease;
}
.wkc-cal-item:hover {
  background: var(--wt-neutral-bg);
}
.wkc-cal-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}
.wkc-cal-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink2);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wkc-cal-count {
  font-size: 10px;
  font-weight: 600;
  color: var(--ink3);
  background: var(--wt-neutral-bg);
  padding: 2px 6px;
  border-radius: 8px;
}
.wkc-cal-check {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all .12s ease;
}
.wkc-cal-item.is-active .wkc-cal-check {
  border-color: currentColor;
  background: currentColor;
}
.wkc-cal-item.is-active .wkc-cal-check::after {
  content: '';
  width: 8px;
  height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
}

/* ── Upcoming section in sidebar ── */
.wkc-upcoming {
  background: var(--surf);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}
.wkc-upcoming-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink3);
  margin-bottom: 10px;
}
.wkc-upcoming-item {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background .1s ease;
}
.wkc-upcoming-item:last-child {
  border-bottom: none;
}
.wkc-upcoming-item:hover {
  background: #fafbfd;
  border-radius: 6px;
  padding-left: 6px;
  padding-right: 6px;
}
.wkc-upcoming-date {
  flex-shrink: 0;
  width: 40px;
  text-align: center;
}
.wkc-upcoming-date-month {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--c-blue);
  letter-spacing: .04em;
}
.wkc-upcoming-date-day {
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1;
}
.wkc-upcoming-body {
  flex: 1;
  min-width: 0;
}
.wkc-upcoming-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wkc-upcoming-meta {
  font-size: 10px;
  color: var(--ink3);
  margin-top: 2px;
}
.wkc-upcoming-type {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
}

/* ── Week / Agenda view stubs ── */
.wkc-week-grid {
  display: grid;
  grid-template-columns: 60px repeat(7, 1fr);
  background: var(--surf);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.wkc-week-header {
  padding: 10px 6px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink3);
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}
.wkc-agenda-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  transition: background .1s ease;
}
.wkc-agenda-item:hover {
  background: #fafbfd;
}

/* ── Day detail popup ── */
.wkc-day-popup {
  position: fixed;
  z-index: 12000;
  background: var(--surf);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 16px;
  width: 320px;
  max-height: 400px;
  overflow-y: auto;
  animation: wkScaleIn .2s var(--ease-spring) both;
  display: none;
}
.wkc-day-popup.is-open {
  display: block;
}
.wkc-day-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.wkc-day-popup-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}
.wkc-day-popup-close {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink3);
  transition: all .1s ease;
}
.wkc-day-popup-close:hover {
  background: var(--wt-neutral-bg);
  color: var(--ink);
}
.wkc-day-popup-close svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}
.wkc-day-popup-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wkc-day-popup-event {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--wt-neutral-bg);
  cursor: pointer;
  transition: background .12s ease;
}
.wkc-day-popup-event:hover {
  background: #e8edf3;
}
.wkc-day-popup-event-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.wkc-day-popup-event-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  flex: 1;
}
.wkc-day-popup-event-time {
  font-size: 10px;
  color: var(--ink3);
}

/* ── Day popup enhancements ── */
.wkc-day-popup-count {
  font-size: 11px;
  color: var(--ink3);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.wkc-day-group {
  margin-bottom: 12px;
}
.wkc-day-group:last-child {
  margin-bottom: 0;
}
.wkc-day-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: var(--wt-neutral-bg);
  border-radius: 6px;
  margin-bottom: 6px;
}
.wkc-day-group-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.wkc-day-group-label {
  flex: 1;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink2);
}
.wkc-day-group-count {
  font-size: 10px;
  font-weight: 600;
  color: var(--ink4);
  background: var(--surf);
  padding: 2px 8px;
  border-radius: 10px;
}
.wkc-day-popup-event {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surf);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all .15s ease;
}
.wkc-day-popup-event:hover {
  background: var(--wt-neutral-bg);
  border-color: var(--wt-theme-primary, #6366f1);
  transform: translateX(2px);
}
.wkc-day-popup-event-body {
  flex: 1;
  min-width: 0;
}
.wkc-day-popup-event-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wkc-day-popup-event-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
  font-size: 10px;
  color: var(--ink3);
}
.wkc-day-popup-event-proj {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wkc-day-popup-event-priority {
  font-size: 9px;
  font-weight: 600;
  color: #991b1b;
  background: #fee2e2;
  padding: 1px 6px;
  border-radius: 4px;
}
.wkc-day-popup-event-arrow {
  width: 16px;
  height: 16px;
  color: var(--ink4);
  flex-shrink: 0;
  opacity: 0;
  transform: translateX(-4px);
  transition: all .15s ease;
}
.wkc-day-popup-event:hover .wkc-day-popup-event-arrow {
  opacity: 1;
  transform: translateX(0);
}
.wkc-day-popup-event-arrow svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

/* ── Responsive ── */
@media (max-width: 960px) {
  .wkc-layout {
    grid-template-columns: 1fr;
  }
  .wkc-sidebar {
    flex-direction: row;
    overflow-x: auto;
    gap: 12px;
  }
  .wkc-mini, .wkc-calendars, .wkc-upcoming {
    min-width: 250px;
    flex-shrink: 0;
  }
  .wkc-cell {
    min-height: 80px;
  }
}
@media (max-width: 640px) {
  .wkc-cell {
    min-height: 60px;
    padding: 3px;
  }
  .wkc-event {
    font-size: 9px;
    padding: 1px 4px;
  }
  .wkc-cell-num {
    font-size: 10px;
  }
  .wkc-month-label {
    font-size: 16px;
  }
}

/* ════════════════════════════════════════════════════════════════
   v2 layout overrides — Upcoming-only sidebar (no mini cal/cats),
   wider Upcoming, top toolbar with view toggle, Week view
   ════════════════════════════════════════════════════════════════ */
[id="wkCalendarRoot"] .wkc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 16px;
  align-items: start;
}
[id="wkCalendarRoot"] .wkc-sidebar {
  display: flex; flex-direction: column; gap: 0;
  background: var(--surf, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  padding: 14px;
  position: sticky; top: 12px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}
[id="wkCalendarRoot"] .wkc-upcoming { padding: 0; }
[id="wkCalendarRoot"] .wkc-upcoming-title {
  font-size: 13px; font-weight: 800; margin-bottom: 10px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border-s, #f1f5f9);
}
[id="wkCalendarRoot"] .wkc-upcoming-item {
  display: flex; gap: 10px; padding: 10px 8px; border-radius: 8px;
  cursor: pointer; transition: background .15s, transform .12s;
  border: 1px solid transparent;
}
[id="wkCalendarRoot"] .wkc-upcoming-item:hover {
  background: color-mix(in srgb, var(--c-blue, #2563eb) 6%, var(--surf, #fff));
  border-color: var(--border-s, #f1f5f9);
  transform: translateX(2px);
}
[id="wkCalendarRoot"] .wkc-upcoming-date {
  flex-shrink: 0; width: 38px; text-align: center;
  background: color-mix(in srgb, var(--c-blue, #2563eb) 8%, transparent);
  border-radius: 6px; padding: 4px 0;
}
[id="wkCalendarRoot"] .wkc-upcoming-date-month { font-size: 9px; font-weight: 700; text-transform: uppercase; color: var(--c-blue, #2563eb); letter-spacing: .3px; }
[id="wkCalendarRoot"] .wkc-upcoming-date-day { font-size: 16px; font-weight: 800; color: var(--ink, #0f172a); line-height: 1; }
[id="wkCalendarRoot"] .wkc-upcoming-body { flex: 1; min-width: 0; }
[id="wkCalendarRoot"] .wkc-upcoming-name { font-size: 12px; font-weight: 600; color: var(--ink, #0f172a); margin-bottom: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[id="wkCalendarRoot"] .wkc-upcoming-meta { font-size: 10px; color: var(--ink3, #64748b); }
[id="wkCalendarRoot"] .wkc-upcoming-type {
  display: inline-block; padding: 1px 6px; border-radius: 4px;
  font-weight: 700; font-size: 9px; text-transform: uppercase; letter-spacing: .2px;
}

/* Toolbar — top of calendar */
[id="wkCalendarRoot"] .wkc-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; margin-bottom: 12px;
  background: var(--surf, #fff); border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
}
[id="wkCalendarRoot"] .wkc-toolbar-left,
[id="wkCalendarRoot"] .wkc-toolbar-right {
  display: flex; align-items: center; gap: 8px;
}
[id="wkCalendarRoot"] .wkc-month-label {
  font-size: 16px; font-weight: 800; color: var(--ink, #0f172a); margin-left: 6px;
}
[id="wkCalendarRoot"] .wkc-view-toggle {
  display: inline-flex; background: var(--border-s, #f1f5f9); border-radius: 8px; padding: 2px;
}
[id="wkCalendarRoot"] .wkc-view-btn {
  padding: 5px 14px; border-radius: 6px; font-size: 12px; font-weight: 700;
  color: var(--ink3, #64748b); background: transparent; border: none; cursor: pointer;
  transition: background .15s, color .15s;
}
[id="wkCalendarRoot"] .wkc-view-btn:hover { color: var(--ink, #0f172a); }
[id="wkCalendarRoot"] .wkc-view-btn.is-active {
  background: var(--surf, #fff); color: var(--c-blue, #2563eb);
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}

/* Week view */
[id="wkCalendarRoot"] .wkc-grid--week {
  display: grid !important;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  background: transparent;
}
.wkc-week-col {
  display: flex; flex-direction: column; min-width: 0;
  background: var(--surf, #fff); border: 1px solid var(--border-s, #f1f5f9); border-radius: 8px;
  overflow: hidden;
}
.wkc-week-col.wkc-weekend { background: color-mix(in srgb, var(--ink, #0f172a) 2%, var(--surf)); }
.wkc-week-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 8px 10px; border-bottom: 1px solid var(--border-s, #f1f5f9);
  cursor: pointer; transition: background .15s;
}
.wkc-week-head:hover { background: color-mix(in srgb, var(--c-blue, #2563eb) 6%, transparent); }
.wkc-week-head.is-today { background: color-mix(in srgb, var(--c-blue, #2563eb) 10%, transparent); }
.wkc-week-head.is-selected { box-shadow: inset 0 0 0 2px var(--c-blue, #2563eb); }
.wkc-week-dow { font-size: 10px; font-weight: 800; text-transform: uppercase; color: var(--ink3, #64748b); letter-spacing: .3px; }
.wkc-week-num { font-size: 18px; font-weight: 800; color: var(--ink, #0f172a); }
.wkc-week-head.is-today .wkc-week-num { color: var(--c-blue, #2563eb); }
.wkc-week-body { flex: 1; padding: 6px; display: flex; flex-direction: column; gap: 4px; min-height: 220px; cursor: pointer; }
.wkc-week-empty { font-size: 10px; color: var(--ink4, #94a3b8); text-align: center; padding: 8px 0; }
.wkc-week-event {
  padding: 6px 8px; border-radius: 6px; cursor: pointer;
  transition: transform .12s;
}
.wkc-week-event:hover { transform: translateY(-1px); }
.wkc-week-event-title { font-size: 11px; font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wkc-week-event-meta { font-size: 9px; opacity: .8; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 980px) {
  [id="wkCalendarRoot"] .wkc-layout { grid-template-columns: 1fr; }
  [id="wkCalendarRoot"] .wkc-sidebar { position: static; max-height: none; }
  [id="wkCalendarRoot"] .wkc-grid--week { grid-template-columns: 1fr; }
  .wkc-week-body { min-height: auto; }
}

/* ── Calendar polish: New Task button + day selection + smooth transitions ── */
.wkc-new-task-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  font-size: 12px; font-weight: 600; font-family: inherit;
  border-radius: 8px; border: 1px solid var(--c-blue, #2563eb);
  background: var(--c-blue, #2563eb); color: #fff;
  cursor: pointer; white-space: nowrap;
  transition: background .15s ease, transform .12s ease, box-shadow .15s ease;
}
.wkc-new-task-btn:hover { background: var(--c-blue-d, #1e40af); box-shadow: 0 2px 8px rgba(37,99,235,.25); }
.wkc-new-task-btn:active { transform: scale(.97); }
.wkc-new-task-btn svg { stroke: currentColor; flex-shrink: 0; }

/* Day cell — make a clicked square obviously highlighted */
.wkc-cell { transition: background-color .18s ease, box-shadow .18s ease; cursor: pointer; }
.wkc-cell:hover { background: rgba(37,99,235,.04); }
.wkc-cell.is-selected {
  background: rgba(37,99,235,.10);
  box-shadow: inset 0 0 0 2px var(--c-blue, #2563eb);
  position: relative; z-index: 1;
}
.wkc-cell.is-selected.is-today { box-shadow: inset 0 0 0 2px var(--c-blue, #2563eb); }
.wkc-cell.is-selected .wkc-cell-num { color: var(--c-blue, #2563eb); font-weight: 800; }

/* Smooth view-switch fade and prev/next nav slide. Applied briefly while
   we swap week<->month markup or step through months. */
.wkc-grid, .wkc-sidebar { transition: opacity .18s ease, transform .18s ease; }
.wkc-grid.wkc-fade-out, .wkc-sidebar.wkc-fade-out { opacity: 0; transform: translateY(4px); }
/* Direction-aware slide for prev/next. Out goes the way the user is "moving
   away from"; in comes from the opposite direction. */
.wkc-grid.wkc-slide-out-left  { opacity: 0; transform: translateX(-18px); }
.wkc-grid.wkc-slide-out-right { opacity: 0; transform: translateX(18px); }
.wkc-grid.wkc-slide-in-left   { opacity: 0; transform: translateX(-18px); }
.wkc-grid.wkc-slide-in-right  { opacity: 0; transform: translateX(18px); }
.wkc-grid.wkc-fade-in         { opacity: 0; }
/* Toolbar label animates so the date jump feels alive */
.wkc-month-label { transition: opacity .18s ease, transform .18s ease; }

/* Right-side upcoming list — subtle entrance + hover transition for a smoother feel
   when the user navigates between days/weeks/months. */
.wkc-upcoming-item, .wkc-selected-section { transition: background-color .15s ease, transform .12s ease; }
.wkc-upcoming-item { animation: wkcRowIn .22s ease both; }
@keyframes wkcRowIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.wkc-upcoming-item:hover { background: rgba(37,99,235,.05); transform: translateX(2px); }


/* ════════════════════════════════════════════════════════════════
   Merged toolbar — search / filter / team-picker relocated onto the
   date row (removes the separate white-space toolbar row above the
   calendar). Plus event-count chip + consistent button transitions.
   ════════════════════════════════════════════════════════════════ */
[id="wkCalendarRoot"] .wkc-toolbar-left,
[id="wkTmCalendarRoot"] .wkc-toolbar-left { flex: 1 1 auto; min-width: 0; gap: 10px; }
[id="wkCalendarRoot"] .wkc-month-label,
[id="wkTmCalendarRoot"] .wkc-month-label { white-space: nowrap; flex-shrink: 0; }

.wkc-tool-slot { display: flex; align-items: center; gap: 8px; flex: 1 1 auto; min-width: 0; }
.wkc-tool-slot:empty { display: none; }
.wkc-tool-slot .wk-focus-search-wrap {
  flex: 1 1 auto; min-width: 130px; max-width: 380px;
  transition: box-shadow .15s ease, border-color .15s ease, background .15s ease;
}
.wkc-tool-slot .wk-cal-team-picker,
.wkc-tool-slot .wk-team-picker { flex-shrink: 0; }

.wkc-count {
  font-size: 12px; font-weight: 700; line-height: 1; color: var(--ink3, #64748b);
  background: var(--wt-neutral-bg, #f1f5f9);
  padding: 5px 10px; border-radius: 999px; white-space: nowrap; flex-shrink: 0;
  transition: opacity .2s ease, background .2s ease;
}
.wkc-count[hidden] { display: none; }

/* Smooth, consistent transitions on every toolbar control */
.wkc-toolbar .wk-focus-filter-btn { transition: background .15s ease, border-color .15s ease, color .15s ease, transform .12s ease; }
.wkc-toolbar .wk-focus-filter-btn:hover { transform: translateY(-1px); }
.wkc-toolbar .wkc-nav-btn:active { transform: scale(.92); }
.wkc-today-btn:active { transform: scale(.96); }

/* Narrow widths: drop the search to its own line under the date row */
@media (max-width: 860px) {
  [id="wkCalendarRoot"] .wkc-toolbar,
  [id="wkTmCalendarRoot"] .wkc-toolbar { flex-wrap: wrap; row-gap: 8px; }
  .wkc-tool-slot { order: 3; flex-basis: 100%; }
  .wkc-tool-slot .wk-focus-search-wrap { max-width: none; }
}

/* ══════════════════════════════════════════
   Recurring occurrences — projected (virtual) events + occurrence menu
   ══════════════════════════════════════════ */
/* Virtual occurrences read as "scheduled but not yet a concrete record":
   dashed left edge + slightly softer fill so they're distinguishable from
   real, actioned tasks while staying legible. */
.wkc-event--recurring {
  border-left-style: dashed !important;
  opacity: .9;
}
.wkc-event-repeat {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  opacity: .7;
}
.wkc-event-repeat svg { width: 9px; height: 9px; }
.wkc-week-event.wkc-event--recurring { border-left-style: dashed !important; }
.wkc-week-event .wkc-event-repeat svg { width: 10px; height: 10px; margin-right: 2px; vertical-align: -1px; }
.wkc-upcoming-repeat { color: #4d7a41; font-weight: 700; }

/* Occurrence action menu (Jobber-style) */
.wkc-occ-menu {
  position: fixed;
  z-index: 100000;
  width: 258px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 12px 34px rgba(15, 23, 42, .18);
  padding: 6px;
  font-size: 13px;
  animation: wkcOccIn .12s ease;
}
@keyframes wkcOccIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.wkc-occ-menu-head {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 8px 8px 10px;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 4px;
}
.wkc-occ-menu-repeat { color: #4d7a41; margin-top: 2px; flex: 0 0 auto; }
.wkc-occ-menu-title { font-weight: 700; color: #111827; line-height: 1.25; }
.wkc-occ-menu-date { font-size: 11.5px; color: #6b7280; margin-top: 2px; }
.wkc-occ-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  color: #1f2937;
  font: inherit;
}
.wkc-occ-item:hover { background: #f3f4f6; }
.wkc-occ-item--danger { color: #b91c1c; }
.wkc-occ-item--danger:hover { background: #fef2f2; }
.wkc-occ-sep { height: 1px; background: #f1f5f9; margin: 4px 6px; }

@media (prefers-color-scheme: dark) {
  .wkc-occ-menu { background: #1f2430; border-color: #333b4d; box-shadow: 0 12px 34px rgba(0,0,0,.5); }
  .wkc-occ-menu-head { border-bottom-color: #333b4d; }
  .wkc-occ-menu-title { color: #f3f4f6; }
  .wkc-occ-menu-date { color: #9aa4b2; }
  .wkc-occ-item { color: #e5e7eb; }
  .wkc-occ-item:hover { background: #2a3140; }
  .wkc-occ-item--danger { color: #f87171; }
  .wkc-occ-item--danger:hover { background: #3a2526; }
  .wkc-occ-sep { background: #333b4d; }
  .wkc-upcoming-repeat { color: #86b877; }
}
:root[data-theme="dark"] .wkc-occ-menu { background: #1f2430; border-color: #333b4d; box-shadow: 0 12px 34px rgba(0,0,0,.5); }
:root[data-theme="dark"] .wkc-occ-menu-head { border-bottom-color: #333b4d; }
:root[data-theme="dark"] .wkc-occ-menu-title { color: #f3f4f6; }
:root[data-theme="dark"] .wkc-occ-menu-date { color: #9aa4b2; }
:root[data-theme="dark"] .wkc-occ-item { color: #e5e7eb; }
:root[data-theme="dark"] .wkc-occ-item:hover { background: #2a3140; }
:root[data-theme="dark"] .wkc-occ-item--danger { color: #f87171; }
:root[data-theme="dark"] .wkc-occ-item--danger:hover { background: #3a2526; }
:root[data-theme="dark"] .wkc-occ-sep { background: #333b4d; }
:root[data-theme="dark"] .wkc-upcoming-repeat { color: #86b877; }
:root[data-theme="light"] .wkc-occ-menu { background: #fff; border-color: #e5e7eb; }

/* ══════════════════════════════════════════════════════════════════
   FACES, MEANINGFUL COLOUR, AND A SERIES DELETE YOU HAVE TO MEAN
   ══════════════════════════════════════════════════════════════════ */

/* ── Assignee face on every chip ──
   A calendar of identical rows can't answer "is that mine or Michelle's?".
   The face answers it before you read a word. */
.wkc-av {
  flex-shrink: 0; position: relative;
  width: 16px; height: 16px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font: 800 7.5px/1 'Inter', system-ui, sans-serif; letter-spacing: .02em;
  color: #fff; background: #94a3b8; overflow: visible;
  box-shadow: 0 0 0 1.5px rgba(255,255,255,.85);
}
.wkc-av--img { background: transparent; box-shadow: 0 0 0 1.5px rgba(255,255,255,.85); }
/* Size the photo off the BASE class, not the --img modifier: the box is
   overflow:visible (the +N badge hangs outside it), so a face that misses its
   sizing rule paints at full resolution straight across the row. */
.wkc-av img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.wkc-av--none {
  background: transparent; color: #94a3b8;
  box-shadow: inset 0 0 0 1.2px currentColor;
}
.wkc-av--none svg { width: 9px; height: 9px; }
.wkc-av--lg { width: 24px; height: 24px; font-size: 9.5px; }
.wkc-av--lg .wkc-av--none svg, .wkc-av--lg svg { width: 12px; height: 12px; }
.wkc-av-more {
  position: absolute; right: -6px; bottom: -4px;
  font: 800 7px/1 'Inter', system-ui, sans-serif; font-style: normal;
  background: #475569; color: #fff; border-radius: 6px; padding: 1.5px 2.5px;
  box-shadow: 0 0 0 1.2px rgba(255,255,255,.9);
}

/* Month chip: repeat glyph · kind glyph · title · face */
.wkc-event { display: flex; align-items: center; gap: 4px; }
.wkc-event .wkc-event-label { flex: 1; min-width: 0; }
.wkc-event .wkc-av { margin-left: auto; }
.wkc-event.is-done .wkc-event-label { text-decoration: line-through; opacity: .7; }

/* Deliverables carry their document glyph onto the grid, so an output never
   reads as a to-do here either (matches the deliverable card). */
.wkc-kind { flex-shrink: 0; display: inline-flex; align-items: center; opacity: .85; margin-right: 4px; vertical-align: -1px; }
.wkc-kind svg { width: 10px; height: 10px; }
.wkc-kind--deliv { color: currentColor; }
/* Month chips are a flex row — the gap already spaces the glyph. */
.wkc-event .wkc-kind { margin-right: 0; }

/* Week chips get the face on its own row so the title keeps its width */
.wkc-week-event-row { display: flex; align-items: center; gap: 5px; min-width: 0; }
.wkc-week-event-row .wkc-week-event-title { flex: 1; min-width: 0; }
.wkc-week-event.is-done .wkc-week-event-title { text-decoration: line-through; opacity: .7; }

/* Upcoming rows: face on the right, owner first-name in the meta line */
.wkc-upcoming-item { display: flex; align-items: center; gap: 10px; }
.wkc-upcoming-item .wkc-av--lg { margin-left: auto; }
.wkc-upcoming-owner { font-size: 10px; font-weight: 700; color: var(--ink3, #64748b); }
.wkc-upcoming-item.is-done .wkc-upcoming-name { text-decoration: line-through; opacity: .65; }

/* Day popup rows */
.wkc-day-popup-event-owner { font-size: 10px; font-weight: 700; color: var(--ink3, #64748b); }
.wkc-day-popup-event-owner.is-none { font-style: italic; opacity: .7; }
.wkc-day-popup-event-stream {
  font-size: 10px; font-weight: 700; color: #4338ca;
  background: #eef2ff; border-radius: 20px; padding: 1px 7px;
  max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wkc-day-popup-event.is-done .wkc-day-popup-event-name { text-decoration: line-through; opacity: .65; }

/* ── Colour-by control + legend ──
   The old colouring keyed on "company", which almost nothing carries, so the
   whole grid came out one shade. Now the axis is a choice and the legend
   states it plainly instead of leaving people to guess. */
.wkc-colorby { display: inline-flex; align-items: center; gap: 6px; }
.wkc-colorby-label {
  font: 700 10px/1 'Inter', system-ui, sans-serif; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink3, #64748b);
  white-space: nowrap;
}
.wkc-colorby-sel {
  font: 600 11.5px/1 'Inter', system-ui, sans-serif; color: var(--ink, #0f172a);
  background: var(--surf, #fff); border: 1px solid var(--border, #e2e8f0);
  border-radius: 7px; padding: 5px 8px; cursor: pointer;
}
.wkc-colorby-sel:hover { border-color: #cbd5e1; }
.wkc-legend {
  display: flex; flex-wrap: wrap; gap: 5px 10px;
  padding: 0 0 12px; margin-bottom: 10px;
  border-bottom: 1px solid var(--border-s, #f1f5f9);
}
.wkc-legend:empty { display: none; }
.wkc-legend-item {
  display: inline-flex; align-items: center; gap: 5px;
  font: 600 10.5px/1 'Inter', system-ui, sans-serif; color: var(--ink3, #64748b);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wkc-legend-item i { width: 8px; height: 8px; border-radius: 3px; flex-shrink: 0; }
.wkc-legend-item b { font-weight: 800; color: var(--ink2, #475569); }

/* ── Series deletion: locked when you can't, confirmed when you can ──
   Wiping a series destroys occurrences other people already completed and
   there is no undo, so edit rights alone don't unlock it. */
.wkc-occ-item.is-locked {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  color: #9ca3af; cursor: not-allowed; opacity: .8;
}
.wkc-occ-item.is-locked:hover { background: transparent; }
.wkc-occ-lock { flex-shrink: 0; opacity: .75; }
.wkc-occ-note {
  padding: 8px 12px 10px; margin-top: 2px;
  font: 500 10.5px/1.45 'Inter', system-ui, sans-serif; color: var(--ink3, #64748b);
  border-top: 1px solid var(--border-s, #f1f5f9);
}
.wkc-occ-confirm { padding: 12px 12px 11px; }
.wkc-occ-confirm-title {
  font: 800 12.5px/1.3 'Inter', system-ui, sans-serif; color: #b91c1c; margin-bottom: 5px;
}
.wkc-occ-confirm-body {
  font: 500 11px/1.5 'Inter', system-ui, sans-serif; color: var(--ink2, #475569); margin-bottom: 11px;
}
.wkc-occ-confirm-body strong { color: #b91c1c; font-weight: 800; }
.wkc-occ-confirm-actions { display: flex; gap: 7px; justify-content: flex-end; }
.wkc-occ-btn {
  font: 700 11px/1 'Inter', system-ui, sans-serif; padding: 7px 11px;
  border-radius: 7px; cursor: pointer;
  border: 1px solid var(--border, #e2e8f0); background: var(--surf, #fff); color: var(--ink2, #475569);
}
.wkc-occ-btn:hover { background: #f8fafc; }
.wkc-occ-btn--danger { background: #dc2626; border-color: #dc2626; color: #fff; }
.wkc-occ-btn--danger:hover { background: #b91c1c; border-color: #b91c1c; }

@media (prefers-color-scheme: dark) {
  .wkc-colorby-sel { background: #1f2430; border-color: #333b4d; color: #e5e7eb; }
  .wkc-legend { border-bottom-color: #333b4d; }
  .wkc-day-popup-event-stream { background: #2a2f45; color: #a5b4fc; }
  .wkc-occ-note { border-top-color: #333b4d; }
  .wkc-occ-btn { background: #1f2430; border-color: #333b4d; color: #e5e7eb; }
  .wkc-occ-btn:hover { background: #2a3140; }
  .wkc-av { box-shadow: 0 0 0 1.5px rgba(20,24,33,.85); }
  .wkc-av--img { box-shadow: 0 0 0 1.5px rgba(20,24,33,.85); }
}
:root[data-theme="dark"] .wkc-colorby-sel { background: #1f2430; border-color: #333b4d; color: #e5e7eb; }
:root[data-theme="dark"] .wkc-legend { border-bottom-color: #333b4d; }
:root[data-theme="dark"] .wkc-occ-btn { background: #1f2430; border-color: #333b4d; color: #e5e7eb; }
:root[data-theme="dark"] .wkc-av, :root[data-theme="dark"] .wkc-av--img { box-shadow: 0 0 0 1.5px rgba(20,24,33,.85); }
