/* NINEWORKS CRM — runtime stability and native calendar geometry */
html[data-theme="light"] .page.is-active {
  animation: none !important;
}

html[data-theme="light"] .app-content,
html[data-theme="light"] .page,
html[data-theme="light"] .panel,
html[data-theme="light"] .calendar-main,
html[data-theme="light"] .workspace-content,
html[data-theme="light"] .table-panel {
  background-image: none !important;
}

html[data-theme="light"] .page *,
html[data-theme="light"] .topbar * {
  transition: none !important;
}

html[data-theme="light"].nw-route-switching body::after {
  content: "";
  position: fixed;
  z-index: 9000;
  inset: 64px 0 0;
  background: #f7f7f5;
  pointer-events: none;
}

/* FullCalendar owns event coordinates. Do not force top/left/height on harnesses. */
html[data-theme="light"] #calendar .fc-daygrid-day-frame {
  min-height: 112px !important;
  height: auto !important;
}

html[data-theme="light"] #calendar .fc-daygrid-day-top {
  min-height: 25px !important;
  padding: 5px 7px 1px !important;
}

html[data-theme="light"] #calendar .fc-daygrid-day-number {
  padding: 0 !important;
}

html[data-theme="light"] #calendar .fc-daygrid-day-events {
  min-height: 0 !important;
  margin: 3px 4px 6px !important;
  overflow: visible !important;
}

html[data-theme="light"] #calendar .fc-daygrid-event-harness {
  margin-top: 2px !important;
  margin-bottom: 0 !important;
}

/* Compact but readable event cards. Outer event stays overflow-visible for the custom resize handle. */
html[data-theme="light"] #calendar .fc-daygrid-event,
html[data-theme="light"] #calendar .fc-timegrid-event,
html[data-theme="light"] #calendar .fc-event,
html[data-theme="light"] #calendar .fc-h-event {
  box-sizing: border-box !important;
  height: 32px !important;
  min-height: 32px !important;
  max-height: 32px !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 9px !important;
  line-height: 1.1 !important;
}

html[data-theme="light"] #calendar .fc-daygrid-event,
html[data-theme="light"] #calendar .fc-h-event {
  overflow: visible !important;
}

html[data-theme="light"] #calendar .fc-event-main,
html[data-theme="light"] #calendar .fc-event-main-frame {
  box-sizing: border-box !important;
  display: flex !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 100% !important;
  align-items: center !important;
  padding: 0 8px !important;
  border-radius: inherit !important;
  overflow: hidden !important;
}

html[data-theme="light"] #calendar .nw-event-content {
  display: flex !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 100% !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 0 !important;
  overflow: hidden !important;
}

html[data-theme="light"] #calendar .nw-event-title {
  display: flex !important;
  width: 100% !important;
  min-width: 0 !important;
  align-items: center !important;
  gap: 6px !important;
  line-height: 1 !important;
  overflow: hidden !important;
}

html[data-theme="light"] #calendar .nw-client-badge {
  display: inline-flex !important;
  flex: 0 0 auto !important;
  max-width: 88px !important;
  height: 18px !important;
  min-height: 18px !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 6px !important;
  border-radius: 999px !important;
  font-size: 10px !important;
  font-weight: 650 !important;
  line-height: 18px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

html[data-theme="light"] #calendar .nw-task-title,
html[data-theme="light"] #calendar .fc-event-title {
  min-width: 0 !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  line-height: 1.15 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

html[data-theme="light"] #calendar .nw-event-note {
  display: none !important;
}

/* dayMaxEvents is disabled in JS; keep any stale more-link hidden defensively. */
html[data-theme="light"] #calendar .fc-daygrid-more-link,
html[data-theme="light"] #calendar .fc-more-link {
  display: none !important;
}

/* Only the custom right-edge handle may change duration. */
html[data-theme="light"] #calendar .fc-event-resizer,
html[data-theme="light"] #calendar .fc-event-resizer-end,
html[data-theme="light"] #calendar .fc-event-resizer-start {
  display: none !important;
  pointer-events: none !important;
}

html[data-theme="light"] #calendar .nw-duration-resize-handle {
  display: block !important;
  pointer-events: auto !important;
}

/* While stretching, hide the original source card completely and show only the preview. */
html[data-theme="light"] #calendar .is-duration-resize-source {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

html[data-theme="light"] #calendar .fc-event-dragging,
html[data-theme="light"] #calendar .fc-event-resizing,
html[data-theme="light"] #calendar .is-custom-resizing {
  z-index: 100 !important;
}

@media (max-width: 900px) {
  html[data-theme="light"] #calendar .fc-daygrid-day-frame {
    min-height: 100px !important;
  }

  html[data-theme="light"] #calendar .fc-daygrid-event,
  html[data-theme="light"] #calendar .fc-event,
  html[data-theme="light"] #calendar .fc-h-event {
    height: 30px !important;
    min-height: 30px !important;
    max-height: 30px !important;
  }

  html[data-theme="light"] #calendar .fc-event-main,
  html[data-theme="light"] #calendar .fc-event-main-frame {
    padding: 0 7px !important;
  }

  html[data-theme="light"] #calendar .nw-task-title,
  html[data-theme="light"] #calendar .fc-event-title {
    font-size: 12px !important;
  }
}
