/* MSH Organize — Calendar filters. Single visual source. */
:root{
  --cf-h:44px;--cf-radius:12px;--cf-gap:8px;--cf-border:#dbe3ec;
  --cf-text:#344054;--cf-muted:#98a2b3;--cf-blue:#2878e8;
  --cf-surface:rgba(255,255,255,.78)
}

/* Month + navigation always stay on one row. */
#calendarCard .calendar-title-row{
  display:flex!important;align-items:center!important;justify-content:space-between!important;
  flex-wrap:nowrap!important;gap:12px;width:100%;min-width:0
}
#calendarCard .calendar-title-row>div:first-child{flex:1 1 auto;min-width:0}
#calendarCard #monthTitle{white-space:nowrap}
#calendarCard .calendar-actions{display:flex;align-items:center;flex:0 0 auto;gap:5px;white-space:nowrap}

/* Full-width filter bar, now a sibling below the title row. */
#compactCalendarFilterRow{
  position:relative;z-index:4300;isolation:isolate;overflow:visible;
  display:grid;grid-template-columns:minmax(220px,.85fr) minmax(280px,1.1fr) minmax(440px,2fr);
  align-items:start;gap:0;width:100%;max-width:none;min-width:0;margin:10px 0 4px;padding:8px;
  border:1px solid rgba(203,213,225,.7);border-radius:18px;background:var(--cf-surface);
  box-shadow:0 1px 2px rgba(15,23,42,.025);box-sizing:border-box;
  -webkit-backdrop-filter:blur(18px) saturate(145%);backdrop-filter:blur(18px) saturate(145%)
}
.compact-filter{position:relative;min-width:0;padding:0 10px}
#compactCalendarFilterRow>.compact-filter:first-child{padding-left:0}
#compactCalendarFilterRow>.compact-filter:last-child{padding-right:0}
#compactCalendarFilterRow>.compact-filter+.compact-filter{border-left:1px solid rgba(203,213,225,.58)}
.compact-filter-head{display:flex;align-items:center;gap:var(--cf-gap);min-width:0}

/* Trigger and chip use the same border box. */
.compact-filter-trigger,.compact-chip{
  box-sizing:border-box;height:var(--cf-h);min-height:var(--cf-h);max-height:var(--cf-h);
  margin:0;border:1px solid var(--cf-border);line-height:1
}
.compact-filter-trigger{
  flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;gap:7px;padding:0 11px;
  border-radius:var(--cf-radius);background:rgba(255,255,255,.9);color:var(--cf-text);
  font:inherit;font-size:12px;font-weight:650;white-space:nowrap;cursor:pointer;
  transition:border-color .15s,box-shadow .15s,background .15s
}
.compact-filter-trigger:hover{background:#fff;border-color:#c9d5e3}
.compact-filter.open .compact-filter-trigger{border-color:#91b9ec;box-shadow:0 0 0 3px rgba(40,120,232,.07)}
.compact-filter-expand{position:relative;display:inline-block;flex:0 0 10px;width:10px;height:10px;color:var(--cf-muted);transition:transform .16s,color .16s}
.compact-filter-expand::before{content:"";position:absolute;left:1px;top:0;width:6px;height:6px;border-right:2px solid currentColor;border-bottom:2px solid currentColor;transform:rotate(45deg);transform-origin:center}
.compact-filter.open .compact-filter-expand{transform:rotate(180deg);color:var(--cf-blue)}
.compact-palette-check{font-family:inherit!important;font-size:12px;font-weight:800;line-height:1}

/* The collection may wrap between chips; a chip itself never wraps. */
.compact-filter-chips{display:flex;align-items:center;gap:6px;flex:1 1 auto;min-width:0;flex-wrap:wrap}
.compact-chip{
  display:inline-flex!important;flex-flow:row nowrap!important;align-items:center!important;gap:6px;
  max-width:230px;padding:0 8px;border-radius:var(--cf-radius);background:#f8fafc;color:#475467;
  font:inherit;font-size:12px;white-space:nowrap!important;vertical-align:middle
}
.compact-chip>*{flex-shrink:0;align-self:center}
.compact-chip-label{
  display:inline-block!important;min-width:0;max-width:180px;overflow:hidden;text-overflow:ellipsis;
  white-space:nowrap!important;line-height:1!important;margin:0!important
}
.compact-chip-x{
  display:inline-flex!important;align-items:center!important;justify-content:center!important;
  flex:0 0 22px!important;width:22px!important;height:22px!important;min-width:22px!important;
  margin:0!important;padding:0!important;border:0;border-radius:50%;background:transparent;color:#98a2b3;
  font:inherit;font-size:15px;line-height:1!important;cursor:pointer;position:static!important
}
.compact-chip-x:hover,.compact-chip-x:focus-visible{color:#d92d20;background:#feeceb;outline:none}

.compact-chip-dot,.compact-option-dot{width:10px;height:10px;border-radius:50%;flex:0 0 10px;box-shadow:0 0 0 1px rgba(15,23,42,.07)}
.compact-chip-avatar,.compact-option-avatar{width:28px;height:28px;border-radius:50%;object-fit:cover;object-position:center;flex:0 0 28px;background:#eef2f6}
.compact-option-avatar{width:32px;height:32px;flex-basis:32px}
.compact-avatar-fallback{display:inline-flex;align-items:center;justify-content:center;color:#475467;font-weight:700;font-size:10px}

#compactCalendarSources .compact-chip{
  border-color:color-mix(in srgb,var(--chip-color,#94a3b8) 42%,#dfe4eb);
  background:color-mix(in srgb,var(--chip-color,#94a3b8) 12%,white);
  color:color-mix(in srgb,var(--chip-color,#475467) 60%,#263238);font-weight:600
}
#compactCalendarSources .compact-chip-x{color:color-mix(in srgb,var(--chip-color,#94a3b8) 55%,#667085)}
#compactCalendarSources .compact-chip-x:hover,#compactCalendarSources .compact-chip-x:focus-visible{color:#d92d20;background:#feeceb}

/* Keep the calendar grid in a lower painting layer than every open filter panel. */
#calendarCard .calendar-scroll-viewport>.weekdays,#calendarCard .calendar-scroll-viewport>.calendar-grid{position:relative;z-index:0}
#calendarCard .cal-event,#calendarCard .cal-event-people,#calendarCard .cal-person-avatar{z-index:auto!important}

/* Picker */
.compact-filter-panel{
  position:absolute;z-index:4200;top:calc(100% + 8px);left:10px;width:min(410px,calc(100vw - 32px));
  max-height:min(410px,68vh);overflow:hidden;padding:8px;border:1px solid rgba(148,163,184,.22);
  border-radius:16px;background:rgba(255,255,255,.98);box-shadow:0 20px 56px rgba(15,23,42,.16);
  -webkit-backdrop-filter:blur(20px) saturate(155%);backdrop-filter:blur(20px) saturate(155%)
}
.compact-filter-search{
  width:100%;height:42px;margin:0 0 7px;padding:0 11px!important;border:1px solid #bfd1e9!important;
  border-radius:11px!important;background:#fff!important;box-shadow:none!important;outline:0;font:inherit
}
.compact-filter-search:focus{border-color:#6fa6ea!important;box-shadow:0 0 0 3px rgba(40,120,232,.08)!important}
.compact-filter-options{max-height:330px;overflow:auto;-webkit-overflow-scrolling:touch}
.compact-option{width:100%;min-height:42px;display:flex;align-items:center;gap:9px;padding:7px 8px;border:0;border-radius:10px;background:transparent;color:var(--cf-text);text-align:left;font:inherit;cursor:pointer}
.compact-option:hover,.compact-option.active{background:#f7f9fc}
.compact-option.selected{background:#edf5ff}
.compact-check{width:19px;height:19px;flex:0 0 19px;display:inline-flex;align-items:center;justify-content:center;border:1.5px solid #cbd5e1;border-radius:6px;color:#fff;font-size:11px;font-weight:700}
.compact-option.selected .compact-check{background:var(--cf-blue);border-color:var(--cf-blue)}
.compact-option-copy{display:flex;flex-direction:column;min-width:0;flex:1}
.compact-option-copy b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px;font-weight:600}
.compact-option-copy small{font-size:11px;color:#667085;margin-top:1px}
.compact-empty{padding:14px;text-align:center;color:#667085;font-size:12px}

/* Other views sharing compactMulti. */
.compact-list-work-holder{min-width:260px;flex:1}
.compact-list-work-holder .compact-filter-head{min-height:52px;padding:5px 7px;align-items:center;border:1px solid #d3dde8;border-radius:14px;background:#fff;box-sizing:border-box}
.compact-list-work-holder .compact-filter-trigger{height:40px;min-height:40px;max-height:40px;border:0}
.compact-list-work-holder .compact-filter-chips{align-items:center;align-content:center}
.compact-list-work-holder .compact-chip{height:36px;min-height:36px;max-height:36px;padding:0 7px;border-radius:12px}
.compact-list-work-holder .compact-chip-x{width:20px!important;height:20px!important;min-width:20px!important;flex-basis:20px!important}
.compact-form-results{border-radius:14px!important;box-shadow:0 18px 50px rgba(15,23,42,.14)!important;overflow:auto!important}
.smart-filter-row,#smartCalendarWork,#smartCalendarSources,#calendarWorkInlineFilter{display:none!important}

@media(max-width:1180px){
  #compactCalendarFilterRow{grid-template-columns:1fr 1.25fr}
  #compactCalendarSources{grid-column:1/-1;border-left:0!important;border-top:1px solid rgba(203,213,225,.58);margin-top:8px;padding:8px 0 0!important}
}

@media(max-width:700px){
  #calendarCard .calendar-title-row{gap:8px}
  #calendarCard #monthTitle{font-size:1rem}
  #calendarCard .calendar-actions{gap:4px}
  #calendarCard .calendar-actions .ghost{padding:8px 9px}
  #compactCalendarFilterRow{display:block;margin:8px 0 3px;padding:5px 8px;border-radius:16px;width:100%}
  #compactCalendarFilterRow>.compact-filter{width:100%;padding:7px 0!important;border-left:0!important;border-top:1px solid rgba(203,213,225,.52)}
  #compactCalendarFilterRow>.compact-filter:first-child{border-top:0}
  #compactCalendarSources{margin-top:0!important}
  .compact-filter-head{display:grid;grid-template-columns:minmax(122px,auto) 1fr;align-items:start;gap:7px}
  .compact-filter-trigger{width:100%;min-width:0;justify-content:space-between;padding:0 10px}
  .compact-filter-chips{width:100%;gap:5px}
  .compact-chip{max-width:min(190px,100%);padding:0 7px}
  .compact-chip-label{max-width:125px}
  .compact-chip-x{width:26px!important;height:26px!important;min-width:26px!important;flex-basis:26px!important}
  .compact-chip-avatar{width:30px;height:30px;flex-basis:30px}
  .compact-filter-panel{position:fixed;left:10px;right:10px;top:auto;bottom:max(10px,env(safe-area-inset-bottom));width:auto;max-height:min(72dvh,620px);border-radius:20px;padding:10px;z-index:9000;box-shadow:0 24px 80px rgba(15,23,42,.24)}
  .compact-filter-search{height:46px}.compact-filter-options{max-height:calc(72dvh - 72px)}
  .compact-option{min-height:48px;padding:8px 9px}.compact-option-copy b{font-size:14px}.compact-option-copy small{font-size:12px}
  .compact-list-work-holder{min-width:0;width:100%}
}

@media(max-width:420px){
  .compact-filter-head{grid-template-columns:1fr}
  .compact-filter-trigger{width:100%}
  .compact-chip{max-width:100%}
  #calendarCard .calendar-actions #todayMonth{padding-inline:8px}
}


/* Local, in-button feedback keeps the user's eyes on the control they pressed. */
button,input[type="button"],input[type="submit"]{transition:transform .12s ease,box-shadow .18s ease,border-color .18s ease,background-color .18s ease}
button:active:not(:disabled),input[type="button"]:active:not(:disabled),input[type="submit"]:active:not(:disabled){transform:translateY(1px) scale(.985)}
button.msh-button-success,input.msh-button-success{box-shadow:0 0 0 3px rgba(22,139,73,.17)!important;border-color:#65c987!important}
button.msh-button-error,input.msh-button-error{box-shadow:0 0 0 3px rgba(180,35,24,.16)!important;border-color:#e28178!important;animation:mshButtonError .28s ease-in-out}
@keyframes mshButtonError{0%,100%{transform:translateX(0)}35%{transform:translateX(-3px)}70%{transform:translateX(3px)}}
.calendar-filter-visibility{width:38px;min-width:38px;padding:0!important;display:inline-grid!important;place-items:center}
.calendar-filter-visibility svg{width:18px;height:18px}
.calendar-filter-visibility.active{color:#176fd1;background:#edf5ff!important;border-color:#b9d5f6!important}
#compactCalendarFilterRow[hidden]{display:none!important}
@keyframes mshButtonSpin{to{transform:rotate(360deg)}}
button.msh-button-busy,input.msh-button-busy{position:relative!important;cursor:wait!important;pointer-events:none!important;opacity:.82}
button.msh-button-busy::after,input.msh-button-busy::after{
  content:"";display:inline-block;width:14px;height:14px;margin-left:7px;vertical-align:-2px;
  border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:mshButtonSpin .68s linear infinite
}
button.msh-button-busy:has(svg:only-child)::after{position:absolute;margin:0}
button.msh-button-busy:has(svg:only-child) svg{opacity:.18}
button.msh-button-busy.primary,button.msh-button-busy.danger{filter:saturate(.82)}
@media(prefers-reduced-motion:reduce){button.msh-button-busy::after,input.msh-button-busy::after{animation-duration:1.5s}}


/* Structural loading: preserve layout while fresh calendar/list data arrives. */
@keyframes mshSkeletonSweep{0%{background-position:200% 0}100%{background-position:-200% 0}}
.msh-skeleton{display:block;border-radius:7px;background:linear-gradient(100deg,#edf1f5 24%,#f8fafc 38%,#edf1f5 52%);background-size:220% 100%;animation:mshSkeletonSweep 1.25s ease-in-out infinite}
.msh-calendar-skeleton-cell{pointer-events:none;min-height:inherit}
.msh-skeleton-day{width:22px;height:14px;margin:2px 2px 12px auto;border-radius:6px}
.msh-skeleton-event{width:62%;height:16px;margin:5px 2px}.msh-skeleton-event.wide{width:86%}
.msh-list-skeleton{pointer-events:none}
.msh-list-skeleton .msh-skeleton-title{width:72%;height:18px;margin:2px 0 10px}.msh-list-skeleton .msh-skeleton-title.medium{width:54%}
.msh-list-skeleton .msh-skeleton-line{width:44%;height:11px;margin:6px 0}.msh-list-skeleton .msh-skeleton-line.short{width:58%}
.msh-list-skeleton .msh-skeleton-date{width:110px;height:14px;margin:2px 0 10px auto}
@media(prefers-reduced-motion:reduce){.msh-skeleton{animation:none;background:#edf1f5}}


/* Calendar header controls share one vertical rhythm. */
#calendarCard .calendar-actions>button{
  box-sizing:border-box!important;
  height:44px!important;
  min-height:44px!important;
  max-height:44px!important;
  margin:0!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  line-height:1!important
}
#calendarCard .calendar-actions .calendar-filter-visibility,
#calendarCard .calendar-actions #prevMonth,
#calendarCard .calendar-actions #nextMonth{
  width:44px!important;min-width:44px!important;max-width:44px!important;padding:0!important
}
#calendarCard .calendar-actions #todayMonth{min-width:68px!important;padding:0 14px!important}


/* Shared loading feedback r166: keep spinners visible inside every button layout. */
.spinner:not([hidden]){
  display:inline-block!important;width:17px!important;height:17px!important;flex:0 0 17px!important;
  box-sizing:border-box!important;border:2px solid rgba(255,255,255,.45)!important;
  border-top-color:currentColor!important;border-radius:50%!important;
  animation:spin .75s linear infinite!important
}
button.msh-button-busy::after,input.msh-button-busy::after{
  display:inline-block!important;visibility:visible!important;flex:0 0 14px!important;
  box-sizing:border-box!important
}
button[aria-busy="true"]{cursor:wait}
